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

#include <PatchData.hpp>

Collaboration diagram for PatchData:

Public Types

enum  ComputedInfo {
  MIN_UNSIGNED_AREA = 0, MAX_UNSIGNED_AREA, MIN_EDGE_LENGTH, MAX_EDGE_LENGTH,
  MINMAX_SIGNED_DET2D, MINMAX_SIGNED_DET3D, AVERAGE_DET3D, MAX_COMPUTED_INFO_ENUM,
  MIN_UNSIGNED_AREA = 0, MAX_UNSIGNED_AREA, MIN_EDGE_LENGTH, MAX_EDGE_LENGTH,
  MINMAX_SIGNED_DET2D, MINMAX_SIGNED_DET3D, AVERAGE_DET3D, MAX_COMPUTED_INFO_ENUM
}
 
enum  PatchType {
  UNDEFINED_PATCH_TYPE, VERTICES_ON_VERTEX_PATCH, ELEMENTS_ON_VERTEX_PATCH, GLOBAL_PATCH,
  UNDEFINED_PATCH_TYPE, VERTICES_ON_VERTEX_PATCH, ELEMENTS_ON_VERTEX_PATCH, GLOBAL_PATCH
}
 Tells MeshSet how to retrieve the mesh entities that will be stored in PatchData. More...
 
enum  culling_method {
  NO_BOUNDARY_VTX = 1<<0, NO_INTERIOR_VTX = 1<<1, CULL_METHOD_3 = 1<<2, CULL_METHOD_4 = 1<<3,
  NO_BOUNDARY_VTX = 1<<0, NO_INTERIOR_VTX = 1<<1, CULL_METHOD_3 = 1<<2, CULL_METHOD_4 = 1<<3
}
 
enum  ComputedInfo {
  MIN_UNSIGNED_AREA = 0, MAX_UNSIGNED_AREA, MIN_EDGE_LENGTH, MAX_EDGE_LENGTH,
  MINMAX_SIGNED_DET2D, MINMAX_SIGNED_DET3D, AVERAGE_DET3D, MAX_COMPUTED_INFO_ENUM,
  MIN_UNSIGNED_AREA = 0, MAX_UNSIGNED_AREA, MIN_EDGE_LENGTH, MAX_EDGE_LENGTH,
  MINMAX_SIGNED_DET2D, MINMAX_SIGNED_DET3D, AVERAGE_DET3D, MAX_COMPUTED_INFO_ENUM
}
 
enum  PatchType {
  UNDEFINED_PATCH_TYPE, VERTICES_ON_VERTEX_PATCH, ELEMENTS_ON_VERTEX_PATCH, GLOBAL_PATCH,
  UNDEFINED_PATCH_TYPE, VERTICES_ON_VERTEX_PATCH, ELEMENTS_ON_VERTEX_PATCH, GLOBAL_PATCH
}
 Tells MeshSet how to retrieve the mesh entities that will be stored in PatchData. More...
 
enum  culling_method {
  NO_BOUNDARY_VTX = 1<<0, NO_INTERIOR_VTX = 1<<1, CULL_METHOD_3 = 1<<2, CULL_METHOD_4 = 1<<3,
  NO_BOUNDARY_VTX = 1<<0, NO_INTERIOR_VTX = 1<<1, CULL_METHOD_3 = 1<<2, CULL_METHOD_4 = 1<<3
}
 

Public Member Functions

 PatchData ()
 
 ~PatchData ()
 
void clear_computed_info ()
 This function clears the patch information such as maximum volume, etc ... More...
 
bool have_computed_info (ComputedInfo info) const
 
void get_minmax_element_unsigned_area (double &min, double &max, MsqError &err)
 Returns the maximum volume or area out of all the elements in the patch This information is stored in the patch and should not decrease performance when used properly. More...
 
double get_barrier_delta (MsqError &err)
 Returns delta based on the minimum and maximum corner determinant over all elements in the patch This information is stored in the patch and should not decrease performance when used properly. More...
 
double get_average_Lambda_3d (MsqError &err)
 Returns average corner determinant over all corners in the patch This information is stored in the patch and should not decrease performance when used properly. More...
 
void clear ()
 Removes data. More...
 
void reorder ()
 Reorders the mesh data. More...
 
void allocate_storage (size_t vertex_count, size_t element_count, size_t vertex_use_count, MsqError &err)
 Used by test code when creating a PatchData directly. More...
 
void initialize_data (size_t *elem_offset_array, MsqError &err)
 Call after filling vertex handle and connectivity arrays to finish initializing the PatchData. More...
 
size_t num_vertices () const
 number of vertices in the patch. More...
 
size_t num_elements () const
 number of elements in the Patch. More...
 
size_t num_corners ()
 number of elements corners in the Patch. More...
 
size_t num_nodes () const
 Get number of nodes (vertex + higher-order nodes) More...
 
int num_free_vertices (MsqError &err) const
 Returns the number of elements in the current patch who are free to move. More...
 
unsigned num_free_nodes (MsqError &err) const
 
const MsqVertexget_vertex_array (MsqError &err) const
 Returns a pointer to the start of the vertex array. More...
 
MsqVertexget_vertex_array (MsqError &err)
 
const MsqMeshEntityget_element_array (MsqError &err) const
 Returns a pointer to the start of the element array. More...
 
MsqMeshEntityget_element_array (MsqError &err)
 
size_t * get_connectivity_array ()
 
const Mesh::ElementHandleget_element_handles_array () const
 
MsqVertexvertex_by_index (size_t index)
 Returns the start of the vertex->element array. More...
 
MsqMeshEntityelement_by_index (size_t index)
 
size_t get_vertex_index (MsqVertex *vertex)
 
size_t get_element_index (MsqMeshEntity *element)
 
void get_element_vertex_coordinates (size_t elem_index, msq_std::vector< Vector3D > &coords, MsqError &err)
 Get the coordinates of vertices attached to the specified element. More...
 
void get_element_vertex_indices (size_t elem_index, msq_std::vector< size_t > &vertex_indices, MsqError &err)
 
void get_vertex_element_indices (size_t vertex_index, msq_std::vector< size_t > &elem_indices, MsqError &err)
 
size_t * get_vertex_element_adjacencies (size_t vertex_index, size_t &array_len_out, MsqError &err)
 
void get_adjacent_vertex_indices (size_t vertex_index, msq_std::vector< size_t > &vert_indices, MsqError &err)
 
void get_adjacent_entities_via_n_dim (int n, size_t ent_ind, msq_std::vector< size_t > &adj_ents, MsqError &err)
 Get the indices of entities attached to entity (given by ent_ind). adj_ents is filled with the indices into the entity array of elements adjacent to the given element via an n-dimensional entity. More...
 
void generate_vertex_to_element_data ()
 
void set_vertex_coordinates (const Vector3D &coords, size_t index, MsqError &err)
 set the coordinates of a vertex in the raw array More...
 
void snap_vertex_to_domain (size_t vertex_index, MsqError &err)
 Adjust the position of the specified vertex so that it lies on its constraining domain. More...
 
bool domain_set ()
 
void get_domain_normal_at_vertex (size_t vertex_index, bool normalize, Vector3D &surf_norm, MsqError &err)
 
void get_domain_normal_at_element (size_t elem_index, Vector3D &surf_norm, MsqError &err) const
 
void get_domain_normals_at_corners (size_t element_index, Vector3D normals_out[], MsqError &err)
 Get surface normal at a point where the surface is the domain of an element and the point is the location of one of the element corners. More...
 
void get_domain_normal_at_element (MsqMeshEntity *elem_ptr, Vector3D &surf_norm, MsqError &err) const
 Alternative signature. Same functionality. More...
 
void move_free_vertices_constrained (Vector3D dk[], size_t nb_vtx, double step_size, MsqError &err)
 Moves free vertices and then snaps the free vertices to the domain. More...
 
void set_free_vertices_constrained (PatchDataVerticesMemento *memento, Vector3D dk[], size_t nb_vtx, double step_size, MsqError &err)
 
double get_max_vertex_movement_squared (PatchDataVerticesMemento *memento, MsqError &err)
 Calculates the distance each vertex has moved from its original position as defined by the PatchDataVerticesMememnto. More...
 
void update_mesh (MsqError &err)
 Updates the underlying mesh (the Mesquite::Mesh implementation) with new node coordinates and flag values. More...
 
void set_all_vertices_soft_free (MsqError &err)
 Remove the soft_fixed flag from all vertices in the patch. More...
 
void set_all_vertices_soft_fixed (MsqError &err)
 Add a soft_fixed flag to all vertices in the patch. More...
 
void set_free_vertices_soft_fixed (MsqError &err)
 Add a soft_fixed flag to all free vertices in the patch. More...
 
void get_subpatch (size_t center_vertex_index, PatchData &pd_to_fill, MsqError &err)
 Fills a PatchData with the elements attached to a center vertex. More...
 
PatchDataVerticesMementocreate_vertices_memento (MsqError &err, bool include_higher_order=false)
 Creates a memento that holds the current state of the PatchData coordinates. More...
 
void recreate_vertices_memento (PatchDataVerticesMemento *memento, MsqError &err, bool include_higher_order=false)
 reinstantiates a memento to holds the current state of the PatchData coordinates. More...
 
void set_to_vertices_memento (PatchDataVerticesMemento *memento, MsqError &err)
 Restore the PatchData coordinates to the state contained in the memento. More...
 
PatchType type () const
 
void set_mesh_set (MeshSet *ms)
 Sets the originating meshSet. More...
 
MeshSetget_mesh_set ()
 Returns the originating meshSet. More...
 
void clear_tag_data ()
 
 PatchData ()
 
 ~PatchData ()
 
void clear_computed_info ()
 This function clears the patch information such as maximum volume, etc ... More...
 
bool have_computed_info (ComputedInfo info) const
 
void get_minmax_element_unsigned_area (double &min, double &max, MsqError &err)
 Returns the maximum volume or area out of all the elements in the patch This information is stored in the patch and should not decrease performance when used properly. More...
 
double get_barrier_delta (MsqError &err)
 Returns delta based on the minimum and maximum corner determinant over all elements in the patch This information is stored in the patch and should not decrease performance when used properly. More...
 
double get_average_Lambda_3d (MsqError &err)
 Returns average corner determinant over all corners in the patch This information is stored in the patch and should not decrease performance when used properly. More...
 
void clear ()
 Removes data. More...
 
void reorder ()
 Reorders the mesh data. More...
 
void allocate_storage (size_t vertex_count, size_t element_count, size_t vertex_use_count, MsqError &err)
 Used by test code when creating a PatchData directly. More...
 
void initialize_data (size_t *elem_offset_array, MsqError &err)
 Call after filling vertex handle and connectivity arrays to finish initializing the PatchData. More...
 
size_t num_vertices () const
 number of vertices in the patch. More...
 
size_t num_elements () const
 number of elements in the Patch. More...
 
size_t num_corners ()
 number of elements corners in the Patch. More...
 
size_t num_nodes () const
 Get number of nodes (vertex + higher-order nodes) More...
 
int num_free_vertices (MsqError &err) const
 Returns the number of elements in the current patch who are free to move. More...
 
unsigned num_free_nodes (MsqError &err) const
 
const MsqVertexget_vertex_array (MsqError &err) const
 Returns a pointer to the start of the vertex array. More...
 
MsqVertexget_vertex_array (MsqError &err)
 
const MsqMeshEntityget_element_array (MsqError &err) const
 Returns a pointer to the start of the element array. More...
 
MsqMeshEntityget_element_array (MsqError &err)
 
size_t * get_connectivity_array ()
 
const Mesh::ElementHandleget_element_handles_array () const
 
MsqVertexvertex_by_index (size_t index)
 Returns the start of the vertex->element array. More...
 
MsqMeshEntityelement_by_index (size_t index)
 
size_t get_vertex_index (MsqVertex *vertex)
 
size_t get_element_index (MsqMeshEntity *element)
 
void get_element_vertex_coordinates (size_t elem_index, msq_std::vector< Vector3D > &coords, MsqError &err)
 Get the coordinates of vertices attached to the specified element. More...
 
void get_element_vertex_indices (size_t elem_index, msq_std::vector< size_t > &vertex_indices, MsqError &err)
 
void get_vertex_element_indices (size_t vertex_index, msq_std::vector< size_t > &elem_indices, MsqError &err)
 
size_t * get_vertex_element_adjacencies (size_t vertex_index, size_t &array_len_out, MsqError &err)
 
void get_adjacent_vertex_indices (size_t vertex_index, msq_std::vector< size_t > &vert_indices, MsqError &err)
 
void get_adjacent_entities_via_n_dim (int n, size_t ent_ind, msq_std::vector< size_t > &adj_ents, MsqError &err)
 Get the indices of entities attached to entity (given by ent_ind). adj_ents is filled with the indices into the entity array of elements adjacent to the given element via an n-dimensional entity. More...
 
void generate_vertex_to_element_data ()
 
void set_vertex_coordinates (const Vector3D &coords, size_t index, MsqError &err)
 
void snap_vertex_to_domain (size_t vertex_index, MsqError &err)
 
bool domain_set ()
 
void get_domain_normal_at_vertex (size_t vertex_index, bool normalize, Vector3D &surf_norm, MsqError &err)
 
void get_domain_normal_at_element (size_t elem_index, Vector3D &surf_norm, MsqError &err) const
 
void get_domain_normals_at_corners (size_t element_index, Vector3D normals_out[], MsqError &err)
 Get surface normal at a point where the surface is the domain of an element and the point is the location of one of the element corners. More...
 
void get_domain_normal_at_element (MsqMeshEntity *elem_ptr, Vector3D &surf_norm, MsqError &err) const
 Alternative signature. Same functionality. More...
 
void move_free_vertices_constrained (Vector3D dk[], size_t nb_vtx, double step_size, MsqError &err)
 Moves free vertices and then snaps the free vertices to the domain. More...
 
void set_free_vertices_constrained (PatchDataVerticesMemento *memento, Vector3D dk[], size_t nb_vtx, double step_size, MsqError &err)
 
double get_max_vertex_movement_squared (PatchDataVerticesMemento *memento, MsqError &err)
 Calculates the distance each vertex has moved from its original position as defined by the PatchDataVerticesMememnto. More...
 
void update_mesh (MsqError &err)
 Updates the underlying mesh (the Mesquite::Mesh implementation) with new node coordinates and flag values. More...
 
