Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeanMidNodeMover Class Reference

Class to adjust positions of higher-order nodes. More...

#include <MeanMidNodeMover.hpp>

Inheritance diagram for MeanMidNodeMover:
Collaboration diagram for MeanMidNodeMover:

Public Member Functions

 MeanMidNodeMover ()
 
virtual ~MeanMidNodeMover ()
 
virtual void set_patch_type (PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
 Sets the Patch Type. More...
 
virtual double loop_over_mesh (MeshSet &ms, MsqError &err)
 This is the "run" function of PatchDataUser. It can do anything really. More...
 
virtual msq_std::string get_name ()
 Returns the algorithm name. More...
 
virtual
PatchDataUser::AlgorithmType 
get_algorithm_type ()
 Return the algorithm type (to avoid RTTI use). More...
 
 MeanMidNodeMover ()
 
virtual ~MeanMidNodeMover ()
 
virtual void set_patch_type (PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
 Sets the Patch Type. More...
 
virtual double loop_over_mesh (MeshSet &ms, MsqError &err)
 This is the "run" function of PatchDataUser. It can do anything really. More...
 
virtual msq_std::string get_name ()
 Returns the algorithm name. More...
 
virtual
PatchDataUser::AlgorithmType 
get_algorithm_type ()
 Return the algorithm type (to avoid RTTI use). More...
 
- Public Member Functions inherited from PatchDataUser
virtual ~PatchDataUser ()
 
PatchData::PatchType get_patch_type ()
 Returns the Patch Type. More...
 
int get_nb_layers (MsqError &err)
 Returns number of layers (if relevant for partition algorythm). More...
 
void add_culling_method (enum PatchData::culling_method cm)
 Sets on the culling method passed as argument. More...
 
void no_culling_method ()
 Sets off all culling methods. More...
 
void remove_culling_method (enum PatchData::culling_method cm)
 Sets off the culling method passed as argument. More...
 
long unsigned int get_culling_method_bits ()
 Returns the bitset containing culling methods flags. More...
 
void set_all_parameters (PatchDataParameters &params)
 
PatchDataParametersget_all_parameters ()
 Returns the PatchDataParameters object. More...
 
void set_global_patch (PatchData *pd, MsqError &err)
 Sets the Global Patch, so that it can be use by contiguoug PatchDataUser. More...
 
PatchDataget_global_patch ()
 Returns the Global Patch. More...
 
void no_global_patch ()
 Sets the Global Patch pointer to NULL. More...
 
virtual ~PatchDataUser ()
 
PatchData::PatchType get_patch_type ()
 Returns the Patch Type. More...
 
int get_nb_layers (MsqError &err)
 Returns number of layers (if relevant for partition algorythm). More...
 
void add_culling_method (enum PatchData::culling_method cm)
 Sets on the culling method passed as argument. More...
 
void no_culling_method ()
 Sets off all culling methods. More...
 
void remove_culling_method (enum PatchData::culling_method cm)
 Sets off the culling method passed as argument. More...
 
long unsigned int get_culling_method_bits ()
 Returns the bitset containing culling methods flags. More...
 
void set_all_parameters (PatchDataParameters &params)
 
PatchDataParametersget_all_parameters ()
 Returns the PatchDataParameters object. More...
 
void set_global_patch (PatchData *pd, MsqError &err)
 Sets the Global Patch, so that it can be use by contiguoug PatchDataUser. More...
 
PatchDataget_global_patch ()
 Returns the Global Patch. More...
 
void no_global_patch ()
 Sets the Global Patch pointer to NULL. More...
 

Additional Inherited Members

- Public Types inherited from PatchDataUser
enum  AlgorithmType {
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR,
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR
}
 
enum  AlgorithmType {
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR,
  QUALITY_IMPROVER, QUALITY_ASSESSOR, MESH_TRANSFORM, TARGET_CALCULATOR
}
 
- Protected Member Functions inherited from PatchDataUser
 PatchDataUser ()
 
 PatchDataUser ()
 

Detailed Description

Class to adjust positions of higher-order nodes.

Move all higher-order nodes to average position of adjacent nodes.

Definition at line 44 of file includeLinks/MeanMidNodeMover.hpp.

Constructor & Destructor Documentation

Definition at line 34 of file QualityImprover/VertexMover/MeanMidNodeMover.cpp.

References PatchData::GLOBAL_PATCH, MSQ_CHKERR, and PatchDataUser::set_patch_type().

35 {
36  MsqError err;
38  MSQ_CHKERR(err);
39 }
virtual void set_patch_type(PatchData::PatchType patch_type, MsqError &err, int param1=0, int param2=0)
Sets the Patch Type.
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.

Here is the call graph for this function:

~MeanMidNodeMover ( )
virtual

Definition at line 41 of file QualityImprover/VertexMover/MeanMidNodeMover.cpp.

41 {}
virtual ~MeanMidNodeMover ( )
virtual

Member Function Documentation

PatchDataUser::AlgorithmType get_algorithm_type ( )
virtual

Return the algorithm type (to avoid RTTI use).

Implements PatchDataUser.

Definition at line 52 of file QualityImprover/VertexMover/MeanMidNodeMover.cpp.

References PatchDataUser::QUALITY_IMPROVER.

virtual PatchDataUser::AlgorithmType get_algorithm_type ( )
virtual

Return the algorithm type (to avoid RTTI use).

Implements PatchDataUser.

msq_std::string get_name ( )
virtual

Returns the algorithm name.

Implements PatchDataUser.

Definition at line 49 of file QualityImprover/VertexMover/MeanMidNodeMover.cpp.

50 { return "MeanMidNodeMover"; }
virtual msq_std::string get_name ( )
virtual

Returns the algorithm name.

Implements PatchDataUser.

double loop_over_mesh ( MeshSet ms,
MsqError err 
)
virtual

This is the "run" function of PatchDataUser. It can do anything really.

Implements PatchDataUser.

Definition at line 56 of file QualityImprover/VertexMover/MeanMidNodeMover.cpp.

References TopologyInfo::corners(), PatchData::element_by_index(), MsqMeshEntity::get_element_type(), PatchDataUser::get_global_patch(), PatchDataUser::get_patch_type(), PatchData::get_vertex_element_adjacencies(), MsqMeshEntity::get_vertex_index_array(), PatchData::GLOBAL_PATCH, i, MsqError::INTERNAL_ERROR, MsqError::INVALID_MESH, MsqError::INVALID_STATE, MSQ_ERRZERO, MSQ_SETERR, MsqMeshEntity::node_count(), PatchData::num_nodes(), PatchData::num_vertices(), PatchData::set_vertex_coordinates(), TopologyInfo::side_number(), TopologyInfo::side_vertices(), PatchData::snap_vertex_to_domain(), PatchData::update_mesh(), and PatchData::vertex_by_index().

57 {
60  return 0;
61  }
62 
63  if (!get_global_patch()) {
64  MSQ_SETERR(err)("No global patch", MsqError::INVALID_STATE);
65  return 0;
66  }
67 
68  PatchData& pd = *get_global_patch();
69 
70  // For each higher-order node in the patch
71  for (size_t vtx = pd.num_vertices(); vtx < pd.num_nodes(); ++vtx)
72  {
73  // Get an adjacent element
74  size_t num_elems, *elem_list;
75  elem_list = pd.get_vertex_element_adjacencies( vtx, num_elems, err ); MSQ_ERRZERO(err);
76  if (num_elems < 1) // Mid-node without adjacent elements????
77  continue;
78  size_t element_index = elem_list[0];
79  MsqMeshEntity& element = pd.element_by_index( element_index );
80 
81  // Find position of current vertex in element connectivity list
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)
87  break;
88 
89  // Sanity checks
90  // Mesh is corrupt if vertex not in connectivity list
91  if (elem_vert_index == num_verts)
92  {
93  MSQ_SETERR(err)("Inconsistent connectivity/adjacency data.", MsqError::INVALID_MESH );
94  return 0;
95  }
96  // Must be appropriate element type (e.g. can't have higher-order
97  // nodes on a polygon)
98  EntityTopology topo = element.get_element_type();
99  unsigned num_corners = TopologyInfo::corners( topo );
100  if (!num_corners)
101  {
103  "Element type %d cannot have higher-order nodes.",
104  (int)topo );
105  return 0;
106  }
107  // The current vertex must be one of the higher-order nodes of the element
108  if (elem_vert_index < num_corners)
109  {
110  MSQ_SETERR(err)( "Invalid mid-node flag for mesh (mixed connectivity?)",
112  return 9;
113  }
114 
115  // Get the element "side" that the node is a mid-node of.
116  unsigned side, dimension;
117  TopologyInfo::side_number( topo, element.node_count(), elem_vert_index,
118  side, dimension, err ); MSQ_ERRZERO(err);
119  // Get the indices of the vertices defining the "side"
120  unsigned side_size;
121  const unsigned* side_indices =
122  TopologyInfo::side_vertices( topo, side, dimension, side_size, err ); MSQ_ERRZERO(err);
123  if (!side_size)
124  {
126  return 0;
127  }
128 
129  // Calculate average position of side vertices
130  const msq_stdc::size_t* conn_array = element.get_vertex_index_array();
131  Vector3D pos(0,0,0);
132  for (unsigned i = 0; i < side_size; ++i)
133  pos += pd.vertex_by_index( conn_array[side_indices[i]] );
134  pos /= side_size;
135 
136  // Set new vertex position
137  pd.set_vertex_coordinates( pos, vtx, err ); MSQ_ERRZERO(err);
138  pd.snap_vertex_to_domain( vtx, err ); MSQ_ERRZERO(err);
139  }
140 
141  pd.update_mesh(err); MSQ_ERRZERO(err);
142 
143  return 0;
144 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
EntityTopology
Definition: Mesquite.hpp:92
NVec< 3, double > Vector3D
#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.
blockLoc i
Definition: read.cpp:79
PatchData::PatchType get_patch_type()
Returns the Patch Type.
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
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.

Here is the call graph for this function:

virtual double loop_over_mesh ( MeshSet ms,
MsqError err 
)
virtual

This is the "run" function of PatchDataUser. It can do anything really.

Implements PatchDataUser.

void set_patch_type ( PatchData::PatchType  patch_type,
MsqError err,
int  param1 = 0,
int  param2 = 0 
)
virtual

Sets the Patch Type.

Reimplemented from PatchDataUser.

Definition at line 43 of file QualityImprover/VertexMover/MeanMidNodeMover.cpp.

References MsqError::INVALID_ARG, and MSQ_SETERR.

44 {
45  MSQ_SETERR(err)("Patch type cannot be changed for MeanMidNodeMover.",MsqError::INVALID_ARG);
46  return;
47 }
invalid function argument passed
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
virtual void set_patch_type ( PatchData::PatchType  patch_type,
MsqError err,
int  param1 = 0,
int  param2 = 0 
)
virtual

Sets the Patch Type.

Reimplemented from PatchDataUser.


The documentation for this class was generated from the following files: