From: Vijay M <vijay.m@gm...>  20080129 21:45:28

Hi, I've got a question that is along the same lines of Parallel mesh question asked few days back. So Roy, this question might be for you. I was initially trying to use the PETSc function "VecGetOwnershipRange" to find the local nodes and loop over them to set it but then find out after few hours of debugging that the partitioner not necessarily assigns the dofs continuously and hence I was setting wrong values based on dofnumber. Now, I am trying to initialize my solution (xsoln) by setting only the local node values to an exact solution by looping over the current local nodes. But for this, I then need the node's x, y, z coordinates. The class document says that _coords is a protected member and hence I'm not sure how to get this. Here's a sample code on what I'm trying to do. Real value = 0.0 ; const MeshBase& mesh = equation_system.get_mesh(); 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* mynode = *node_it; // Get current degree of freedom number const unsigned int dofnum = mynode>dof_number(0,0,0); // Does a method like the following exist in the class library ? // mynode.get_coords(x, y, z) ; // Find the exact solution value = ExactSolution(dim, x, y, z, time) ; // Update the solution xsoln.set(dofnum,value); } Any help would be appreciated. Thanks ! Vijay 
From: John Peterson <peterson@cf...>  20080129 22:15:29

Hi, You are looking for Point::operator(int i) which returns the i=0,1, or 2component of the 3vector which represents the point. J Vijay M writes: > Hi, > > I've got a question that is along the same lines of Parallel mesh > question asked few days back. So Roy, this question might be for you. > > I was initially trying to use the PETSc function > "VecGetOwnershipRange" to find the local nodes and loop over them to > set it but then find out after few hours of debugging that the > partitioner not necessarily assigns the dofs continuously and hence I > was setting wrong values based on dofnumber. > > Now, I am trying to initialize my solution (xsoln) by setting only the > local node values to an exact solution by looping over the current > local nodes. But for this, I then need the node's x, y, z > coordinates. The class document says that _coords is a protected > member and hence I'm not sure how to get this. Here's a sample code on > what I'm trying to do. > > > Real value = 0.0 ; > > const MeshBase& mesh = equation_system.get_mesh(); > > 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* mynode = *node_it; > > // Get current degree of freedom number > const unsigned int dofnum = mynode>dof_number(0,0,0); > > // Does a method like the following exist in the class library ? > // mynode.get_coords(x, y, z) ; > > // Find the exact solution > value = ExactSolution(dim, x, y, z, time) ; > > // Update the solution > xsoln.set(dofnum,value); > > } > > Any help would be appreciated. Thanks ! > > Vijay > >  > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Derek Gaston <friedmud@gm...>  20080129 22:44:36

Vijay... a Node _IS_ a Point (in the polymorphic sense) in libMesh... meaning that you can just do: x = somenode(0); y = somenode(1); z = somenode(2); Derek On Jan 29, 2008 2:45 PM, Vijay M <vijay.m@...> wrote: > Hi, > > I've got a question that is along the same lines of Parallel mesh > question asked few days back. So Roy, this question might be for you. > > I was initially trying to use the PETSc function > "VecGetOwnershipRange" to find the local nodes and loop over them to > set it but then find out after few hours of debugging that the > partitioner not necessarily assigns the dofs continuously and hence I > was setting wrong values based on dofnumber. > > Now, I am trying to initialize my solution (xsoln) by setting only the > local node values to an exact solution by looping over the current > local nodes. But for this, I then need the node's x, y, z > coordinates. The class document says that _coords is a protected > member and hence I'm not sure how to get this. Here's a sample code on > what I'm trying to do. > > > Real value = 0.0 ; > > const MeshBase& mesh = equation_system.get_mesh(); > > 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* mynode = *node_it; > > // Get current degree of freedom number > const unsigned int dofnum = mynode>dof_number(0,0,0); > > // Does a method like the following exist in the class library ? > // mynode.get_coords(x, y, z) ; > > // Find the exact solution > value = ExactSolution(dim, x, y, z, time) ; > > // Update the solution > xsoln.set(dofnum,value); > > } > > Any help would be appreciated. Thanks ! > > Vijay > >  > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 