void set_all_vertices_soft_free (MsqError &err)
 Remove the soft_fixed flag from all vertices in the patch. More...
 
void set_all_vertices_soft_fixed (MsqError &err)
 Add a soft_fixed flag to all vertices in the patch. More...
 
void set_free_vertices_soft_fixed (MsqError &err)
 Add a soft_fixed flag to all free vertices in the patch. More...
 
void get_subpatch (size_t center_vertex_index, PatchData &pd_to_fill, MsqError &err)
 Fills a PatchData with the elements attached to a center vertex. More...
 
PatchDataVerticesMementocreate_vertices_memento (MsqError &err, bool include_higher_order=false)
 Creates a memento that holds the current state of the PatchData coordinates. More...
 
void recreate_vertices_memento (PatchDataVerticesMemento *memento, MsqError &err, bool include_higher_order=false)
 reinstantiates a memento to holds the current state of the PatchData coordinates. More...
 
void set_to_vertices_memento (PatchDataVerticesMemento *memento, MsqError &err)
 Restore the PatchData coordinates to the state contained in the memento. More...
 
PatchType type () const
 
void set_mesh_set (MeshSet *ms)
 Sets the originating meshSet. More...
 
MeshSetget_mesh_set ()
 Returns the originating meshSet. More...
 
void clear_tag_data ()
 

Public Attributes

CornerTag< TargetMatrixtargetMatrices
 Target matrix data. More...
 

Private Member Functions

 PatchData (const PatchData &pd)
 Doesn't allow PatchData to be copied implicitly. More...
 
PatchDataoperator= (const PatchData &pd)
 Doesn't allow a PatchData object to be assigned to another. More...
 
void note_have_info (ComputedInfo info)
 
void update_cached_normals (MsqError &)
 
 PatchData (const PatchData &pd)
 Doesn't allow PatchData to be copied implicitly. More...
 
PatchDataoperator= (const PatchData &pd)
 Doesn't allow a PatchData object to be assigned to another. More...
 
void note_have_info (ComputedInfo info)
 
void update_cached_normals (MsqError &)
 

Private Attributes

MeshSetmeshSet
 
bool domainSet
 
DomainHint domainHint
 
PatchType mType
 
PatchDataMem< MsqVertexvertexArray
 
PatchDataMem< Mesh::VertexHandlevertexHandlesArray
 
PatchDataMem< MsqMeshEntityelementArray
 
PatchDataMem< Mesh::ElementHandleelementHandlesArray
 
PatchDataMem< size_t > elemConnectivityArray
 
PatchDataMem< size_t > vertAdjacencyArray
 
PatchDataMem< size_t > vertAdjacencyOffsets
 
PatchDataMem< Vector3DvertexNormals
 
size_t numCornerVertices
 
double computedInfos [MAX_COMPUTED_INFO_ENUM]
 
unsigned haveComputedInfos
 

Friends

class MeshSet
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &, const PatchData &)
 Display the coordinates and connectivity information. More...
 
msq_stdio::ostream & operator<< (msq_stdio::ostream &, const PatchData &)
 Display the coordinates and connectivity information. More...
 

Detailed Description

Contains all the mesh information necessary for one iteration of the optimization algorithms over a local mesh patch.

Definition at line 87 of file includeLinks/PatchData.hpp.

Member Enumeration Documentation

Enumerator
MIN_UNSIGNED_AREA 

minimum volume or area out of all elements in the patch

MAX_UNSIGNED_AREA 

maximum volume or area out of all elements in the patch

MIN_EDGE_LENGTH 

minimum edge length in the patch

MAX_EDGE_LENGTH 

maximum edge length in the patch

MINMAX_SIGNED_DET2D 

minimum and maximum corner area out of all elements in the patch

MINMAX_SIGNED_DET3D 

minimum and maximum corner volume out of all elements in the patch

AVERAGE_DET3D 

average corner determinant out of all elements in the patch

MAX_COMPUTED_INFO_ENUM 
MIN_UNSIGNED_AREA 

minimum volume or area out of all elements in the patch

MAX_UNSIGNED_AREA 

maximum volume or area out of all elements in the patch

MIN_EDGE_LENGTH 

minimum edge length in the patch

MAX_EDGE_LENGTH 

maximum edge length in the patch

MINMAX_SIGNED_DET2D 

minimum and maximum corner area out of all elements in the patch

MINMAX_SIGNED_DET3D 

minimum and maximum corner volume out of all elements in the patch

AVERAGE_DET3D 

average corner determinant out of all elements in the patch

MAX_COMPUTED_INFO_ENUM 

Definition at line 104 of file includeLinks/PatchData.hpp.

104  {
105  MIN_UNSIGNED_AREA = 0,
111  AVERAGE_DET3D,
113  };
average corner determinant out of all elements in the patch
minimum and maximum corner area out of all elements in the patch
maximum edge length in the patch
minimum and maximum corner volume out of all elements in the patch
minimum volume or area out of all elements in the patch
maximum volume or area out of all elements in the patch
minimum edge length in the patch
Enumerator
MIN_UNSIGNED_AREA 

minimum volume or area out of all elements in the patch

MAX_UNSIGNED_AREA 

maximum volume or area out of all elements in the patch

MIN_EDGE_LENGTH 

minimum edge length in the patch

MAX_EDGE_LENGTH 

maximum edge length in the patch

MINMAX_SIGNED_DET2D 

minimum and maximum corner area out of all elements in the patch

MINMAX_SIGNED_DET3D 

minimum and maximum corner volume out of all elements in the patch

AVERAGE_DET3D 

average corner determinant out of all elements in the patch

MAX_COMPUTED_INFO_ENUM 
MIN_UNSIGNED_AREA 

minimum volume or area out of all elements in the patch

MAX_UNSIGNED_AREA 

maximum volume or area out of all elements in the patch

MIN_EDGE_LENGTH 

minimum edge length in the patch

MAX_EDGE_LENGTH 

maximum edge length in the patch

MINMAX_SIGNED_DET2D 

minimum and maximum corner area out of all elements in the patch

MINMAX_SIGNED_DET3D 

minimum and maximum corner volume out of all elements in the patch

AVERAGE_DET3D 

average corner determinant out of all elements in the patch

MAX_COMPUTED_INFO_ENUM 

Definition at line 104 of file src/Mesh/PatchData.hpp.

104  {
105  MIN_UNSIGNED_AREA = 0,
111  AVERAGE_DET3D,
113  };
average corner determinant out of all elements in the patch
minimum and maximum corner area out of all elements in the patch
maximum edge length in the patch
minimum and maximum corner volume out of all elements in the patch
minimum volume or area out of all elements in the patch
maximum volume or area out of all elements in the patch
minimum edge length in the patch
Enumerator
NO_BOUNDARY_VTX 

removes vertices on the boundary. (i.e. with a TSTT tag "boundary").

NO_INTERIOR_VTX 

removes vertices that are not on the boundary

CULL_METHOD_3 

no other culling method yet.

CULL_METHOD_4 
NO_BOUNDARY_VTX 

removes vertices on the boundary. (i.e. with a TSTT tag "boundary").

NO_INTERIOR_VTX 

removes vertices that are not on the boundary

CULL_METHOD_3 

no other culling method yet.

CULL_METHOD_4 

Definition at line 407 of file src/Mesh/PatchData.hpp.

Those are the culling method available to the users. Developpers: The values used in that enum are used by a bitset, so they have to be 2-based (2,4,8,16,32, ...)

Enumerator
NO_BOUNDARY_VTX 

removes vertices on the boundary. (i.e. with a TSTT tag "boundary").

NO_INTERIOR_VTX 

removes vertices that are not on the boundary

CULL_METHOD_3 

no other culling method yet.

CULL_METHOD_4 
NO_BOUNDARY_VTX 

removes vertices on the boundary. (i.e. with a TSTT tag "boundary").

NO_INTERIOR_VTX 

removes vertices that are not on the boundary

CULL_METHOD_3 

no other culling method yet.

CULL_METHOD_4 

Definition at line 407 of file includeLinks/PatchData.hpp.

enum PatchType

Tells MeshSet how to retrieve the mesh entities that will be stored in PatchData.

The PatchType is set by the QualityImprover etc... and mesquite propagates it to the MeshSet.

Enumerator
UNDEFINED_PATCH_TYPE 

Default.

VERTICES_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through edges to the center vertex.

ELEMENTS_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through elements to the center vertex.

GLOBAL_PATCH 

Fills PatchData with all elements and vertices contained in all the meshes of the MeshSet.

UNDEFINED_PATCH_TYPE 

Default.

VERTICES_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through edges to the center vertex.

ELEMENTS_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through elements to the center vertex.

GLOBAL_PATCH 

Fills PatchData with all elements and vertices contained in all the meshes of the MeshSet.

Definition at line 391 of file includeLinks/PatchData.hpp.

enum PatchType

Tells MeshSet how to retrieve the mesh entities that will be stored in PatchData.

The PatchType is set by the QualityImprover etc... and mesquite propagates it to the MeshSet.

Enumerator
UNDEFINED_PATCH_TYPE 

Default.

VERTICES_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through edges to the center vertex.

ELEMENTS_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through elements to the center vertex.

GLOBAL_PATCH 

Fills PatchData with all elements and vertices contained in all the meshes of the MeshSet.

UNDEFINED_PATCH_TYPE 

Default.

VERTICES_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through edges to the center vertex.

ELEMENTS_ON_VERTEX_PATCH 

fills PatchData with the vertices connected through elements to the center vertex.

GLOBAL_PATCH 

Fills PatchData with all elements and vertices contained in all the meshes of the MeshSet.

Definition at line 391 of file src/Mesh/PatchData.hpp.

Constructor & Destructor Documentation

~PatchData ( )

Definition at line 81 of file Mesh/PatchData.cpp.

82 {
83 }
PatchData ( const PatchData pd)
private

Doesn't allow PatchData to be copied implicitly.

Mementos such as PatchDataVerticesMemento should be used when necessary.

PatchData ( )
~PatchData ( )
PatchData ( const PatchData pd)
private

Doesn't allow PatchData to be copied implicitly.

Mementos such as PatchDataVerticesMemento should be used when necessary.

Member Function Documentation

void allocate_storage ( size_t  vertex_count,
size_t  element_count,
size_t  vertex_use_count,
MsqError err 
)

Used by test code when creating a PatchData directly.

PatchData should be constructed by first calling this function, then initializing arrays and then calling initalize_data.

Definition at line 1471 of file Mesh/PatchData.cpp.

References PatchData::clear_tag_data(), PatchData::elemConnectivityArray, PatchData::elementArray, PatchData::elementHandlesArray, PatchData::numCornerVertices, PatchDataMem< X >::resize(), PatchData::vertexArray, and PatchData::vertexHandlesArray.

1475 {
1476  vertexArray.resize( vertex_count );
1477  vertexHandlesArray.resize( vertex_count );
1478  elementArray.resize( element_count );
1479  elementHandlesArray.resize( element_count );
1480  elemConnectivityArray.resize( vertex_use_count );
1481  clear_tag_data();
1482  numCornerVertices = 0;
1483 }
PatchDataMem< MsqVertex > vertexArray
PatchDataMem< size_t > elemConnectivityArray
PatchDataMem< MsqMeshEntity > elementArray
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray

Here is the call graph for this function:

void allocate_storage ( size_t  vertex_count,
size_t  element_count,
size_t  vertex_use_count,
MsqError err 
)

Used by test code when creating a PatchData directly.

PatchData should be constructed by first calling this function, then initializing arrays and then calling initalize_data.

void clear ( )
inline

Removes data.

Definition at line 491 of file includeLinks/PatchData.hpp.

References PatchDataMem< X >::clear(), PatchData::elemConnectivityArray, PatchData::elementArray, PatchData::elementHandlesArray, PatchData::haveComputedInfos, PatchData::meshSet, PatchData::numCornerVertices, PatchData::vertAdjacencyArray, PatchData::vertAdjacencyOffsets, PatchData::vertexArray, PatchData::vertexHandlesArray, and PatchData::vertexNormals.

Referenced by MeshSet::get_next_patch().

492  {
493  vertexArray.clear();
494  vertexHandlesArray.clear();
495  elementArray.clear();
496  elementHandlesArray.clear();
500  vertexNormals.clear();
501  numCornerVertices = 0;
502  haveComputedInfos = 0;
503  meshSet = 0;
504  }
PatchDataMem< MsqVertex > vertexArray
PatchDataMem< size_t > elemConnectivityArray
PatchDataMem< Vector3D > vertexNormals
PatchDataMem< size_t > vertAdjacencyOffsets
PatchDataMem< MsqMeshEntity > elementArray
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
PatchDataMem< size_t > vertAdjacencyArray

Here is the call graph for this function:

Here is the caller graph for this function:

void clear ( )

Removes data.

void clear_computed_info ( )
inline

This function clears the patch information such as maximum volume, etc ...

Definition at line 116 of file includeLinks/PatchData.hpp.

References PatchData::haveComputedInfos.

void clear_computed_info ( )
inline

This function clears the patch information such as maximum volume, etc ...

Definition at line 116 of file src/Mesh/PatchData.hpp.

References PatchData::haveComputedInfos.

void clear_tag_data ( )

Definition at line 1485 of file Mesh/PatchData.cpp.

References PatchData::targetMatrices.

Referenced by PatchData::allocate_storage(), PatchData::initialize_data(), and PatchData::reorder().

1486 {
1487  targetMatrices.clear();
1488 }
CornerTag< TargetMatrix > targetMatrices
Target matrix data.

Here is the caller graph for this function:

void clear_tag_data ( )
PatchDataVerticesMemento * create_vertices_memento ( MsqError err,
bool  include_higher_order = false 
)
inline

Creates a memento that holds the current state of the PatchData coordinates.

Definition at line 615 of file includeLinks/PatchData.hpp.

References PatchDataVerticesMemento::arraySize, PatchData::num_nodes(), PatchData::num_vertices(), PatchDataVerticesMemento::numVertices, PatchDataVerticesMemento::originator, PatchData::vertexArray, and PatchDataVerticesMemento::vertices.

Referenced by ConjugateGradient::initialize(), FeasibleNewton::initialize(), SteepestDescent::optimize_vertex_positions(), TerminationCriterion::reset_inner(), and TerminationCriterion::reset_patch().

