27 #include "MeanMidNodeMover.hpp"
28 #include "MsqError.hpp"
29 #include "MsqFreeVertexIndexIterator.hpp"
30 #include "TopologyInfo.hpp"
50 {
return "MeanMidNodeMover"; }
71 for (
size_t vtx = pd.num_vertices(); vtx < pd.num_nodes(); ++vtx)
74 size_t num_elems, *elem_list;
75 elem_list = pd.get_vertex_element_adjacencies( vtx, num_elems, err );
MSQ_ERRZERO(err);
78 size_t element_index = elem_list[0];
79 MsqMeshEntity& element = pd.element_by_index( element_index );
82 unsigned elem_vert_index;
83 size_t num_verts = element.node_count();
84 size_t* vert_list = element.get_vertex_index_array();
85 for (elem_vert_index = 0; elem_vert_index < num_verts; ++elem_vert_index)
86 if (vert_list[elem_vert_index] == vtx)
91 if (elem_vert_index == num_verts)
103 "Element type %d cannot have higher-order nodes.",
108 if (elem_vert_index < num_corners)
110 MSQ_SETERR(err)(
"Invalid mid-node flag for mesh (mixed connectivity?)",
116 unsigned side, dimension;
121 const unsigned* side_indices =
130 const msq_stdc::size_t* conn_array = element.get_vertex_index_array();
132 for (
unsigned i = 0;
i < side_size; ++
i)
133 pos += pd.vertex_by_index( conn_array[side_indices[
i]] );
137 pd.set_vertex_coordinates( pos, vtx, err );
MSQ_ERRZERO(err);
138 pd.snap_vertex_to_domain( vtx, err );
MSQ_ERRZERO(err);
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
virtual double loop_over_mesh(MeshSet &ms, MsqError &err)
This is the "run" function of PatchDataUser. It can do anything really.
virtual void set_patch_type(PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
Sets the Patch Type.
virtual void set_patch_type(PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
Sets the Patch Type.
virtual ~MeanMidNodeMover()
invalid function argument passed
NVec< 3, double > Vector3D
#define MSQ_CHKERR(err)
Mesquite's Error Checking macro.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
static unsigned corners(EntityTopology topo)
Get the number of defining vertices for a given element topology.
PatchData::PatchType get_patch_type()
Returns the Patch Type.
PatchType
Tells MeshSet how to retrieve the mesh entities that will be stored in PatchData. ...
static const unsigned * side_vertices(EntityTopology topo, unsigned side_dimension, unsigned side_number, unsigned &num_verts_out, MsqError &err)
Get corner indices of side.
PatchData * get_global_patch()
Returns the Global Patch.
object is in an invalid state
virtual PatchDataUser::AlgorithmType get_algorithm_type()
Return the algorithm type (to avoid RTTI use).
static void side_number(EntityTopology topo, unsigned connectivity_length, unsigned node_index, unsigned &side_dimension_out, unsigned &side_number_out, MsqError &err)
Return which side the specified mid-node lies on.
virtual msq_std::string get_name()
Returns the algorithm name.