MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Scale a target matrix by the size of another. More...
#include <LambdaTarget.hpp>
Public Member Functions | |
LambdaTarget (TargetCalculator *lambda_source, TargetCalculator *composite_source) | |
~LambdaTarget () | |
bool | get_3D_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 3, 3 > &W_out, MsqError &err) |
Get a target matrix. | |
bool | get_2D_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 2, 2 > &W_out, MsqError &err) |
Get a target matrix. | |
bool | get_surface_target (PatchData &pd, size_t element, Sample sample, MsqMatrix< 3, 2 > &W_out, MsqError &err) |
Get a target matrix. | |
bool | have_surface_orient () const |
Use 3x2 W for surface elements if true, 2x2 W if false. | |
Private Attributes | |
TargetCalculator * | lambdaSource |
TargetCalculator * | compositeSource |
Scale a target matrix by the size of another.
Combine two target matrices by extracting a scalar representation of the size (lambda) of one and use that value to scale the other. The expected use of this target calculator is to preserve the size of a reference mesh while targeting ideal elements for shape.
Definition at line 48 of file LambdaTarget.hpp.
MBMesquite::LambdaTarget::LambdaTarget | ( | TargetCalculator * | lambda_source, |
TargetCalculator * | composite_source | ||
) |
lambda_source | Target calculator from which to extract scaling factor (lambda). |
composite_source | Target calcualtor from which to obtain a target that will be scaled by lambda. |
Definition at line 40 of file LambdaTarget.cpp.
: lambdaSource( lambda_source ), compositeSource( composite_source ) { }
Definition at line 45 of file LambdaTarget.cpp.
{}
bool MBMesquite::LambdaTarget::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 67 of file LambdaTarget.cpp.
References compositeSource, MBMesquite::det(), MBMesquite::TargetCalculator::get_2D_target(), lambdaSource, and MSQ_CHKERR.
{ bool valid = lambdaSource->get_2D_target( pd, element, sample, W_out, err ); if( MSQ_CHKERR( err ) && !valid ) return false; double det1 = det( W_out ); valid = compositeSource->get_2D_target( pd, element, sample, W_out, err ); if( MSQ_CHKERR( err ) && !valid ) return false; double det2 = det( W_out ); if( det2 < 1e-15 ) return false; W_out *= sqrt( det1 / det2 ); return true; }
bool MBMesquite::LambdaTarget::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 47 of file LambdaTarget.cpp.
References MBMesquite::cbrt(), compositeSource, MBMesquite::det(), MBMesquite::TargetCalculator::get_3D_target(), lambdaSource, and MSQ_CHKERR.
{ bool valid = lambdaSource->get_3D_target( pd, element, sample, W_out, err ); if( MSQ_CHKERR( err ) && !valid ) return false; double det1 = det( W_out ); valid = compositeSource->get_3D_target( pd, element, sample, W_out, err ); if( MSQ_CHKERR( err ) && !valid ) return false; double det2 = det( W_out ); if( det2 < 1e-15 ) return false; W_out *= MBMesquite::cbrt( fabs( det1 / det2 ) ); return true; }
bool MBMesquite::LambdaTarget::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 87 of file LambdaTarget.cpp.
References MBMesquite::MsqMatrix< R, C >::column(), compositeSource, moab::cross(), MBMesquite::TargetCalculator::get_surface_target(), lambdaSource, and MSQ_CHKERR.
{ bool valid = lambdaSource->get_surface_target( pd, element, sample, W_out, err ); if( MSQ_CHKERR( err ) && !valid ) return false; MsqVector< 3 > cross = W_out.column( 0 ) * W_out.column( 1 ); double det1 = cross % cross; // length squared valid = compositeSource->get_surface_target( pd, element, sample, W_out, err ); if( MSQ_CHKERR( err ) && !valid ) return false; cross = W_out.column( 0 ) * W_out.column( 1 ); double det2 = cross % cross; // length squared if( det2 < 1e-15 ) return false; W_out *= sqrt( sqrt( det1 / det2 ) ); return true; }
bool MBMesquite::LambdaTarget::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 67 of file LambdaTarget.hpp.
References compositeSource, and MBMesquite::TargetCalculator::have_surface_orient().
{ return compositeSource->have_surface_orient(); }
Definition at line 74 of file LambdaTarget.hpp.
Referenced by get_2D_target(), get_3D_target(), get_surface_target(), and have_surface_orient().
Definition at line 73 of file LambdaTarget.hpp.
Referenced by get_2D_target(), get_3D_target(), and get_surface_target().