617  {
618  size_t num_verts = include_higher_order ? num_nodes() : num_vertices();
619  PatchDataVerticesMemento* memento = new PatchDataVerticesMemento;
620  memento->originator = this;
621  if (num_verts)
622  memento->vertices = new MsqVertex[num_verts];
623  memento->numVertices = num_verts;
624  memento->arraySize = num_verts;
625 
626  // Copy the coordinates
627  msq_stdc::memcpy(memento->vertices, &vertexArray[0], num_verts*sizeof(MsqVertex) );
628 
629  return memento;
630  }
PatchDataMem< MsqVertex > vertexArray
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)
size_t num_vertices() const
number of vertices in the patch.

Here is the call graph for this function:

Here is the caller graph for this function:

PatchDataVerticesMemento* create_vertices_memento ( MsqError err,
bool  include_higher_order = false 
)

Creates a memento that holds the current state of the PatchData coordinates.

bool domain_set ( )
inline

Returns whether a domain is associated with the MeshSet from which the Patch originates. If false, you cannot ask for a surface normal.

Definition at line 280 of file includeLinks/PatchData.hpp.

References PatchData::domainSet.

Referenced by GeneralizedConditionNumberQualityMetric::compute_condition_number(), MsqMeshEntity::compute_corner_normals(), and ShapeQualityMetric::condition_number_2d().

281  { return domainSet; }

Here is the caller graph for this function:

bool domain_set ( )
inline

Returns whether a domain is associated with the MeshSet from which the Patch originates. If false, you cannot ask for a surface normal.

Definition at line 280 of file src/Mesh/PatchData.hpp.

References PatchData::domainSet.

281  { return domainSet; }
MsqMeshEntity& element_by_index ( size_t  index)
MsqMeshEntity & element_by_index ( size_t  index)
inline

Definition at line 589 of file includeLinks/PatchData.hpp.

References PatchData::elementArray.

Referenced by NonSmoothSteepestDescent::compute_function(), MeanMidNodeMover::loop_over_mesh(), QualityAssessor::loop_over_mesh(), and CornerTagHandles::num_corners().

590  {
591  return elementArray[index];
592  }
PatchDataMem< MsqMeshEntity > elementArray

Here is the caller graph for this function:

void generate_vertex_to_element_data ( )

Create the arrays that store which elements are attached to each node. If you know how many total vertex uses there are, pass it in. Otherwise the PatchData will calculate that number.

Definition at line 944 of file Mesh/PatchData.cpp.

References PatchDataMem< X >::begin(), PatchData::elemConnectivityArray, PatchData::elementArray, PatchDataMem< X >::empty(), PatchDataMem< X >::end(), i, MSQ_FUNCTION_TIMER, PatchData::num_nodes(), PatchDataMem< X >::resize(), PatchDataMem< X >::size(), PatchData::vertAdjacencyArray, and PatchData::vertAdjacencyOffsets.

Referenced by PatchData::get_vertex_element_adjacencies(), and PatchData::reorder().

945 {
946  MSQ_FUNCTION_TIMER( "PatchData::generate_vertex_to_element_data" );
947 
948  // Skip if data already exists
949  if (!vertAdjacencyArray.empty())
950  return;
951 
952  // Allocate offset array
954  memset( &vertAdjacencyOffsets[0], 0, sizeof(size_t)*vertAdjacencyOffsets.size() );
955 
956  // Temporarily use offsets array to hold per-vertex element count
957  PatchDataMem<MsqMeshEntity>::iterator elem_iter;
958  const PatchDataMem<MsqMeshEntity>::iterator elem_end = elementArray.end();
959  for (elem_iter = elementArray.begin(); elem_iter != elem_end; ++elem_iter)
960  {
961  size_t* conn_iter = elem_iter->get_vertex_index_array();
962  const size_t* conn_end = conn_iter + elem_iter->node_count();
963  for ( ; conn_iter != conn_end; ++conn_iter )
964  ++vertAdjacencyOffsets[*conn_iter];
965  }
966 
967  // Convert counts to end indices.
968  // When done, vertAdjacencyOffsets will contain, for each vertex,
969  // one more than the *last* index for that vertex's data in the
970  // adjacency array. This is *not* the final state for this data.
971  // See comments for next loop.
974  size_t prev = *off_iter;
975  ++off_iter;
976  for ( ; off_iter != off_end; ++off_iter)
977  {
978  prev += *off_iter;
979  *off_iter = prev;
980  }
981 
982  // Allocate space for element numbers
983  const size_t num_vert_uses = vertAdjacencyOffsets[num_nodes()-1];
984  assert( num_vert_uses == elemConnectivityArray.size() );
985  vertAdjacencyArray.resize( num_vert_uses );
986 
987  // Fill vertAdjacencyArray, using the indices in vertAdjacencyOffsets
988  // as the location to insert the next element number in
989  // vertAdjacencyArray. When done, vertAdjacenyOffsets will contain
990  // the start index for each vertex, rather than one past the last
991  // index.
992  for (size_t i = 0; i < elementArray.size(); ++i)
993  {
994  size_t* conn_iter = elementArray[i].get_vertex_index_array();
995  const size_t* conn_end = conn_iter + elementArray[i].node_count();
996  for ( ; conn_iter != conn_end; ++conn_iter )
997  {
998  const size_t array_index = --vertAdjacencyOffsets[*conn_iter];
999  vertAdjacencyArray[array_index] = i;
1000  }
1001  }
1002 
1003  // Last entry should be number of vertex uses (one past the
1004  // last index of the last vertex.)
1005  vertAdjacencyOffsets[num_nodes()] = num_vert_uses;
1006 }
PatchDataMem< size_t > elemConnectivityArray
blockLoc i
Definition: read.cpp:79
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)
PatchDataMem< size_t > vertAdjacencyOffsets
PatchDataMem< MsqMeshEntity > elementArray
PatchDataMem< size_t > vertAdjacencyArray

Here is the call graph for this function:

Here is the caller graph for this function:

void generate_vertex_to_element_data ( )

Create the arrays that store which elements are attached to each node. If you know how many total vertex uses there are, pass it in. Otherwise the PatchData will calculate that number.

void get_adjacent_entities_via_n_dim ( int  n,
size_t  ent_ind,
msq_std::vector< size_t > &  adj_ents,
MsqError err 
)

Get the indices of entities attached to entity (given by ent_ind). adj_ents is filled with the indices into the entity array of elements adjacent to the given element via an n-dimensional entity.

Referenced by ASMQualityMetric::evaluate_element().

Here is the caller graph for this function:

void get_adjacent_entities_via_n_dim ( int  n,
size_t  ent_ind,
msq_std::vector< size_t > &  adj_ents,
MsqError err 
)

Get the indices of entities attached to entity (given by ent_ind). adj_ents is filled with the indices into the entity array of elements adjacent to the given element via an n-dimensional entity.

void get_adjacent_vertex_indices ( size_t  vertex_index,
msq_std::vector< size_t > &  vert_indices,
MsqError err 
)

Get the indices of vertices that are attached to vertex (given by vertex_index) by an element edge.

void get_adjacent_vertex_indices ( size_t  vertex_index,
msq_std::vector< size_t > &  vert_indices,
MsqError err 
)

Get the indices of vertices that are attached to vertex (given by vertex_index) by an element edge.

Referenced by LPtoPTemplate::compute_analytical_gradient(), EdgeLengthQualityMetric::evaluate_vertex(), EdgeLengthRangeQualityMetric::evaluate_vertex(), SmartLaplacianSmoother::optimize_vertex_positions(), and LaplacianSmoother::optimize_vertex_positions().

Here is the caller graph for this function:

double get_average_Lambda_3d ( MsqError err)

Returns average corner determinant over all corners in the patch This information is stored in the patch and should not decrease performance when used properly.

See also PatchData::clear_computed_info() .

Definition at line 158 of file Mesh/PatchData.cpp.

References A, PatchData::AVERAGE_DET3D, TargetCalculator::compute_Lambda(), PatchData::computedInfos, PatchData::elementArray, PatchData::have_computed_info(), i, MSQ_ERRZERO, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, and PatchData::note_have_info().

Referenced by LVQDTargetCalculator::compute_target_matrices().

159 {
160  double avg;
162  {
164  }
165  else
166  {
167  avg =0.;
168  int total_num_corners =0;
169  Matrix3D A[MSQ_MAX_NUM_VERT_PER_ENT];
170  for (size_t i=0; i<elementArray.size(); ++i) {
171  int nve = elementArray[i].vertex_count();
172  elementArray[i].compute_corner_matrices(*this, A, nve, err);
173  MSQ_ERRZERO(err);
174  total_num_corners += nve;
175  for (int c=0; c<nve; ++c) {
176  avg += TargetCalculator::compute_Lambda(A[c], err);
177  MSQ_ERRZERO(err);
178  }
179  }
180 
181  avg = avg / total_num_corners;
184  }
185  return avg;
186 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
void note_have_info(ComputedInfo info)
double computedInfos[MAX_COMPUTED_INFO_ENUM]
static double compute_Lambda(const Matrix3D &A, MsqError &err)
Note that this function is static, i.e. it can be used independently of an object.
average corner determinant out of all elements in the patch
rational * A
Definition: vinci_lass.c:67
bool have_computed_info(ComputedInfo info) const
blockLoc i
Definition: read.cpp:79
PatchDataMem< MsqMeshEntity > elementArray

Here is the call graph for this function:

Here is the caller graph for this function:

double get_average_Lambda_3d ( MsqError err)

Returns average corner determinant over all corners in the patch This information is stored in the patch and should not decrease performance when used properly.

See also PatchData::clear_computed_info() .

double get_barrier_delta ( MsqError err)

Returns delta based on the minimum and maximum corner determinant over all elements in the patch This information is stored in the patch and should not decrease performance when used properly.

See also PatchData::clear_computed_info() .

Definition at line 117 of file Mesh/PatchData.cpp.

References A, PatchData::computedInfos, Mesquite::det(), PatchData::elementArray, PatchData::have_computed_info(), i, MsqError::INVALID_MESH, j, max(), min(), PatchData::MINMAX_SIGNED_DET3D, Mesquite::MSQ_DBL_MAX, MSQ_ERRZERO, Mesquite::MSQ_MAX_NUM_VERT_PER_ENT, Mesquite::MSQ_MIN, MSQ_SETERR, PatchData::note_have_info(), and PatchData::num_elements().

Referenced by RI_DFT::compute_element_analytical_gradient(), I_DFT::compute_element_analytical_gradient(), RI_DFT::compute_element_analytical_hessian(), I_DFT::compute_element_analytical_hessian(), ShapeQualityMetric::condition_number_2d(), ShapeQualityMetric::condition_number_3d(), RI_DFT::evaluate_element(), I_DFT::evaluate_element(), and DistanceFromTarget::get_barrier_function().

118 {
119  double result;
121  {
123  }
124  else
125  {
126  double min= MSQ_DBL_MAX;
127  double max=-MSQ_DBL_MAX;
128  size_t count = num_elements();
129  for (size_t i=0; i<count; ++i) {
130  Matrix3D A[MSQ_MAX_NUM_VERT_PER_ENT];
131  size_t nve = elementArray[i].vertex_count();
132  elementArray[i].compute_corner_matrices(*this, A, nve, err);
133  MSQ_ERRZERO(err);
134  for (size_t j=0; j<nve; ++j) {
135  min = det(A[j]) < min ? det(A[j]) : min;
136  max = det(A[j]) > max ? det(A[j]) : max;
137  }
138  }
139 
140  if (max <= 0) {
141  MSQ_SETERR(err)("Sigma_max is not positive.", MsqError::INVALID_MESH);
142  return 0;
143  }
144  //We set delta to zero if everything in the initial mesh is valid.
145  // This causes metrics with a barrier between valid and inverted
146  // meshes to retain that barrier. If there is a negative jacobian
147  // corner in the mesh, we set delta to a small fraction of the
148  // maximum jacobian in the mesh.
149  result = (min<=MSQ_MIN) ? 0.001 * max : 0;
152  }
153 
154  return result;
155 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
const double MSQ_DBL_MAX
Definition: Mesquite.hpp:170
const int MSQ_MAX_NUM_VERT_PER_ENT
Definition: Mesquite.hpp:120
void note_have_info(ComputedInfo info)
double computedInfos[MAX_COMPUTED_INFO_ENUM]
rational * A
Definition: vinci_lass.c:67
size_t num_elements() const
number of elements in the Patch.
bool have_computed_info(ComputedInfo info) const
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
double det(const Matrix3D &A)
PatchDataMem< MsqMeshEntity > elementArray
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
j indices j
Definition: Indexing.h:6
minimum and maximum corner volume out of all elements in the patch
const double MSQ_MIN
Definition: Mesquite.hpp:160

Here is the call graph for this function:

Here is the caller graph for this function:

double get_barrier_delta ( MsqError err)

Returns delta based on the minimum and maximum corner determinant over all elements in the patch This information is stored in the patch and should not decrease performance when used properly.

See also PatchData::clear_computed_info() .

size_t* get_connectivity_array ( )
inline

Definition at line 201 of file src/Mesh/PatchData.hpp.

References PatchData::elemConnectivityArray.

202  { return &elemConnectivityArray[0]; }
PatchDataMem< size_t > elemConnectivityArray
size_t* get_connectivity_array ( )
inline

Definition at line 201 of file includeLinks/PatchData.hpp.

References PatchData::elemConnectivityArray.

202  { return &elemConnectivityArray[0]; }
PatchDataMem< size_t > elemConnectivityArray
void get_domain_normal_at_element ( size_t  elem_index,
Vector3D surf_norm,
MsqError err 
) const

Get the normal to the domain at the centroid (projected to the domain) of a given element. Normal is returned in Vector3D &surf_norm. If the normal cannot be determined, or if the underlying domain is not a surface, the normal will be set to (0,0,0). Check PatchData::domain_set() is not false first.

Definition at line 1184 of file Mesh/PatchData.cpp.

References PatchData::elementArray, PatchData::elementHandlesArray, MeshSet::get_domain_constraint(), MsqError::INVALID_STATE, PatchData::meshSet, MSQ_ERRRTN, MSQ_SETERR, and MeshDomain::normal_at().

Referenced by IdealWeightInverseMeanRatio::compute_element_analytical_gradient(), IdealWeightMeanRatio::compute_element_analytical_gradient(), IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), IdealWeightMeanRatio::compute_element_analytical_hessian(), MsqMeshEntity::compute_signed_area(), IdealWeightInverseMeanRatio::evaluate_element(), IdealWeightMeanRatio::evaluate_element(), PatchData::get_domain_normal_at_element(), and UntangleBetaQualityMetric::untangle_function_2d().

1187 {
1189  {
1190  elementArray[elem_index].get_centroid(surf_norm, *this, err);
1191  MSQ_ERRRTN(err);
1193  elementHandlesArray[elem_index],
1194  surf_norm);
1195  }
1196  else
1197  MSQ_SETERR(err)( "No domain constraint set.", MsqError::INVALID_STATE );
1198 }
Mesquite::MeshDomain * get_domain_constraint()
Returns the domain associated with the MeshSet from which the Patch originates.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
PatchDataMem< MsqMeshEntity > elementArray
object is in an invalid state
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
virtual void normal_at(Mesh::EntityHandle entity_handle, Vector3D &coordinate) const =0
Returns the normal of the domain to which &quot;entity_handle&quot; is constrained.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void get_domain_normal_at_element ( size_t  elem_index,
Vector3D surf_norm,
MsqError err 
) const

