This came up the other day as well. A Node is a DofObject, so you can
call node->n_comp(sys_num, var_num) to see how many components are
associated with the node. So you just need to make sure that
node->n_comp(sys_num, var_num) > 0 before you try to call node->dof_number.
David
On 02/18/2013 11:16 PM, Jens Lohne Eftang wrote:
> I'm looping over nodes in a mesh. My mesh has HEX20 elements to
> accommodate 2nd-order approximation, but currently my approximation is
> 1st order. What's the proper way to loop over the nodes in the mesh (to
> get the dof indices) in this case?
>
> Currently I'm doing
>
> for( MeshBase::node_iterator node_it = get_mesh().nodes_begin(); node_it
> != node_end; node_it++)
> {
> Node* node = *node_it;
>
> int index = node->dof_number(0, d, 0);
>
> if (index > 0)
> do_something_with_index(index);
> }
>
> and this works fine. However if I run in devel or debug mode the line
> node->dof_number(0,d,0) triggers an assert:
>
> Assertion `comp < this->n_comp(s,var)' failed.
> comp = 0
> this->n_comp(s,var) = 0
> Stack frames: 5
> ...
> [0]
> /home/eftang/dev_software/libmesh_install/include/libmesh/dof_object.h,
> line 715, compiled Feb 18 2013 at 23:14:44
>
> So is there another way to check whether the node actually corresponds
> to a dof index than to request the dof_number ?
>
>
>
> Best,
> Jens
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Libmesh-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libmesh-users
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users