On Fri, Oct 5, 2012 at 10:16 AM, Yusuke Sakamoto
<[email protected]> wrote:
> Hello fellow libMesh users,
>
> I am trying to parallelize my program, but encountered a problem.
> I want to assign nodal values by looping through nodes in each
> processor. The nodal values are stored in ExplicitSystem object.
>
> .....
>
> const int sys_num_ex = system_ex.number();
> const unsigned int v_var = system_ex.variable_number("v");
>
> // get the solution vectors
> AutoPtr< NumericVector< Number > > solution_ex = system_ex.solution;
>
> // iterate through nodes to set the nodal variables
> MeshBase::const_node_iterator node_it = mesh.local_nodes_begin();
> const MeshBase::const_node_iterator node_end = mesh.local_nodes_end();
> for (; node_it != node_end; ++node_it){
> const Node* node = *node_it;
>
> // calculate v for each node
> .....
> .....
> const int v_dof = node->dof_number(sys_num_ex, v_var, 0);
You have to check whether this dof_number is owned by the current
processor before you attempt to set it:
if ((v_dof >= solution_ex->first_local_index()) &&
(v_dof < solution_ex->last_local_index()))
> (solution_ex.get())->close();
> (solution_ex.get())->set(v_dof, v);
> (solution_ex.get())->close();
This extra .get() function call is unnecessary, you should just be
able to do solution_ex->close()/set().
--
John
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users