Get the normal to the domain at the centroid (projected to the domain) of a given element. Normal is returned in Vector3D &surf_norm. If the normal cannot be determined, or if the underlying domain is not a surface, the normal will be set to (0,0,0). Check PatchData::domain_set() is not false first.

void get_domain_normal_at_element ( MsqMeshEntity elem_ptr,
Vector3D surf_norm,
MsqError err 
) const
inline

Alternative signature. Same functionality.

Definition at line 321 of file includeLinks/PatchData.hpp.

References PatchData::elementArray, and PatchData::get_domain_normal_at_element().

323  { get_domain_normal_at_element(size_t(elem_ptr-&(elementArray[0])), surf_norm, err); }
void get_domain_normal_at_element(size_t elem_index, Vector3D &surf_norm, MsqError &err) const
PatchDataMem< MsqMeshEntity > elementArray

Here is the call graph for this function:

void get_domain_normal_at_element ( MsqMeshEntity elem_ptr,
Vector3D surf_norm,
MsqError err 
) const
inline

Alternative signature. Same functionality.

Definition at line 321 of file src/Mesh/PatchData.hpp.

References PatchData::elementArray, and PatchData::get_domain_normal_at_element().

323  { get_domain_normal_at_element(size_t(elem_ptr-&(elementArray[0])), surf_norm, err); }
void get_domain_normal_at_element(size_t elem_index, Vector3D &surf_norm, MsqError &err) const
PatchDataMem< MsqMeshEntity > elementArray

Here is the call graph for this function:

void get_domain_normal_at_vertex ( size_t  vertex_index,
bool  normalize,
Vector3D surf_norm,
MsqError err 
)

Get the normal of the surface for a given vertex. Normal is returned in Vector3D &surf_norm. If the normal cannot be determined, or if the underlying domain is not a surface, the normal will be set to (0,0,0). Check PatchData::domain_set() is not false first.

Definition at line 1117 of file Mesh/PatchData.cpp.

References PatchData::domainHint, MeshSet::get_domain_constraint(), MsqError::INVALID_STATE, PatchData::meshSet, MSQ_ERRRTN, MSQ_SETERR, Mesquite::NO_DOMAIN_HINT, MeshDomain::normal_at(), Vector3D::normalize(), Mesquite::PLANAR_DOMAIN, PatchData::update_cached_normals(), PatchData::vertexArray, PatchData::vertexHandlesArray, and PatchData::vertexNormals.

Referenced by GeneralizedConditionNumberQualityMetric::compute_condition_number(), RI_DFT::compute_element_analytical_gradient(), RI_DFT::compute_element_analytical_hessian(), ShapeQualityMetric::condition_number_2d(), and RI_DFT::evaluate_element().

1121 {
1122  if (domainHint != NO_DOMAIN_HINT)
1123  {
1124  if (vertexNormals.empty())
1125  {
1126  update_cached_normals( err ); MSQ_ERRRTN(err);
1127  }
1128 
1129  if (domainHint == PLANAR_DOMAIN)
1130  vertex_index = 0;
1131  surf_norm = vertexNormals[vertex_index];
1132  }
1133  else
1134  {
1135  MeshDomain* domain = meshSet ? meshSet->get_domain_constraint() : 0;
1136  if (!domain)
1137  {
1138  MSQ_SETERR(err)( "No domain constraint set.", MsqError::INVALID_STATE );
1139  return;
1140  }
1141 
1142  surf_norm = vertexArray[vertex_index];
1143  domain->normal_at( vertexHandlesArray[vertex_index], surf_norm );
1144  }
1145 
1146  if (normalize)
1147  surf_norm.normalize();
1148 }
PatchDataMem< MsqVertex > vertexArray
Mesquite::MeshDomain * get_domain_constraint()
Returns the domain associated with the MeshSet from which the Patch originates.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
void update_cached_normals(MsqError &)
PatchDataMem< Vector3D > vertexNormals
object is in an invalid state
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void get_domain_normal_at_vertex ( size_t  vertex_index,
bool  normalize,
Vector3D surf_norm,
MsqError err 
)

Get the normal of the surface for a given vertex. Normal is returned in Vector3D &surf_norm. If the normal cannot be determined, or if the underlying domain is not a surface, the normal will be set to (0,0,0). Check PatchData::domain_set() is not false first.

void get_domain_normals_at_corners ( size_t  element_index,
Vector3D  normals_out[],
MsqError err 
)

Get surface normal at a point where the surface is the domain of an element and the point is the location of one of the element corners.

Get surface normals at element corners. normals_out must be of sufficient size to hold the normals of all the corners.

Definition at line 1221 of file Mesh/PatchData.cpp.

References PatchData::domainHint, PatchData::elementArray, PatchData::elementHandlesArray, MeshSet::get_domain_constraint(), MsqMeshEntity::get_vertex_index_array(), i, MsqError::INVALID_STATE, PatchData::meshSet, MSQ_CHKERR, MSQ_ERRRTN, MSQ_SETERR, Mesquite::NO_DOMAIN_HINT, MeshDomain::normal_at(), Mesquite::PLANAR_DOMAIN, PatchData::update_cached_normals(), MsqMeshEntity::vertex_count(), PatchData::vertexArray, and PatchData::vertexNormals.

Referenced by MsqMeshEntity::compute_corner_normals().

1224 {
1225  const MsqMeshEntity& elem = elementArray[elem_index];
1226  const unsigned count = elem.vertex_count();
1227  const size_t* const vertex_indices = elem.get_vertex_index_array();
1228 
1229  if (domainHint != NO_DOMAIN_HINT)
1230  {
1231  if (vertexNormals.empty())
1232  {
1233  update_cached_normals( err ); MSQ_ERRRTN(err);
1234  }
1235 
1236  if (domainHint == PLANAR_DOMAIN)
1237  {
1238  for (unsigned i = 0; i < count; ++i)
1239  normals_out[i] = vertexNormals[0];
1240  }
1241  else
1242  {
1243  for (unsigned i = 0; i < count; ++i)
1244  normals_out[i] = vertexNormals[vertex_indices[i]];
1245  }
1246  }
1247  else
1248  {
1249  MeshDomain* domain = meshSet ? meshSet->get_domain_constraint() : 0;
1250  if (!domain)
1251  {
1252  MSQ_SETERR(err)( "No domain constraint set.", MsqError::INVALID_STATE );
1253  return;
1254  }
1255 
1256  for (unsigned i = 0; i < count; ++i)
1257  normals_out[i] = vertexArray[ vertex_indices[i] ];
1258 
1259  domain->normal_at( elementHandlesArray[elem_index],
1260  normals_out, count,
1261  err ); MSQ_CHKERR(err);
1262  }
1263 }
PatchDataMem< MsqVertex > vertexArray
Mesquite::MeshDomain * get_domain_constraint()
Returns the domain associated with the MeshSet from which the Patch originates.
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
void update_cached_normals(MsqError &)
PatchDataMem< Vector3D > vertexNormals
PatchDataMem< MsqMeshEntity > elementArray
object is in an invalid state
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void get_domain_normals_at_corners ( size_t  element_index,
Vector3D  normals_out[],
MsqError err 
)

Get surface normal at a point where the surface is the domain of an element and the point is the location of one of the element corners.

Get surface normals at element corners. normals_out must be of sufficient size to hold the normals of all the corners.

const MsqMeshEntity * get_element_array ( MsqError err) const
inline

Returns a pointer to the start of the element array.

Returns the PatchData element array.

Definition at line 530 of file includeLinks/PatchData.hpp.

References PatchData::elementArray, MsqError::INVALID_STATE, and MSQ_SETERR.

Referenced by MsqHessian::accumulate_entries(), VertexMover::check_feasible(), LPtoPTemplate::compute_analytical_gradient(), LPtoPTemplate::compute_analytical_hessian(), TargetCalculator::compute_default_target_matrices(), TargetCalculator::compute_guide_matrices(), TargetCalculator::compute_reference_corner_matrices(), WTargetCalculator::compute_target_matrices(), LVQDTargetCalculator::compute_target_matrices(), TargetCalculator::compute_target_matrices_and_check_det(), LInfTemplate::concrete_evaluate(), MaxTemplate::concrete_evaluate(), LPtoPTemplate::concrete_evaluate(), ASMQualityMetric::evaluate_element(), VertexConditionNumberQualityMetric::evaluate_vertex(), LocalSizeQualityMetric::evaluate_vertex(), MeshSet::get_next_elem_on_vert_patch(), MeshSet::get_next_global_patch(), MsqHessian::initialize(), NonSmoothSteepestDescent::optimize_vertex_positions(), and CornerTagHandles::save_load_tags().

531  {
532  if (elementArray.empty())
533  MSQ_SETERR(err)( "No element array defined", MsqError::INVALID_STATE );
534  return &elementArray[0];
535  }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
PatchDataMem< MsqMeshEntity > elementArray
object is in an invalid state

Here is the caller graph for this function:

const MsqMeshEntity* get_element_array ( MsqError err) const

Returns a pointer to the start of the element array.

MsqMeshEntity* get_element_array ( MsqError err)
MsqMeshEntity * get_element_array ( MsqError err)
inline

Definition at line 536 of file includeLinks/PatchData.hpp.

References PatchData::elementArray, MsqError::INVALID_STATE, and MSQ_SETERR.

537  {
538  if (elementArray.empty())
539  MSQ_SETERR(err)( "No element array defined", MsqError::INVALID_STATE );
540  return &elementArray[0];
541  }
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
PatchDataMem< MsqMeshEntity > elementArray
object is in an invalid state
const Mesh::ElementHandle* get_element_handles_array ( ) const
inline

Definition at line 204 of file src/Mesh/PatchData.hpp.

References PatchData::elementHandlesArray.

205  { return &elementHandlesArray[0]; }
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
const Mesh::ElementHandle* get_element_handles_array ( ) const
inline

Definition at line 204 of file includeLinks/PatchData.hpp.

References PatchData::elementHandlesArray.

Referenced by CornerTagHandles::save_load_tags().

205  { return &elementHandlesArray[0]; }
PatchDataMem< Mesh::ElementHandle > elementHandlesArray

Here is the caller graph for this function:

size_t get_element_index ( MsqMeshEntity element)
void get_element_vertex_coordinates ( size_t  elem_index,
msq_std::vector< Vector3D > &  coords,
MsqError err 
)

Get the coordinates of vertices attached to the specified element.

void get_element_vertex_coordinates ( size_t  elem_index,
msq_std::vector< Vector3D > &  coords,
MsqError err 
)

Get the coordinates of vertices attached to the specified element.

Referenced by AspectRatioGammaQualityMetric::evaluate_element().

Here is the caller graph for this function:

void get_element_vertex_indices ( size_t  elem_index,
msq_std::vector< size_t > &  vertex_indices,
MsqError err 
)

Get the indices of vertices of specified element. !inefficient!

void get_element_vertex_indices ( size_t  elem_index,
msq_std::vector< size_t > &  vertex_indices,
MsqError err 
)

Get the indices of vertices of specified element. !inefficient!

double get_max_vertex_movement_squared ( PatchDataVerticesMemento memento,
MsqError err 
)

Calculates the distance each vertex has moved from its original position as defined by the PatchDataVerticesMememnto.

Finds the maximum movement (in the distance norm) of the vertices in a patch. The previous vertex positions are givena as a PatchDataVerticesMemento (memento). The distance squared which each vertex has moved is then calculated, and the largest of those distances is returned. This function only considers the movement of vertices that are currently 'free'.

Parameters
mementoa memento of this patch's vertex position at some (prior) time in the optimization.

Definition at line 679 of file Mesh/PatchData.cpp.

References Vector3D::length_squared(), MSQ_ERRZERO, MsqFreeVertexIndexIterator::next(), MsqFreeVertexIndexIterator::reset(), MsqFreeVertexIndexIterator::value(), PatchData::vertexArray, and PatchDataVerticesMemento::vertices.

Referenced by TerminationCriterion::accumulate_inner(), TerminationCriterion::accumulate_patch(), and TerminationCriterion::cull_vertices().

682 {
683  int m=0;
684  Vector3D temp_vec;
685  double temp_dist=0.0;
686  double max_dist=0.0;
687  MsqFreeVertexIndexIterator free_iter(this, err); MSQ_ERRZERO(err);
688  free_iter.reset();
689  while (free_iter.next())
690  {
691  m=free_iter.value();
692  temp_vec=vertexArray[m] - memento->vertices[m];
693  temp_dist=temp_vec.length_squared();
694  if(temp_dist>max_dist)
695  {
696  max_dist=temp_dist;
697  }
698  }
699  return max_dist;
700 }
#define MSQ_ERRZERO(err)
Return zero/NULL on error.
PatchDataMem< MsqVertex > vertexArray
NVec< 3, double > Vector3D

Here is the call graph for this function:

Here is the caller graph for this function:

double get_max_vertex_movement_squared ( PatchDataVerticesMemento memento,
MsqError err 
)

Calculates the distance each vertex has moved from its original position as defined by the PatchDataVerticesMememnto.

MeshSet* get_mesh_set ( )
inline

Returns the originating meshSet.

Definition at line 423 of file includeLinks/PatchData.hpp.

References PatchData::meshSet.

Referenced by CornerTagHandles::get_current_mesh().

424  { return meshSet; }

Here is the caller graph for this function:

MeshSet* get_mesh_set ( )
inline

Returns the originating meshSet.

Definition at line 423 of file src/Mesh/PatchData.hpp.

