From: John P. <pet...@cf...> - 2008-01-29 22:15:29
|
Hi, You are looking for Point::operator(int i) which returns the i=0,1, or 2-component of the 3-vector 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 dof-number. > > 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 > co-ordinates. 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/ > _______________________________________________ > Libmesh-users mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libmesh-users |