MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#include <RefSizeTargetCalculator.hpp>
Public Member Functions | |
RefSizeTargetCalculator (ReferenceMesh *reference_mesh, TargetCalculator *tc) | |
RefSizeTargetCalculator (ReferenceMesh *reference_mesh) | |
virtual bool | get_3D_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 3, 3 > &W_out, MsqError &err) |
Get a target matrix. | |
virtual bool | get_2D_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 2, 2 > &W_out, MsqError &err) |
Get a target matrix. | |
virtual bool | get_surface_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 3, 2 > &W_out, MsqError &err) |
Get a target matrix. | |
virtual bool | have_surface_orient () const |
Use 3x2 W for surface elements if true, 2x2 W if false. | |
Private Member Functions | |
double | average_edge_length (PatchData &pd, size_t element, MsqError &err) |
Private Attributes | |
ReferenceMesh * | refMesh |
IdealShapeTarget | defaultTargets |
TargetCalculator * | scaledTargets |
Definition at line 43 of file RefSizeTargetCalculator.hpp.
MBMesquite::RefSizeTargetCalculator::RefSizeTargetCalculator | ( | ReferenceMesh * | reference_mesh, |
TargetCalculator * | tc | ||
) |
Definition at line 56 of file RefSizeTargetCalculator.cpp.
: refMesh( reference_mesh ), scaledTargets( tc ) { } // { init_scale_factors( scaleFactor ); }
MBMesquite::RefSizeTargetCalculator::RefSizeTargetCalculator | ( | ReferenceMesh * | reference_mesh | ) |
Definition at line 61 of file RefSizeTargetCalculator.cpp.
: refMesh( reference_mesh ), scaledTargets( &defaultTargets ) { } // { init_scale_factors( scaleFactor ); }
double MBMesquite::RefSizeTargetCalculator::average_edge_length | ( | PatchData & | pd, |
size_t | element, | ||
MsqError & | err | ||
) | [private] |
Definition at line 66 of file RefSizeTargetCalculator.cpp.
References conn, MBMesquite::edges, MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::ReferenceMesh::get_reference_vertex_coordinates(), MBMesquite::PatchData::get_vertex_handles_array(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::length(), MSQ_ERRZERO, MSQ_SETERR, refMesh, MBMesquite::MsqError::UNSUPPORTED_ELEMENT, and MBMesquite::MsqMeshEntity::vertex_count().
Referenced by get_2D_target(), get_3D_target(), and get_surface_target().
{ Vector3D coords[8]; MsqMeshEntity& elem = pd.element_by_index( element ); const size_t* conn = elem.get_vertex_index_array(); size_t nvtx = elem.vertex_count(); if( nvtx > ( sizeof( coords ) / sizeof( coords[0] ) ) ) { MSQ_SETERR( err )( "Invalid element type", MsqError::UNSUPPORTED_ELEMENT ); return false; } Mesh::VertexHandle handles[8]; for( unsigned i = 0; i < nvtx; ++i ) handles[i] = pd.get_vertex_handles_array()[conn[i]]; refMesh->get_reference_vertex_coordinates( handles, nvtx, coords, err ); MSQ_ERRZERO( err ); EntityTopology type = elem.get_element_type(); unsigned num_edges = TopologyInfo::edges( type ); double len_sum = 0.0; for( unsigned i = 0; i < num_edges; ++i ) { const unsigned* edge = TopologyInfo::edge_vertices( type, i ); len_sum += ( coords[edge[0]] - coords[edge[1]] ).length(); } return len_sum * ( 1.0 / num_edges ); // scaleFactor[type]; }
bool MBMesquite::RefSizeTargetCalculator::get_2D_target | ( | PatchData & | pd, |
size_t | element, | ||
Sample | sample, | ||
MsqMatrix< 2, 2 > & | W_out, | ||
MsqError & | err | ||
) | [virtual] |
Get a target matrix.
pd | The current PatchData |
element | The index an element within the patch data. |
sample | The sample point in the element. |
W_out | The resulting target matrix. |
Implements MBMesquite::TargetCalculator.
Definition at line 128 of file RefSizeTargetCalculator.cpp.
References average_edge_length(), MBMesquite::TargetCalculator::get_2D_target(), MSQ_ERRZERO, and scaledTargets.
{ scaledTargets->get_2D_target( pd, element, sample, W, err ); MSQ_ERRZERO( err ); double f = average_edge_length( pd, element, err ); MSQ_ERRZERO( err ); W *= f; return true; }
bool MBMesquite::RefSizeTargetCalculator::get_3D_target | ( | PatchData & | pd, |
size_t | element, | ||
Sample | sample, | ||
MsqMatrix< 3, 3 > & | W_out, | ||
MsqError & | err | ||
) | [virtual] |
Get a target matrix.
pd | The current PatchData |
element | The index an element within the patch data. |
sample | The sample point in the element. |
W_out | The resulting target matrix. |
Implements MBMesquite::TargetCalculator.
Definition at line 96 of file RefSizeTargetCalculator.cpp.
References average_edge_length(), MBMesquite::TargetCalculator::get_3D_target(), MSQ_ERRZERO, and scaledTargets.
{ scaledTargets->get_3D_target( pd, element, sample, W, err ); MSQ_ERRZERO( err ); double f = average_edge_length( pd, element, err ); MSQ_ERRZERO( err ); W *= f; return true; }
bool MBMesquite::RefSizeTargetCalculator::get_surface_target | ( | PatchData & | pd, |
size_t | element, | ||
Sample | sample, | ||
MsqMatrix< 3, 2 > & | W_out, | ||
MsqError & | err | ||
) | [virtual] |
Get a target matrix.
pd | The current PatchData |
element | The index an element within the patch data. |
sample | The sample point in the element. |
W_out | The resulting target matrix. |
Implements MBMesquite::TargetCalculator.
Definition at line 112 of file RefSizeTargetCalculator.cpp.
References average_edge_length(), MBMesquite::TargetCalculator::get_surface_target(), MSQ_ERRZERO, and scaledTargets.
{ scaledTargets->get_surface_target( pd, element, sample, W, err ); MSQ_ERRZERO( err ); double f = average_edge_length( pd, element, err ); MSQ_ERRZERO( err ); W *= f; return true; }
virtual bool MBMesquite::RefSizeTargetCalculator::have_surface_orient | ( | ) | const [inline, virtual] |
Use 3x2 W for surface elements if true, 2x2 W if false.
If true, then the targets for surface elements attempt some control of orientation and therefore get_surface_target must be used to get the targets. If false, then the target contains no orientation data and is therefore the same as the corresponding 2D target for surface elements. In this case, get_2D_target should be used.
Implements MBMesquite::TargetCalculator.
Definition at line 59 of file RefSizeTargetCalculator.hpp.
References MBMesquite::TargetCalculator::have_surface_orient(), and scaledTargets.
{ return scaledTargets->have_surface_orient(); }
Definition at line 68 of file RefSizeTargetCalculator.hpp.
Definition at line 67 of file RefSizeTargetCalculator.hpp.
Referenced by average_edge_length().
Definition at line 69 of file RefSizeTargetCalculator.hpp.
Referenced by get_2D_target(), get_3D_target(), get_surface_target(), and have_surface_orient().