References PatchData::meshSet.

424  { return meshSet; }
void get_minmax_element_unsigned_area ( double &  min,
double &  max,
MsqError err 
)

Returns the maximum volume or area out of all the elements in the patch This information is stored in the patch and should not decrease performance when used properly.

See also PatchData::clear_computed_info() .

Definition at line 86 of file Mesh/PatchData.cpp.

References PatchData::computedInfos, PatchData::elementArray, PatchData::have_computed_info(), i, MsqError::INTERNAL_ERROR, max(), PatchData::MAX_UNSIGNED_AREA, min(), PatchData::MIN_UNSIGNED_AREA, Mesquite::MSQ_DBL_MAX, MSQ_ERRRTN, MSQ_SETERR, PatchData::note_have_info(), and PatchData::num_elements().

87 {
90  {
91  max=0;
93  size_t count = num_elements();
94  for (size_t i=0; i<count; ++i) {
95  double vol;
96  vol = elementArray[i].compute_unsigned_area(*this, err); MSQ_ERRRTN(err);
97  if (vol > max)
98  max = vol;
99  if (vol < min)
100  min = vol;
101  }
106  }
107  else
108  {
111  }
112 
113  if (max <= 0 || min < 0 || min == MSQ_DBL_MAX)
115 }
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
const double MSQ_DBL_MAX
Definition: Mesquite.hpp:170
void note_have_info(ComputedInfo info)
double computedInfos[MAX_COMPUTED_INFO_ENUM]
size_t num_elements() const
number of elements in the Patch.
bool have_computed_info(ComputedInfo info) const
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
PatchDataMem< MsqMeshEntity > elementArray
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
minimum volume or area out of all elements in the patch
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.
maximum volume or area out of all elements in the patch

Here is the call graph for this function:

void get_minmax_element_unsigned_area ( double &  min,
double &  max,
MsqError err 
)

Returns the maximum volume or area out of all the elements in the patch This information is stored in the patch and should not decrease performance when used properly.

See also PatchData::clear_computed_info() .

void get_subpatch ( size_t  center_vertex_index,
PatchData pd_to_fill,
MsqError err 
)

Fills a PatchData with the elements attached to a center vertex.

Note that all entities in the sub-patch are copies of the entities in 'this' patch. As such, moving a vertex in the sub-patch won't move the corresponding vertex in the source patch. Also, calling 'update_mesh()' on the sub-patch WILL modify the TSTT mesh, but the source patch won't see the changes.

Definition at line 1008 of file Mesh/PatchData.cpp.

References PatchData::elemConnectivityArray, PatchData::elementArray, PatchData::elementHandlesArray, MsqMeshEntity::get_element_type(), PatchData::get_vertex_element_adjacencies(), MsqMeshEntity::get_vertex_index(), PatchData::initialize_data(), MsqError::INVALID_ARG, MSQ_ERRRTN, MSQ_SETERR, MsqMeshEntity::node_count(), PatchData::num_vertices(), PatchDataMem< X >::resize(), PatchData::vertexArray, and PatchData::vertexHandlesArray.

Referenced by ObjectiveFunction::compute_numerical_gradient().

1011 {
1012  // Make sure we're in range
1013  if (center_vertex_index >= num_vertices())
1014  {
1015  MSQ_SETERR(err)("Invalid index for center vertex",MsqError::INVALID_ARG);
1016  return;
1017  }
1018 
1019  // Map vertex indices from this patch data to indices in new patch data
1020  msq_std::map<size_t, size_t> vertex_index_map;
1021 
1022  size_t num_elems;
1023  const size_t* vertex_adjacencies;
1024  vertex_adjacencies = get_vertex_element_adjacencies( center_vertex_index,
1025  num_elems, err );
1026  MSQ_ERRRTN(err);
1027 
1028  // Loop through each element, populating vertex_index_map.
1029  size_t which_elem, which_vert, vertex_count = 0;
1030  size_t vertex_uses = 0;
1031  for (which_elem = 0; which_elem < num_elems; ++which_elem )
1032  {
1033  size_t elem_index = vertex_adjacencies[which_elem];
1034  MsqMeshEntity& elem = elementArray[elem_index];
1035  for (which_vert = elem.node_count(); which_vert--; )
1036  {
1037  size_t vert_index = elem.get_vertex_index(which_vert);
1038  if (vertex_index_map.find(vert_index) != vertex_index_map.end())
1039  vertex_index_map[vert_index] = vertex_count++;
1040  }
1041  vertex_uses += elem.node_count();
1042  }
1043 
1044  // Allocate storage in subpatch
1045  subpatch.vertexHandlesArray.resize( vertex_count );
1046  subpatch.elementArray.resize( num_elems );
1047  subpatch.elementHandlesArray.resize( num_elems );
1048  subpatch.elemConnectivityArray.resize( vertex_uses );
1049 
1050  // For now, put reverse of index map into handles array (such that
1051  // the handles array in the subpatch contains the index in this
1052  // patch for each vertex.) When PatchData::initalize_data re-orders
1053  // the vertices, we can then use this array to determine which vertices
1054  // where placed where.
1055  msq_std::map<size_t,size_t>::iterator iter;
1056  for (iter = vertex_index_map.begin(); iter != vertex_index_map.end(); ++iter)
1057  subpatch.vertexHandlesArray[iter->second] = (Mesh::VertexHandle)(iter->first);
1058 
1059  // Store elements with updated connectivity list in subpatch
1060  msq_std::vector<size_t> elem_conn_offsets(vertex_uses);
1061  size_t* elem_connectivity = &(subpatch.elemConnectivityArray[0]);
1062  size_t elem_conn_index = 0;
1063  for (which_elem = 0; which_elem < num_elems; ++which_elem)
1064  {
1065  size_t elem_index = vertex_adjacencies[which_elem];
1066  MsqMeshEntity& elem = elementArray[elem_index];
1067  elem_conn_offsets[which_elem] = elem_conn_index;
1068  for (which_vert = 0; which_vert < elem.node_count(); which_vert++ )
1069  {
1070  size_t vert_index = elem.get_vertex_index(which_vert);
1071 
1072  // Add this vertex to the new element's array
1073  elem_connectivity[elem_conn_index++] = vertex_index_map[vert_index];
1074  }
1075  subpatch.elementArray[which_elem].set_element_type( elem.get_element_type() );
1076  }
1077 
1078  // Re-order vertices and initialize other data in subpatch
1079  subpatch.initialize_data( &elem_conn_offsets[0], err ); MSQ_ERRRTN(err);
1080 
1081  // Copy vertex data into subpatch. subpatch.vertexHandlesArray contains
1082  // the indices into this PatchData for each vertex
1083  subpatch.vertexArray.resize( vertex_count );
1084  for (which_vert = 0; which_vert < vertex_count; ++which_vert)
1085  {
1086  size_t vert_index = (size_t)(subpatch.vertexHandlesArray[which_vert]);
1087  subpatch.vertexHandlesArray[which_vert] = vertexHandlesArray[vert_index];
1088  subpatch.vertexArray[which_vert] = vertexArray[vert_index];
1089  }
1090 }
PatchDataMem< MsqVertex > vertexArray
EntityHandle VertexHandle
invalid function argument passed
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
size_t num_vertices() const
number of vertices in the patch.
PatchDataMem< MsqMeshEntity > elementArray
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
size_t * get_vertex_element_adjacencies(size_t vertex_index, size_t &array_len_out, MsqError &err)
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void get_subpatch ( size_t  center_vertex_index,
PatchData pd_to_fill,
MsqError err 
)

Fills a PatchData with the elements attached to a center vertex.

Note that all entities in the sub-patch are copies of the entities in 'this' patch. As such, moving a vertex in the sub-patch won't move the corresponding vertex in the source patch. Also, calling 'update_mesh()' on the sub-patch WILL modify the TSTT mesh, but the source patch won't see the changes.

const MsqVertex * get_vertex_array ( MsqError err) const
inline

Returns a pointer to the start of the vertex array.

Returns an array of all vertices in the PatchData.

Definition at line 513 of file includeLinks/PatchData.hpp.

References MsqError::INVALID_STATE, MSQ_SETERR, and PatchData::vertexArray.

Referenced by TerminationCriterion::accumulate_patch(), Mesquite::centroid_smooth_mesh(), LPtoPTemplate::compute_analytical_gradient(), LPtoPTemplate::compute_analytical_hessian(), LocalSizeQualityMetric::compute_corner_area(), MsqMeshEntity::compute_corner_matrices(), LocalSizeQualityMetric::compute_corner_volume(), RI_DFT::compute_element_analytical_gradient(), IdealWeightInverseMeanRatio::compute_element_analytical_gradient(), IdealWeightMeanRatio::compute_element_analytical_gradient(), I_DFT::compute_element_analytical_gradient(), RI_DFT::compute_element_analytical_hessian(), IdealWeightInverseMeanRatio::compute_element_analytical_hessian(), IdealWeightMeanRatio::compute_element_analytical_hessian(), I_DFT::compute_element_analytical_hessian(), ObjectiveFunction::compute_numerical_gradient(), MsqMeshEntity::compute_signed_area(), MsqMeshEntity::compute_signed_volume(), MsqMeshEntity::compute_unsigned_area(), MsqMeshEntity::compute_unsigned_volume(), MsqMeshEntity::compute_weighted_jacobian(), LInfTemplate::concrete_evaluate(), MaxTemplate::concrete_evaluate(), LPtoPTemplate::concrete_evaluate(), ConditionNumberQualityMetric::evaluate_element(), RI_DFT::evaluate_element(), UntangleBetaQualityMetric::evaluate_element(), IdealWeightInverseMeanRatio::evaluate_element(), IdealWeightMeanRatio::evaluate_element(), I_DFT::evaluate_element(), VertexConditionNumberQualityMetric::evaluate_vertex(), EdgeLengthQualityMetric::evaluate_vertex(), EdgeLengthRangeQualityMetric::evaluate_vertex(), MsqMeshEntity::get_centroid(), MeshSet::get_next_elem_on_vert_patch(), MeshSet::get_next_global_patch(), MeshTransform::loop_over_mesh(), MsqFreeVertexIndexIterator::MsqFreeVertexIndexIterator(), SmartLaplacianSmoother::optimize_vertex_positions(), Randomize::optimize_vertex_positions(), ConjugateGradient::optimize_vertex_positions(), SteepestDescent::optimize_vertex_positions(), FeasibleNewton::optimize_vertex_positions(), NonSmoothSteepestDescent::optimize_vertex_positions(), and Randomize::randomize_vertex().

514  {
515  if (vertexArray.empty())
516  MSQ_SETERR(err)( "No vertex array defined", MsqError::INVALID_STATE );
517  return &vertexArray[0];
518  }
PatchDataMem< MsqVertex > vertexArray
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
object is in an invalid state

Here is the caller graph for this function:

const MsqVertex* get_vertex_array ( MsqError err) const

Returns a pointer to the start of the vertex array.

MsqVertex* get_vertex_array ( MsqError err)
MsqVertex * get_vertex_array ( MsqError err)
inline

Definition at line 519 of file includeLinks/PatchData.hpp.

References MsqError::INVALID_STATE, MSQ_SETERR, and PatchData::vertexArray.

520  {
521  if (vertexArray.empty())
522  MSQ_SETERR(err)( "No vertex array defined", MsqError::INVALID_STATE );
523  return &vertexArray[0];
524  }
PatchDataMem< MsqVertex > vertexArray
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
object is in an invalid state
size_t* get_vertex_element_adjacencies ( size_t  vertex_index,
size_t &  array_len_out,
MsqError err 
)

Get indices of elements attached to specified vertex

size_t * get_vertex_element_adjacencies ( size_t  vertex_index,
size_t &  array_len_out,
MsqError err 
)

Get indices of elements attached to specified vertex

Definition at line 778 of file Mesh/PatchData.cpp.

References PatchDataMem< X >::empty(), PatchData::generate_vertex_to_element_data(), PatchData::vertAdjacencyArray, and PatchData::vertAdjacencyOffsets.

Referenced by VertexConditionNumberQualityMetric::evaluate_vertex(), LocalSizeQualityMetric::evaluate_vertex(), PatchData::get_subpatch(), and MeanMidNodeMover::loop_over_mesh().

781 {
782  // Make sure we've got the data
784  {
786  }
787 
788  const size_t begin = vertAdjacencyOffsets[vertex_index];
789  const size_t end = vertAdjacencyOffsets[vertex_index+1];
790  array_len_out = end - begin;
791  return &vertAdjacencyArray[begin];
792 }
void generate_vertex_to_element_data()
PatchDataMem< size_t > vertAdjacencyOffsets
PatchDataMem< size_t > vertAdjacencyArray

Here is the call graph for this function:

Here is the caller graph for this function:

void get_vertex_element_indices ( size_t  vertex_index,
msq_std::vector< size_t > &  elem_indices,
MsqError err 
)

Get the indices of the elements attached to the specified vertex.

void get_vertex_element_indices ( size_t  vertex_index,
msq_std::vector< size_t > &  elem_indices,
MsqError err 
)

Get the indices of the elements attached to the specified vertex.

size_t get_vertex_index ( MsqVertex vertex)
bool have_computed_info ( ComputedInfo  info) const
inline

Definition at line 118 of file includeLinks/PatchData.hpp.

References PatchData::haveComputedInfos, and cimg_library::cimg::info().

Referenced by PatchData::get_average_Lambda_3d(), PatchData::get_barrier_delta(), PatchData::get_minmax_element_unsigned_area(), and Mesquite::operator<<().

119  { return 0 != (haveComputedInfos&(1<<info)); }
void info()
Print informations about CImg environement variables.
Definition: CImg.h:5702

Here is the call graph for this function:

Here is the caller graph for this function:

bool have_computed_info ( ComputedInfo  info) const
inline

Definition at line 118 of file src/Mesh/PatchData.hpp.

References PatchData::haveComputedInfos, and cimg_library::cimg::info().

119  { return 0 != (haveComputedInfos&(1<<info)); }
void info()
Print informations about CImg environement variables.
Definition: CImg.h:5702

Here is the call graph for this function:

void initialize_data ( size_t *  elem_offset_array,
MsqError err 
)

Call after filling vertex handle and connectivity arrays to finish initializing the PatchData.

Reorders vertex handles array such that all higher-order nodes are at end of array, updates element connectivity array appropriately, initalizes numCornerVertices, and per-element vertex and node counts.

