On Wed, Apr 1, 2015 at 12:57 PM, Sahai, Amal <[email protected]> wrote:
> I've been trying to figure this out for some time now and I really don't
> understand whats going on. I have a system called RAD which has been
> inherited from System class. I am setting values at node points using the
> following function:
>
> void set_nodal_value(const Node *n, System& sys, unsigned int varnum, Real
> value)
> {
> const unsigned int dof_index = n->dof_number(sys.number(), varnum, 0);
> sys.solution->set(dof_index, value);
> }
>
> The code which calls this looks like:
>
> set_nodal_value(current_node, rad_system, r_distance_var, (*current_node -
> *first_node).size());
>
> const unsigned int dof_index =
> current_node->dof_number(rad_system.number(), r_distance_var, 0);
> std::cout<< dof_index <<"\t"<<(*rad_system.solution)(dof_index)<<"\n";
>
> Right after assigning some value to a certain dof_index, when I try
> outputting the value at the same dof index in the solution vector (in the
> 2nd and 3rd lines), this value turns out to be zero. But later when I use
> the write_equation_systems command to write out a solution value, the
> values that I had previously assigned are written out.
>
> Even after doing a system.solution->update, the solution vector seems to
> be comprised of only 0's.
>
> Why is this happening?
>
You have to call close() after you set values in a NumericVector.
David
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users