NOTE: If the patch contains higher-order elements, this function will re-order the nodes in the vertex array. Do NOT assume vertex indices are the same after calling this function!

NOTE: This function expects the following data to be initalized: vertexHandlesArray elemConnectivityArray the topology type for all elements in elementArray The function assumes the following data has not been initialized and therefore does not need to be updated: vertexArray

Parameters
elem_offset_arrayOffset into connectivity array for each element
void initialize_data ( size_t *  elem_offset_array,
MsqError err 
)

Call after filling vertex handle and connectivity arrays to finish initializing the PatchData.

Reorders vertex handles array such that all higher-order nodes are at end of array, updates element connectivity array appropriately, initalizes numCornerVertices, and per-element vertex and node counts.

NOTE: If the patch contains higher-order elements, this function will re-order the nodes in the vertex array. Do NOT assume vertex indices are the same after calling this function!

NOTE: This function expects the following data to be initalized: vertexHandlesArray elemConnectivityArray the topology type for all elements in elementArray The function assumes the following data has not been initialized and therefore does not need to be updated: vertexArray

Parameters
elem_offset_arrayOffset into connectivity array for each element

Definition at line 1354 of file Mesh/PatchData.cpp.

References PatchDataMem< X >::clear(), PatchData::clear_tag_data(), PatchData::domainHint, PatchData::elemConnectivityArray, PatchData::elementArray, MsqMeshEntity::get_vertex_index_array(), i, MsqError::INVALID_STATE, j, MSQ_SETERR, MsqMeshEntity::node_count(), PatchData::num_nodes(), PatchData::num_vertices(), PatchData::numCornerVertices, Mesquite::PLANAR_DOMAIN, PatchDataMem< X >::resize(), PatchDataMem< X >::size(), swap(), PatchData::vertAdjacencyArray, PatchData::vertAdjacencyOffsets, MsqMeshEntity::vertex_count(), PatchData::vertexHandlesArray, and PatchData::vertexNormals.

Referenced by MeshSet::get_next_elem_on_vert_patch(), MeshSet::get_next_global_patch(), and PatchData::get_subpatch().

1355 {
1356  if (numCornerVertices)
1357  {
1359  return;
1360  }
1361 
1362  // Clear out data specific to patch
1363  clear_tag_data();
1364  if (domainHint != PLANAR_DOMAIN)
1365  vertexNormals.clear();
1366 
1367  // Clear any vertex->element adjacency data. It
1368  // is probably invalid, and certainly will be by the time
1369  // this function completes if the mesh contains higher-order
1370  // elements.
1373 
1374  // Initialize connectivity data in each element
1375  size_t i, j;
1376  bool higher_order = false;
1377  for (i = 0; i < elementArray.size(); ++i)
1378  {
1379  size_t start = elem_offset_array[i];
1380  size_t conn_len = elem_offset_array[i+1] - start;
1381  assert(conn_len > 0);
1382  elementArray[i].set_connectivity( &elemConnectivityArray[start], conn_len );
1383  if (conn_len != elementArray[i].vertex_count())
1384  higher_order = true;
1385  }
1386 
1387  // If no higher-order elements, then we're done
1388  if (!higher_order)
1389  {
1390  // All nodes are corner vertices
1392  return;
1393  }
1394 
1395  // Need to move higher-order nodes to end of list.
1396 
1397  // Use vertAdjacencyOffsets array as temporary storage.
1399  size_t* vertex_index_map = &vertAdjacencyOffsets[0];
1400 
1401  // Note which are mid-nodes (1) and which are corner vertices (0)
1402  for (i = 0; i < elementArray.size(); ++i)
1403  {
1404  MsqMeshEntity& elem = elementArray[i];
1405  size_t* conn_array = elem.get_vertex_index_array();
1406  size_t num_vertices = elem.vertex_count();
1407  size_t num_nodes = elem.node_count();
1408  for (j = 0; j < num_vertices; ++j)
1409  vertex_index_map[ conn_array[j] ] = 0;
1410  for ( ; j < num_nodes; ++j)
1411  vertex_index_map[ conn_array[j] ] = 1;
1412  }
1413 
1414  // Shuffle nodes around such that all higher-order nodes
1415  // are at the end of the array.
1416  // Store new index for each node in index_map, replacing
1417  // flag value currently there for each node.
1418  i = 0;
1419  j = vertexHandlesArray.size() - 1;
1420  while (i < j)
1421  {
1422  if (!vertex_index_map[i])
1423  {
1424  // Is a corner vertex in first part of array, skip it.
1425  vertex_index_map[i] = i;
1426  ++i;
1427  }
1428  else if (vertex_index_map[j])
1429  {
1430  // Is a mid-node in latter part of array, skip it
1431  vertex_index_map[j] = j;
1432  --j;
1433  }
1434  else
1435  {
1436  // Swap mid-node from first part of array with
1437  // corner vertex from latter part of array.
1439 
1440  vertex_index_map[i] = j;
1441  vertex_index_map[j] = i;
1442  ++i;
1443  --j;
1444  }
1445  }
1446 
1447  // Finish up - set numCornerVertices to indicate
1448  // where corner vertices end and mid-nodes begin in
1449  // vertexArray, and get the handle remaining vertex
1450  // if missed in the above loop.
1451  if (i > j)
1452  {
1453  numCornerVertices = i;
1454  }
1455  else // (i == j)
1456  {
1457  if (vertex_index_map[i])
1458  numCornerVertices = i;
1459  else
1460  numCornerVertices = i+1;
1461  vertex_index_map[i] = i;
1462  }
1463 
1464  // Update element connectivity data for new vertex indices
1465  for (i = 0; i < elemConnectivityArray.size(); ++i)
1466  elemConnectivityArray[i] = vertex_index_map[elemConnectivityArray[i]];
1467 
1469 }
void swap(int &a, int &b)
Definition: buildface.cpp:88
PatchDataMem< size_t > elemConnectivityArray
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)
PatchDataMem< Vector3D > vertexNormals
size_t num_vertices() const
number of vertices in the patch.
PatchDataMem< size_t > vertAdjacencyOffsets
PatchDataMem< MsqMeshEntity > elementArray
j indices j
Definition: Indexing.h:6
object is in an invalid state
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
PatchDataMem< size_t > vertAdjacencyArray

Here is the call graph for this function:

Here is the caller graph for this function:

void move_free_vertices_constrained ( Vector3D  dk[],
size_t  nb_vtx,
double  step_size,
MsqError err 
)

Moves free vertices and then snaps the free vertices to the domain.

void move_free_vertices_constrained ( Vector3D  dk[],
size_t  nb_vtx,
double  step_size,
MsqError err 
)

Moves free vertices and then snaps the free vertices to the domain.

Definition at line 580 of file Mesh/PatchData.cpp.

References MsqError::INVALID_ARG, MSQ_DBG, MSQ_DBGOUT, MSQ_ERRRTN, MSQ_SETERR, MsqFreeVertexIndexIterator::next(), PatchData::num_vertices(), MsqFreeVertexIndexIterator::reset(), PatchData::snap_vertex_to_domain(), MsqFreeVertexIndexIterator::value(), and PatchData::vertexArray.

Referenced by SteepestDescent::optimize_vertex_positions(), and FeasibleNewton::optimize_vertex_positions().

582 {
583  if (nb_vtx != num_vertices())
584  {
585  MSQ_SETERR(err)("The directional vector must be of length numVertices.",
587  return;
588  }
589 
590  MsqFreeVertexIndexIterator free_iter(this, err);
591  free_iter.reset();
592  while (free_iter.next())
593  {
594  vertexArray[free_iter.value()] += (step_size * dk[free_iter.value()]);
595  snap_vertex_to_domain(free_iter.value(), err);
596  MSQ_ERRRTN(err);
597  }
598 
599  // Checks that moving direction is zero for fixed vertices.
600  if (MSQ_DBG(3)) {
601  for (size_t m=0; m<num_vertices(); ++m) {
602  Vector3D zero_3d(0.,0.,0.);
603  if (!vertexArray[m].is_free_vertex()
604  && dk[m] != zero_3d
605  && dk[m] != -zero_3d )
606  {
607  MSQ_DBGOUT(3) << "dk["<<m<<"]: " << dk[m] << endl;
608  MSQ_DBGOUT(3) << "moving a fixed vertex." << endl;
609  }
610  }
611  }
612 }
#define MSQ_DBG(flag)
Check if a debug flag is activated - evaluates to a bool.
PatchDataMem< MsqVertex > vertexArray
invalid function argument passed
NVec< 3, double > Vector3D
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
void snap_vertex_to_domain(size_t vertex_index, MsqError &err)
Adjust the position of the specified vertex so that it lies on its constraining domain.
size_t num_vertices() const
number of vertices in the patch.
#define MSQ_DBGOUT(flag)
Check debug flag and return ostream associated with flag.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void note_have_info ( ComputedInfo  info)
inlineprivate

Definition at line 436 of file src/Mesh/PatchData.hpp.

References PatchData::haveComputedInfos, and cimg_library::cimg::info().

437  { haveComputedInfos |= (1<<info); }
void info()
Print informations about CImg environement variables.
Definition: CImg.h:5702

Here is the call graph for this function:

void note_have_info ( ComputedInfo  info)
inlineprivate

Definition at line 436 of file includeLinks/PatchData.hpp.

References PatchData::haveComputedInfos, and cimg_library::cimg::info().

Referenced by PatchData::get_average_Lambda_3d(), PatchData::get_barrier_delta(), and PatchData::get_minmax_element_unsigned_area().

437  { haveComputedInfos |= (1<<info); }
void info()
Print informations about CImg environement variables.
Definition: CImg.h:5702

Here is the call graph for this function:

Here is the caller graph for this function:

size_t num_corners ( )

number of elements corners in the Patch.

size_t num_corners ( )

number of elements corners in the Patch.

Definition at line 1491 of file Mesh/PatchData.cpp.

References PatchData::elementArray, and i.

1492 {
1493  size_t result = 0;
1494  for (unsigned i = 0; i < elementArray.size(); ++i)
1495  result += elementArray[i].vertex_count();
1496  return result;
1497 }
blockLoc i
Definition: read.cpp:79
PatchDataMem< MsqMeshEntity > elementArray
size_t num_elements ( ) const
inline

number of elements in the Patch.

Definition at line 179 of file src/Mesh/PatchData.hpp.

References PatchData::elementArray.

180  { return elementArray.size(); }
PatchDataMem< MsqMeshEntity > elementArray
unsigned num_free_nodes ( MsqError err) const

Definition at line 470 of file Mesh/PatchData.cpp.

References i, PatchData::num_nodes(), and PatchData::vertexArray.

471 {
472  unsigned result = 0;
473  size_t count = num_nodes();
474  for (size_t i = 0; i < count; ++i)
475  if (vertexArray[i].is_free_vertex())
476  ++result;
477  return result;
478 }
PatchDataMem< MsqVertex > vertexArray
blockLoc i
Definition: read.cpp:79
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)

Here is the call graph for this function:

unsigned num_free_nodes ( MsqError err) const
int num_free_vertices ( MsqError err) const

Returns the number of elements in the current patch who are free to move.

This is a costly function, since we have to check the flags of all vertices in the patch.

int num_free_vertices ( MsqError err) const

Returns the number of elements in the current patch who are free to move.

This is a costly function, since we have to check the flags of all vertices in the patch.

Definition at line 458 of file Mesh/PatchData.cpp.

References i, PatchData::num_vertices(), and PatchData::vertexArray.

Referenced by ConjugateGradient::optimize_vertex_positions(), SteepestDescent::optimize_vertex_positions(), FeasibleNewton::optimize_vertex_positions(), and NonSmoothSteepestDescent::optimize_vertex_positions().

459 {
460  int num_free_vertices=0;
461 
462  size_t count = num_vertices();
463  for (size_t i = 0; i < count; ++i)
464  if (vertexArray[i].is_free_vertex())
466 
467  return num_free_vertices;
468 }
PatchDataMem< MsqVertex > vertexArray
int num_free_vertices(MsqError &err) const
Returns the number of elements in the current patch who are free to move.
blockLoc i
Definition: read.cpp:79
size_t num_vertices() const
number of vertices in the patch.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t num_nodes ( ) const
inline

Get number of nodes (vertex + higher-order nodes)

Definition at line 184 of file src/Mesh/PatchData.hpp.

References PatchData::vertexArray.

185  { return vertexArray.size(); }
PatchDataMem< MsqVertex > vertexArray
size_t num_vertices ( ) const
inline

number of vertices in the patch.

Definition at line 176 of file src/Mesh/PatchData.hpp.

References PatchData::numCornerVertices.

size_t num_vertices ( ) const
inline

number of vertices in the patch.

Definition at line 176 of file includeLinks/PatchData.hpp.

References PatchData::numCornerVertices.

Referenced by TerminationCriterion::accumulate_inner(), TerminationCriterion::accumulate_patch(), CompositeOFMultiply::compute_analytical_gradient(), CompositeOFAdd::compute_analytical_gradient(), CompositeOFScalarMultiply::compute_analytical_gradient(), LPtoPTemplate::compute_analytical_gradient(), LPtoPTemplate::compute_analytical_hessian(), ObjectiveFunction::compute_numerical_gradient(), TargetCalculator::compute_reference_corner_matrices(), WTargetCalculator::compute_target_matrices(), LVQDTargetCalculator::compute_target_matrices(), LInfTemplate::concrete_evaluate(), MaxTemplate::concrete_evaluate(), LPtoPTemplate::concrete_evaluate(), PatchData::create_vertices_memento(), ConjugateGradient::get_step(), PatchData::get_subpatch(), MsqHessian::initialize(), PatchData::initialize_data(), MeanMidNodeMover::loop_over_mesh(), MeshTransform::loop_over_mesh(), QualityAssessor::loop_over_mesh(), PatchData::move_free_vertices_constrained(), MsqFreeVertexIndexIterator::next(), PatchData::num_free_vertices(), Mesquite::operator<<(), Randomize::optimize_vertex_positions(), ConjugateGradient::optimize_vertex_positions(), SteepestDescent::optimize_vertex_positions(), FeasibleNewton::optimize_vertex_positions(), NonSmoothSteepestDescent::optimize_vertex_positions(), PatchData::recreate_vertices_memento(), PatchData::reorder(), TerminationCriterion::reset_inner(), PatchData::set_all_vertices_soft_fixed(), PatchData::set_all_vertices_soft_free(), PatchData::set_free_vertices_constrained(), PatchData::set_free_vertices_soft_fixed(), PatchData::set_to_vertices_memento(), and PatchData::update_cached_normals().

Here is the caller graph for this function:

PatchData& operator= ( const PatchData pd)
private

Doesn't allow a PatchData object to be assigned to another.

Mementos such as PatchDataVerticesMemento should be used when necessary.

PatchData& operator= ( const PatchData pd)
private

Doesn't allow a PatchData object to be assigned to another.

Mementos such as PatchDataVerticesMemento should be used when necessary.

void recreate_vertices_memento ( PatchDataVerticesMemento memento,
MsqError err,
bool  include_higher_order = false 
)
inline

reinstantiates a memento to holds the current state of the PatchData coordinates.

Improves memory management.

Definition at line 640 of file includeLinks/PatchData.hpp.

References PatchDataVerticesMemento::arraySize, PatchData::num_nodes(), PatchData::num_vertices(), PatchDataVerticesMemento::numVertices, PatchDataVerticesMemento::originator, PatchData::vertexArray, and PatchDataVerticesMemento::vertices.

Referenced by TerminationCriterion::accumulate_patch(), ConjugateGradient::get_step(), FeasibleNewton::optimize_vertex_positions(), TerminationCriterion::reset_inner(), and TerminationCriterion::reset_patch().

643  {
644  size_t num_verts = include_higher_order ? num_nodes() : num_vertices();
645  memento->originator = this;
646 
647  if ( num_verts > memento->arraySize
648  || num_verts < memento->arraySize/10)
649  {
650  delete[] memento->vertices;
651  // Allocate the new array
652  memento->vertices = new MsqVertex[num_verts];
653  memento->arraySize = num_verts;
654  }
655 
656  // Copy the coordinates
657  msq_stdc::memcpy(memento->vertices, &vertexArray[0],num_verts*sizeof(MsqVertex) );
658 
659  memento->numVertices = num_verts;
660  }
PatchDataMem< MsqVertex > vertexArray
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)
size_t num_vertices() const
number of vertices in the patch.

Here is the call graph for this function:

Here is the caller graph for this function:

void recreate_vertices_memento ( PatchDataVerticesMemento memento,
MsqError err,
bool  include_higher_order = false 
)

reinstantiates a memento to holds the current state of the PatchData coordinates.

Improves memory management.

void reorder ( )

Reorders the mesh data.

Physically reorder the vertices and elements in the PatchData to improve the locality of reference. This method implements a Reverse Breadth First Search order starting with the vertex furthest from the origin. Other orderings can also be implemented.

Definition at line 196 of file Mesh/PatchData.cpp.

References PatchDataMem< X >::clear(), PatchData::clear_tag_data(), PatchData::domainHint, PatchData::elementArray, PatchData::elementHandlesArray, PatchData::generate_vertex_to_element_data(), i, j, max(), PatchData::num_elements(), PatchData::num_vertices(), Mesquite::PLANAR_DOMAIN, q, PatchDataMem< X >::size(), PatchData::vertAdjacencyArray, PatchData::vertAdjacencyOffsets, PatchData::vertexArray, PatchData::vertexHandlesArray, and PatchData::vertexNormals.

Referenced by FeasibleNewton::initialize_mesh_iteration().

197 {
198  const size_t numv = num_vertices();
199  const size_t nume = num_elements();
200 
201  size_t *vtx;
202  size_t *tmp;
203 
204  size_t *sta = new size_t[numv + 1];
205  size_t *vte;
206  size_t *ord = new size_t[numv];
207  size_t *per = new size_t[numv];
208  size_t *pel;
209  size_t *que1 = new size_t[numv];
210  size_t *que2 = new size_t[numv];
211 
212  //MsqVertex *v2a;
213  //Mesh::VertexHandle *v2h;
214  //MsqMeshEntity *e2a;
215  //Mesh::ElementHandle *e2h;
216  // Copy arrays so higher-order nodes get copied
217  PatchDataMem<MsqVertex> v2a( vertexArray );
218  PatchDataMem<Mesh::VertexHandle> v2h( vertexHandlesArray );
219  PatchDataMem<MsqMeshEntity> e2a( elementArray.size() );
220  PatchDataMem<Mesh::ElementHandle> e2h( elementHandlesArray.size() );
221 
222  double val, max;
223 
224  size_t toc;
225  size_t vtc;
226  size_t idx;
227  size_t loc;
228  size_t i, j;
229  size_t q1l, q2l, q;
230  size_t st, en;
231 
232  // Step -1: Clear any data that will be invalidated by this
233  clear_tag_data();
234 
235  // Step 0: Make sure patch data is valid.
236 
237  // Step 1: Find the length of the element to vertex list for each
238  // individual vertex.
239 
240  memset(sta, 0, (numv+1)*sizeof(size_t));
241  for (i = 0; i < nume; ++i) {
242  vtc = elementArray[i].vertex_count();
243  vtx = elementArray[i].get_vertex_index_array();
244 
245  for (j = 0; j < vtc; ++j) {
246  ++sta[vtx[j]];
247  }
248  }
249 
250  // Step 2: Compute the offsets, total length of the element to vertex
251  // list, and allocate the data.
252 
253  toc = sta[0];
254  sta[0] = 0;
255  for (i = 1; i <= numv; ++i) {
256  j = sta[i];
257  sta[i] = toc;
258  toc += j;
259  }
260 
261  vte = new size_t[toc];
262 
263  // Step 3: Finish constructing the vertex to element list.
264 
265  for (i = 0; i < nume; ++i) {
266  vtc = elementArray[i].vertex_count();
267  vtx = elementArray[i].get_vertex_index_array();
268 
269  for (j = 0; j < vtc; ++j) {
270  vte[sta[vtx[j]]++] = i;
271  }
272  }
273 
274  for (i = numv; i > 0; --i) {
275  sta[i] = sta[i-1];
276  }
277  sta[i] = 0;
278 
279  // Step 4: Begin the reodering by computing the vertex furthest from the
280  // origin.
281 
282  max = -1.0;
283  idx = 0;
284 
285  for (i = 0; i < numv; ++i) {
286  val = vertexArray[i].length_squared();
287  if (val > max) {
288  max = val;
289  idx = i+1;
290  }
291  }
292 
293  // Step 5: Perform a breadth first search to find the ordering.
294 
295  memset(per, 0, numv*sizeof(size_t));
296 
297  loc = 0;
298  while (idx > 0) {
299  // The vertex referenced by idx has not been visited yet. Insert it
300  // into the queue for processing.
301  --idx;
302 
303  q1l = 1;
304  que1[0] = idx;
305  per[idx] = 1;
306 
307  while (q1l) {
308  q = 0;
309  q2l = 0;
310 
311  while (q < q1l) {
312  idx = que1[q++];
313  ord[loc++] = idx;
314 
315  st = sta[idx];
316  en = sta[idx+1];
317  while (st < en) {
318  vtc = elementArray[vte[st]].vertex_count();
319  vtx = elementArray[vte[st]].get_vertex_index_array();
320  ++st;
321 
322  for (j = 0; j < vtc; ++j) {
323  idx = vtx[j];
324  if (!per[idx]) {
325  que2[q2l++] = idx;
326  per[idx] = 1;
327  }
328  }
329  }
330  }
331 
332  q1l = q2l;
333 
334  tmp = que1;
335  que1 = que2;
336  que2 = tmp;
337  }
338 
339  if (loc >= numv) {
340  break;
341  }
342 
343  // The mesh is not connected. There is another piece with some vertices
344  // remaining. Repeat the breadth-first search algorithm on the new
345  // mesh component.
346 
347  max = -1.0;
348  idx = 0;
349  for (i = 0; i < numv; ++i) {
350  if (!per[i]) {
351  val = vertexArray[i].length_squared();
352  if (val > max) {
353  max = val;
354  idx = i+1;
355  }
356  }
357  }
358  }
359 
360  delete[] que1;
361  delete[] que2;
362 
363  // Step 6: Compute the permutation vectors
364 
365  pel = new size_t[nume];
366  for (i = 0; i < nume; ++i) {
367  pel[i] = nume;
368  }
369 
370  toc = 0;
371  for (i = 0; i < numv; ++i) {
372  loc = ord[numv-1-i];
373 
374  per[loc] = i;
375 
376  st = sta[loc];
377  en = sta[loc+1];
378  while (st < en) {
379  loc = vte[st++];
380  if (nume == pel[loc]) {
381  pel[loc] = toc++;
382  }
383  }
384  }
385 
386  delete[] ord;
387  delete[] vte;
388  delete[] sta;
389 
390  // Step 7: Permute the vertices
391 
392  //v2a = new MsqVertex[vertexArraySize];
393  //v2h = new Mesh::VertexHandle[vertexArraySize];
394 
395  for (i = 0; i < numv; ++i) {
396  loc = per[i];
397  v2a[loc] = vertexArray[i];
398  v2h[loc] = vertexHandlesArray[i];
399  }
400 
401  if (!vertexNormals.empty() && domainHint != PLANAR_DOMAIN) {
402  PatchDataMem<Vector3D> v2n(numv);
403  for (i = 0; i < numv; ++i) {
404  loc = per[i];
405  v2n[loc] = vertexNormals[i];
406  }
407  vertexNormals = v2n;
408  }
409 
410  //delete[] vertexArray;
411  //delete[] vertexHandlesArray;
412 
413  vertexArray = v2a;
414  vertexHandlesArray = v2h;
415 
416  // Step 8: Permute the elements and vertex indices for the elements
417 
418  //e2a = new MsqMeshEntity[elemArraySize];
419  //e2h = new Mesh::ElementHandle[elemArraySize];
420 
421  for (i = 0; i < nume; ++i) {
422  vtc = elementArray[i].vertex_count();
423  vtx = elementArray[i].get_vertex_index_array();
424 
425  for (j = 0; j < vtc; ++j) {
426  vtx[j] = per[vtx[j]];
427  }
428 
429  loc = pel[i];
430  e2a[loc] = elementArray[i];
431  e2h[loc] = elementHandlesArray[i];
432  }
433 
434  //delete[] elementArray;
435  //delete[] elementHandlesArray;
436 
437  elementArray = e2a;
438  elementHandlesArray = e2h;
439 
440  // Step 9: Finish by deleting allocated memory
441 
442  delete[] per;
443  delete[] pel;
444 
445  // Step 10: Recompute vertex to element mapping if it existed.
446 
447  if (vertAdjacencyOffsets.size()) {
451  }
452  return;
453 }
PatchDataMem< MsqVertex > vertexArray
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
void generate_vertex_to_element_data()
size_t num_elements() const
number of elements in the Patch.
blockLoc i
Definition: read.cpp:79
PatchDataMem< Vector3D > vertexNormals
size_t num_vertices() const
number of vertices in the patch.
PatchDataMem< size_t > vertAdjacencyOffsets
PatchDataMem< MsqMeshEntity > elementArray
j indices j
Definition: Indexing.h:6
NT q
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
PatchDataMem< size_t > vertAdjacencyArray

Here is the call graph for this function:

Here is the caller graph for this function:

void reorder ( )

Reorders the mesh data.

void set_all_vertices_soft_fixed ( MsqError err)

Add a soft_fixed flag to all vertices in the patch.

Definition at line 704 of file Mesh/PatchData.cpp.

References i, PatchData::num_vertices(), and PatchData::vertexArray.

705 {
706  for(size_t i=0;i<num_vertices();++i)
707  vertexArray[i].set_soft_fixed_flag();
708 }
PatchDataMem< MsqVertex > vertexArray
blockLoc i
Definition: read.cpp:79
size_t num_vertices() const
number of vertices in the patch.

Here is the call graph for this function:

void set_all_vertices_soft_fixed ( MsqError err)

Add a soft_fixed flag to all vertices in the patch.

void set_all_vertices_soft_free ( MsqError err)

Remove the soft_fixed flag from all vertices in the patch.

Definition at line 722 of file Mesh/PatchData.cpp.

References i, PatchData::num_vertices(), and PatchData::vertexArray.

Referenced by TerminationCriterion::cull_vertices().

723  {
724  for(size_t i=0;i<num_vertices();++i)
725  vertexArray[i].remove_soft_fixed_flag();
726  }
PatchDataMem< MsqVertex > vertexArray
blockLoc i
Definition: read.cpp:79
size_t num_vertices() const
number of vertices in the patch.

Here is the call graph for this function:

Here is the caller graph for this function:

void set_all_vertices_soft_free ( MsqError err)

Remove the soft_fixed flag from all vertices in the patch.

void set_free_vertices_constrained ( PatchDataVerticesMemento memento,
Vector3D  dk[],
size_t  nb_vtx,
double  step_size,
MsqError err 
)

Moves free vertices from a memento position along a certain direction and then snaps the free vertices to the domain.

Parameters
dkan array of directions, ordered like the vertices in the PatchData.
nb_vtxnumber of vertices.
step_sizea scalar that multiplies the vectors given in dk.
void set_free_vertices_constrained ( PatchDataVerticesMemento memento,
Vector3D  dk[],
size_t  nb_vtx,
double  step_size,
MsqError err 
)

Moves free vertices from a memento position along a certain direction and then snaps the free vertices to the domain.

Parameters
dkan array of directions, ordered like the vertices in the PatchData.
nb_vtxnumber of vertices.
step_sizea scalar that multiplies the vectors given in dk.
set_free_vertices_constrained is similar to 

PatchData::move_free_vertices_constrained() except the original vertex positions are those stored in the PatchDataVerticesMemento instead of the actual vertex position stored in the PatchData Vertex array. The final location is stored in the PatchData; the PatchDataVerticesMemento is unchanged.

Parameters
dk,:must be a [nb_vtx] array of Vector3D that contains the direction in which to move each vertex. Fixed vertices moving direction should be zero, although fixed vertices will not be moved regardless of their corresponding dk value.
nb_vtxis the number of vertices to move. must corresponds to the number of vertices in the PatchData.
step_sizewill multiply the moving direction given in dk for each vertex.

Definition at line 630 of file Mesh/PatchData.cpp.

References MsqError::INVALID_ARG, MSQ_DBG, MSQ_DBGOUT, MSQ_ERRRTN, MSQ_SETERR, MsqFreeVertexIndexIterator::next(), PatchData::num_vertices(), PatchDataVerticesMemento::numVertices, MsqFreeVertexIndexIterator::reset(), PatchData::snap_vertex_to_domain(), MsqFreeVertexIndexIterator::value(), PatchData::vertexArray, and PatchDataVerticesMemento::vertices.

Referenced by ConjugateGradient::get_step().

635 {
636  if (nb_vtx != memento->numVertices)
637  {
639  return;
640  }
641 
642  size_t m=0;
643  MsqFreeVertexIndexIterator free_iter(this, err);
644  MSQ_ERRRTN(err);
645  free_iter.reset();
646  while (free_iter.next())
647  {
648  m=free_iter.value();
649  vertexArray[m] = memento->vertices[m] + (step_size * dk[m]);
650  snap_vertex_to_domain(m, err);
651  MSQ_ERRRTN(err);
652  }
653 
654  // Checks that moving direction is zero for fixed vertices.
655  if (MSQ_DBG(3)) {
656  for (m=0; m<num_vertices(); ++m)
657  {
658  Vector3D zero_3d(0.,0.,0.);
659  if ( ! vertexArray[m].is_free_vertex()
660  && ( dk[m] != zero_3d && dk[m] != -zero_3d) )
661  {
662  MSQ_DBGOUT(3) << "dk["<<m<<"]: " << dk[m] << endl;
663  MSQ_DBGOUT(3) <<"moving a fixed vertex." << endl;
664  }
665  }
666  }
667 }
#define MSQ_DBG(flag)
Check if a debug flag is activated - evaluates to a bool.
PatchDataMem< MsqVertex > vertexArray
invalid function argument passed
NVec< 3, double > Vector3D
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
void snap_vertex_to_domain(size_t vertex_index, MsqError &err)
Adjust the position of the specified vertex so that it lies on its constraining domain.
size_t num_vertices() const
number of vertices in the patch.
#define MSQ_DBGOUT(flag)
Check debug flag and return ostream associated with flag.
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

void set_free_vertices_soft_fixed ( MsqError err)

Add a soft_fixed flag to all free vertices in the patch.

void set_free_vertices_soft_fixed ( MsqError err)

Add a soft_fixed flag to all free vertices in the patch.

Definition at line 712 of file Mesh/PatchData.cpp.

References i, PatchData::num_vertices(), and PatchData::vertexArray.

Referenced by TerminationCriterion::cull_vertices().

713 {
714  for(size_t i=0;i<num_vertices();++i){
715  if(vertexArray[i].is_free_vertex())
716  vertexArray[i].set_soft_fixed_flag();
717  }
718 }
PatchDataMem< MsqVertex > vertexArray
blockLoc i
Definition: read.cpp:79
size_t num_vertices() const
number of vertices in the patch.

Here is the call graph for this function:

Here is the caller graph for this function:

void set_mesh_set ( MeshSet ms)

Sets the originating meshSet.

This is normally done in MeshSet::get_next_patch(). This function is only for tests purposes.

Definition at line 1266 of file Mesh/PatchData.cpp.

References PatchData::domainSet, MeshSet::get_domain_constraint(), and PatchData::meshSet.

1267 { meshSet = ms;
1268  if (ms->get_domain_constraint()!=NULL) domainSet = true; }

Here is the call graph for this function:

void set_mesh_set ( MeshSet ms)

Sets the originating meshSet.

This is normally done in MeshSet::get_next_patch(). This function is only for tests purposes.

void set_to_vertices_memento ( PatchDataVerticesMemento memento,
MsqError err 
)
inline

Restore the PatchData coordinates to the state contained in the memento.

This function restores a PatchData object coordinates to a previous state hold in a PatchDataVerticesMemento object (see create_vertices_memento() ).

The function checks whether the memento originates from this particular PatchData object. The function does not destroy the memento object: this is the caller responsibility.

Definition at line 669 of file includeLinks/PatchData.hpp.

References MsqError::INVALID_ARG, MsqError::INVALID_STATE, MSQ_SETERR, PatchData::num_nodes(), PatchData::num_vertices(), PatchDataVerticesMemento::numVertices, PatchDataVerticesMemento::originator, PatchData::vertexArray, and PatchDataVerticesMemento::vertices.

Referenced by ConjugateGradient::get_step(), SteepestDescent::optimize_vertex_positions(), and FeasibleNewton::optimize_vertex_positions().

671  {
672  if (memento->originator != this)
673  {
674  MSQ_SETERR(err)("Memento may only be used to restore the PatchData "
675  "object from which it was created.",
677  return;
678  }
679 
680  if (memento->numVertices != num_vertices() &&
681  memento->numVertices != num_nodes())
682  {
683  MSQ_SETERR(err)("Unable to restore patch coordinates. Number of "
684  "vertices in PatchData has changed.",
686  return;
687  }
688 
689  // copies the memento array into the PatchData array.
690  msq_stdc::memcpy(&vertexArray[0], memento->vertices, memento->numVertices*sizeof(MsqVertex) );
691  }
PatchDataMem< MsqVertex > vertexArray
invalid function argument passed
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
size_t num_nodes() const
Get number of nodes (vertex + higher-order nodes)
size_t num_vertices() const
number of vertices in the patch.
object is in an invalid state

Here is the call graph for this function:

Here is the caller graph for this function:

void set_to_vertices_memento ( PatchDataVerticesMemento memento,
MsqError err 
)

Restore the PatchData coordinates to the state contained in the memento.

void set_vertex_coordinates ( const Vector3D coords,
size_t  index,
MsqError err 
)
void set_vertex_coordinates ( const Vector3D coords,
size_t  index,
MsqError err 
)
inline

set the coordinates of a vertex in the raw array

Definition at line 547 of file includeLinks/PatchData.hpp.

References MsqError::INVALID_ARG, MSQ_SETERR, and PatchData::vertexArray.

Referenced by MeanMidNodeMover::loop_over_mesh().

550  {
551  if (index >= vertexArray.size()) {
552  MSQ_SETERR(err)( "Index bigger than numVertices.", MsqError::INVALID_ARG );
553  return;
554  }
555 
556  vertexArray[index] = coords;
557  }
PatchDataMem< MsqVertex > vertexArray
invalid function argument passed
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.

Here is the caller graph for this function:

void snap_vertex_to_domain ( size_t  vertex_index,
MsqError err 
)

Adjust the position of the specified vertex so that it lies on its constraining domain. The actual domain constraint is managed by the MeshSet's MeshDomain object.

void snap_vertex_to_domain ( size_t  vertex_index,
MsqError err 
)

Adjust the position of the specified vertex so that it lies on its constraining domain.

Adjust the position of the specified vertex so that it lies on its constraining domain. The actual domain constraint is managed by the MeshSet's MeshDomain object.

The actual domain constraint is managed by the TSTT mesh implementation

Definition at line 1095 of file Mesh/PatchData.cpp.

References MeshDomain::closest_point(), PatchData::domainHint, MeshSet::get_domain_constraint(), PatchData::meshSet, MSQ_ERRRTN, Mesquite::SMOOTH_DOMAIN, MeshDomain::snap_to(), PatchData::vertexArray, PatchData::vertexHandlesArray, and PatchData::vertexNormals.

Referenced by MeanMidNodeMover::loop_over_mesh(), PatchData::move_free_vertices_constrained(), SmartLaplacianSmoother::optimize_vertex_positions(), LaplacianSmoother::optimize_vertex_positions(), Randomize::optimize_vertex_positions(), ConjugateGradient::optimize_vertex_positions(), and PatchData::set_free_vertices_constrained().

1096 {
1098  {
1099  if (domainHint == SMOOTH_DOMAIN && !vertexNormals.empty())
1100  {
1102  vertexHandlesArray[vertex_index],
1103  Vector3D(vertexArray[vertex_index]),
1104  vertexArray[vertex_index],
1105  vertexNormals[vertex_index],
1106  err ); MSQ_ERRRTN(err);
1107  }
1108  else
1109  {
1111  vertexArray[vertex_index]);
1112  }
1113  }
1114 }
PatchDataMem< MsqVertex > vertexArray
Mesquite::MeshDomain * get_domain_constraint()
Returns the domain associated with the MeshSet from which the Patch originates.
virtual void closest_point(Mesh::EntityHandle handle, const Vector3D &position, Vector3D &closest, Vector3D &normal, MsqError &err) const =0
evaluate closest point and normal
NVec< 3, double > Vector3D
virtual void snap_to(Mesh::EntityHandle entity_handle, Vector3D &coordinate) const =0
Modifies &quot;coordinate&quot; so that it lies on the domain to which &quot;entity_handle&quot; is constrained.
PatchDataMem< Vector3D > vertexNormals
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function.

Here is the call graph for this function:

Here is the caller graph for this function:

PatchType type ( ) const
inline

Definition at line 415 of file src/Mesh/PatchData.hpp.

References PatchData::mType.

416  { return mType; }
PatchType type ( ) const
inline

Definition at line 415 of file includeLinks/PatchData.hpp.

References PatchData::mType.

Referenced by MeshSet::update_mesh().

416  { return mType; }

Here is the caller graph for this function:

void update_cached_normals ( MsqError err)
private

Definition at line 1151 of file Mesh/PatchData.cpp.

References PatchData::domainHint, PatchData::elementHandlesArray, MeshSet::get_domain_constraint(), i, MsqError::INVALID_STATE, PatchData::meshSet, MSQ_SETERR, nvc::norm(), MeshDomain::normal_at(), PatchData::num_vertices(), Mesquite::PLANAR_DOMAIN, PatchData::vertex_by_index(), PatchData::vertexArray, PatchData::vertexHandlesArray, and PatchData::vertexNormals.

Referenced by PatchData::get_domain_normal_at_vertex(), and PatchData::get_domain_normals_at_corners().

1152 {
1153  MeshDomain* domain = meshSet ? meshSet->get_domain_constraint() : 0;
1154  if (!domain)
1155  {
1156  MSQ_SETERR(err)( "No domain constraint set.", MsqError::INVALID_STATE );
1157  vertexNormals.clear();
1158  return;
1159  }
1160 
1161  if (domainHint == PLANAR_DOMAIN)
1162  {
1163  vertexNormals.resize(1);
1165  domain->normal_at( elementHandlesArray[0], vertexNormals[0] );
1166  }
1167 
1168  else
1169  {
1170  vertexNormals.resize( num_vertices() );
1171  for ( unsigned i = 0; i < num_vertices(); ++i)
1172  {
1174  norm = vertexArray[i];
1175  domain->normal_at( vertexHandlesArray[i], norm );
1176  //norm.normalize();
1177  //if (!finite(norm.x()) || !finite(norm.y()) || !finite(norm.z()))
1178  // norm.set(0,0,0);
1179  }
1180  }
1181 }
PatchDataMem< MsqVertex > vertexArray
MsqVertex & vertex_by_index(size_t index)
Returns the start of the vertex-&gt;element array.
Mesquite::MeshDomain * get_domain_constraint()
Returns the domain associated with the MeshSet from which the Patch originates.
T norm(const NVec< DIM, T > &v)
NVec< 3, double > Vector3D
#define MSQ_SETERR(err)
Macro to set error - use err.clear() to clear.
blockLoc i
Definition: read.cpp:79
PatchDataMem< Vector3D > vertexNormals
size_t num_vertices() const
number of vertices in the patch.
object is in an invalid state
PatchDataMem< Mesh::ElementHandle > elementHandlesArray
PatchDataMem< Mesh::VertexHandle > vertexHandlesArray

Here is the call graph for this function:

Here is the caller graph for this function:

void update_cached_normals ( MsqError )
private
void update_mesh ( MsqError err)

Updates the underlying mesh (the Mesquite::Mesh implementation) with new node coordinates and flag values.

This function copies to the TSTT mesh the changes made to the free vertices / elements of the PatchData object.

Definition at line 935 of file Mesh/PatchData.cpp.

References PatchData::meshSet, MSQ_CHKERR, and MeshSet::update_mesh().

Referenced by MeanMidNodeMover::loop_over_mesh(), VertexMover::loop_over_mesh(), and MeshTransform::loop_over_mesh().

936 {
937  if (!meshSet)
938  return;
939 
940  meshSet->update_mesh(*this, err);
941  MSQ_CHKERR(err);
942 }
void update_mesh(const PatchData &pd, MsqError &err)
Updates the coordinates in the underlying mesh with the coordinates stored in PatchData.
#define MSQ_CHKERR(err)
Mesquite&#39;s Error Checking macro.

Here is the call graph for this function:

Here is the caller graph for this function:

void update_mesh ( MsqError err)

Updates the underlying mesh (the Mesquite::Mesh implementation) with new node coordinates and flag values.

MsqVertex& vertex_by_index ( size_t  index)

Returns the start of the vertex->element array.

For each vertex in the patch, this array holds the number of elements the vertex is attached to, followed by the indices of those elements. Returns the start of the vertex->element offset array (v2e_o). For vertex i, v2e_o[i] is the index into the vertex->element array (v2e) where vertex i's data begins. So, v2e[v2e_o[i]] gives you the number of elements vertex i is attached to, and v2e[v2e_o[i]+1] gives you the index of the first element attached to vertex i.

MsqVertex & vertex_by_index ( size_t  index)
inline

Returns the start of the vertex->element array.

For each vertex in the patch, this array holds the number of elements the vertex is attached to, followed by the indices of those elements. Returns the start of the vertex->element offset array (v2e_o). For vertex i, v2e_o[i] is the index into the vertex->element array (v2e) where vertex i's data begins. So, v2e[v2e_o[i]] gives you the number of elements vertex i is attached to, and v2e[v2e_o[i]+1] gives you the index of the first element attached to vertex i.

Definition at line 584 of file includeLinks/PatchData.hpp.

References PatchData::vertexArray.

Referenced by MsqMeshEntity::compute_corner_normals(), MeanMidNodeMover::loop_over_mesh(), QualityAssessor::loop_over_mesh(), and PatchData::update_cached_normals().

585  {
586  return vertexArray[index];
587  }
PatchDataMem< MsqVertex > vertexArray

Here is the caller graph for this function:

Friends And Related Function Documentation

MeshSet
friend

Definition at line 441 of file includeLinks/PatchData.hpp.

msq_stdio::ostream& operator<< ( msq_stdio::ostream &  ,
const PatchData  
)
friend

Display the coordinates and connectivity information.

msq_stdio::ostream& operator<< ( msq_stdio::ostream &  ,
const PatchData  
)
friend

Display the coordinates and connectivity information.

Member Data Documentation

size_t numCornerVertices
private

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