MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite Namespace Reference

Implements the NonSmoothDescent class member functions. More...

Namespaces

namespace  DomainUtil
namespace  MeshWriter

Classes

class  Instruction
 Base class for all objects inserted into InstructionQueue. More...
class  InstructionQueue
 An InstructionQueue object gathers Mesquite Instructions and ensures that the instruction queue is coherent for mesh improvement and/or mesh quality assessment purposes. More...
class  IQInterface
struct  SettingData
class  Settings
class  SlaveBoundaryVertices
 Utility to set slaved vs. non-slaved vertices. More...
class  TerminationCriterion
 The TerminationCriterion class contains functionality to terminate the VertexMover's optimization. More...
class  VertexSlaver
class  CurveDomain
 Domain used for optional curve smoother. More...
class  Mesh
 A MBMesquite::Mesh is a collection of mesh elements which are composed of mesh vertices. Intermediate objects are not accessible through this interface (where intermediate objects include things like the faces of a hex, or an element's edges). More...
class  EntityIterator
 Iterates through a set of entities. An EntityIterator is typically obtained via Mesh::vertex_iterator() or Mesh::element_iterator(). An iterator obtained in this way iterates over the set of all vertices/elements in the Mesh from which the iterator was obtained. More...
class  MeshDomain
class  MeshDomainAssoc
class  ParallelHelper
class  ParallelMesh
class  HexLagrangeShape
 Lagrange shape function for 27-node hexahedral elements. More...
class  QuadLagrangeShape
 Lagrange shape function for 9-node quadrilateral elements. More...
class  TetLagrangeShape
 Lagrange shape function for tetrahedral elements. More...
class  TriLagrangeShape
 Lagrange shape function for triangle elements. More...
class  LinearHexahedron
 Linear mapping function for a hexahedral element. More...
class  LinearPrism
 Linear mapping function for a prism element. More...
class  LinearPyramid
 Linear mapping function for a pyramid element. More...
class  LinearQuadrilateral
 Linear shape function for quadrilateral elements. More...
class  LinearTetrahedron
 Linear mapping function for a tetrahedral element. More...
class  LinearTriangle
 Linear mapping function for a triangular element. More...
class  MappingFunction
 An interface for a mapping function of the form \(\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}\), where \(\vec{x_i}\) is a point in \(\mathbf{R}^3\) (i.e. \(x_i,y_i,z_i\)), \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}\) for surface elements and \(\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}\) for volume elements. More...
class  MappingFunction2D
 MappingFunction for topologically 2D (surface) elements. More...
class  MappingFunction3D
 MappingFunction for topologically 3D (volume) elements. More...
class  NodeSet
struct  Sample
class  IndexIterator
class  ArrayMesh
class  ElementPatches
 A PatchSet representing a decomposition of the mesh into patches containing a single element. More...
class  ExtraData
 Object used to attach auxiliary data to PatchData. More...
class  ExtraDataUser
 Manage extra data attached to PatchData instances. More...
class  ExtraUserData
class  GlobalPatch
 A PatchSet representing a single global patch. More...
class  MeshDecorator
 Utility class for implementing decorators for the MBMesquite::Mesh interface. More...
struct  cast_handle
class  MeshImpl
 MeshImpl is a Mesquite implementation of the Mesh interface. Applications can also provide their own implementation of the interface. More...
class  MeshImplData
class  MeshImplVertIter
 VertexIterator for MeshImpl. More...
class  MeshImplElemIter
 ElementIterator for MeshImpl. More...
struct  TagDescription
class  MeshImplTags
class  MeshUtil
 Miscelanions operations performed on an entire Mesh without the conveinience of a PatchData. More...
class  MsqFreeVertexIndexIterator
 iterates over indexes of free vetices in a PatchData. More...
class  MsqMeshEntity
 MsqMeshEntity is the Mesquite object that stores information about the elements in the mesh. More...
class  MsqVertex
 MsqVertex is the Mesquite object that stores information about the vertices in the mesh. More...
struct  VertexPack
struct  VertexIdMapKey
struct  VertexIdLessFunc
class  ParallelHelperImpl
class  ParallelMeshImpl
 ParallelMeshImpl is a Mesquite implementation of the ParallelMesh interface. It inherits all of the implementation from MeshImpl and only implements any additional functionality. More...
class  PatchData
class  PatchDataVerticesMemento
 Contains a copy of the coordinates of a PatchData. More...
class  PatchIterator
class  PatchSet
 Specify a division of the Mesh into working patches. More...
class  TagVertexMesh
 Store alternate vertex coordinates in tags. More...
class  VertexPatches
 A PatchSet representing a decomposition of the mesh into patches containing a single free vertex and the adjacent elements. More...
class  BoundedCylinderDomain
class  ConicDomain
class  CylinderDomain
class  DomainClassifier
 Assign subsets of a mesh do different domains. More...
class  EdgeIterator
 Iterate over all edges in a patch. More...
class  Exponent
class  FileTokenizer
 Parse a file as space-separated tokens. More...
class  Matrix3D
 3*3 Matric class, row-oriented, 0-based [i][j] indexing. More...
class  PointDomain
class  LineDomain
class  CircleDomain
class  MeshTransform
class  MsqDebug
 Run-time activation/deactivation of debug flags. More...
class  MsqError
 Used to hold the error state and return it to the application. More...
class  MsqPrintError
 Utility class for printing error data - used in Mesquite tests. More...
class  MsqFPE
 Utility class used by InstructionQueue SIGFPE option. More...
class  MsqLine
 Line in R^3. More...
class  MsqCircle
 Circle in R^3. More...
class  MsqPlane
 Plane. More...
class  MsqSphere
 Sphere. More...
class  MsqHessian
 Vector3D is the object that effeciently stores the objective function Hessian each entry is a Matrix3D object (i.e. a vertex Hessian). More...
class  MsqInterrupt
 Class to watch for user-interrupt (SIGINT, ctrl-C) More...
class  MsqMatrix
 Fixed-size matrix class. More...
class  MsqMatrix< 1, 1 >
class  MsqVector
 Vector is a 1xL Matrix. More...
class  MsqMatrixA
 A subclass of MsqMatrix that behaves more like the old Matrix3D class. More...
class  Timer
class  StopWatch
class  StopWatchCollection
class  FunctionTimer
class  PlanarDomain
class  SimpleStats
 Accumulate various statistics for a list of discrete values. More...
class  SphericalDomain
class  SymMatrix3D
class  Vector3D
 Vector3D is the object that effeciently stores information about about three-deminsional vectors. It is also the parent class of MsqVertex. More...
struct  VtkTypeInfo
class  XYPlanarDomain
class  XYRectangle
 Simple 2D Domain for free-smooth testing. More...
class  CompositeOFAdd
 Adds two ObjectiveFunction values together. More...
class  CompositeOFMultiply
 Multiplies two ObjectiveFunction values together. More...
class  CompositeOFScalarAdd
 Adds a scalar to a given ObjectiveFunction. More...
class  CompositeOFScalarMultiply
 Scales a given an ObjectiveFunction. More...
class  LInfTemplate
 Computes the L_infinity objective function for a given patch, i.e., LInfTemplate::concrete_evaluate returns the maximum absolute value of the quality metric values on 'patch'. More...
class  LPtoPTemplate
 Calculates the L_p objective function raised to the pth power. That is, sums the p_th powers of (the absolute value of) the quality metric values. More...
class  MaxTemplate
 Computes the maximum quality metric value. More...
class  ObjectiveFunction
 Base class for concrete Objective Functions ObjectiveFunction contains a pointer to a QualityMetric. If the ObjectiveFunction is associated with more than one QualityMetric (i.e., the Objective is a composite, and the composed ObjectiveFunctions are associated with different QualityMetrics), then the QualityMetric pointer is set to NULL.. More...
class  ObjectiveFunctionTemplate
 Base for most concrete objective functions. More...
class  OFEvaluator
 Evaluate objective function. More...
class  PatchPowerMeanP
 Objective function: p-mean^p of p-mean^p of patch metric values. More...
class  PMeanPTemplate
 \(\frac{1}{n}\sum_{i=1}^n\mu(s_i)^p\) More...
class  StdDevTemplate
 standard deviation template More...
class  VarianceTemplate
 (variance)^2 template More...
class  QualityAssessor
 A QualityAssessor instance can be inserted into an InstructionQueue to calculate and summarize registered QualityMetric or QualityMetrics for the mesh. More...
class  NullImprover
class  ConjugateGradient
 Optimizes the objective function using the Polack-Ribiere scheme. More...
class  FeasibleNewton
 High Performance implementation of the Feasible Newton algorythm. More...
class  NonGradient
class  NonSmoothDescent
class  QuasiNewton
class  SteepestDescent
class  TrustRegion
class  PatchSetUser
 Utility class for handling variable patch types. More...
class  QualityImprover
 Base class for all quality improvers. Mote that the PatchData settings are inherited from the PathDataUser class. More...
class  LaplacianSmoother
class  Randomize
 Randomly perftubs the (un-culled) vertices. More...
class  RelaxationSmoother
 Base class for LaPlacian and other relaxation smoothers. More...
class  SmartLaplacianSmoother
class  VertexMover
class  AddQualityMetric
class  CornerHessDiagIterator
 Iterate over only diagonal blocks of element corner Hessian data. More...
class  AveragingQM
 Averaging functionality for use in quality metrics. More...
class  CompareQM
 Compare values for two supposedly equivalent quality metrics. More...
class  NumericalQM
 Use finite difference rather than analytical derivative calculations. More...
struct  EdgeData
class  EdgeQM
 Base type for quality metrics evaluated for each edge. More...
class  ElementAvgQM
class  ElementMaxQM
class  ElementPMeanP
class  ElementQM
 Base type for per-element quality metrics. More...
class  ElemSampleQM
 Base type for metrics evaluated at several sample points within each element. More...
class  MultiplyQualityMetric
 Combines two quality metrics (qMetric1 and qMetric2 defined in the parent class CompositeQualityMetric) by multiplication for two- and three-diminsional elements. Note: This function should not be used to combine a node-based metric with an element-based metric. More...
class  PMeanPMetric
class  PowerQualityMetric
 Raises a single quality metrics (qMetric1) to an arbitrary power (a double value, scaleAlpha) for two- and three-diminsional elements. More...
class  QualityMetric
 Base class for concrete quality metrics. More...
class  ScalarAddQualityMetric
 Offset a quality metric by a scalar value. More...
class  ScalarMultiplyQualityMetric
 Multiplies quality metric value by a number (a double). More...
class  AspectRatioGammaQualityMetric
 Object for computing the aspect ratio gamma of simplicial elements. More...
class  ConditionNumberQualityMetric
 Computes the condition number of given element. More...
class  IdealWeightInverseMeanRatio
 Computes the inverse mean ratio of given element. More...
class  IdealWeightMeanRatio
 Computes the mean ratio quality metric of given element. More...
class  VertexConditionNumberQualityMetric
 Computes the condition numbers of the corner's of elements connected to the given vertex and then averages those values. More...
class  EdgeLengthQualityMetric
 Computes the lengths of the edges connected to given a vertex.. More...
class  EdgeLengthRangeQualityMetric
 Computes the edge length range metric for a given vertex. More...
class  AffineMapMetric
 Compare targets to affine map to ideal element. More...
class  AWQualityMetric
 Compare targets to mapping function Jacobian matrices. More...
class  TMPQualityMetric
 Compare targets to mapping function Jacobian matrices. More...
class  TQualityMetric
 Compare targets to mapping function Jacobian matrices. More...
class  UntangleBetaQualityMetric
 The untangle beta quality metric. More...
class  VertexMaxQM
class  VertexPMeanP
class  VertexQM
 Base type for per-vertex quality metrics. More...
class  EdgeLengthMetric
class  LocalSizeQualityMetric
 Computes the local size metric for a given vertex. More...
class  SizeMetric
 Element size (area or volume) More...
struct  CachedTargetData
class  CachingTargetCalculator
 Cache target matrices on PatchData. More...
class  IdealShapeTarget
class  InverseMetricWeight
 Use inverse of metric value as target weight. More...
class  JacobianCalculator
 Calculate Jacobian matrices given vertex coordinates and MappingFunction. More...
class  LambdaConstant
 Scale a target matrix. More...
class  LambdaTarget
 Scale a target matrix by the size of another. More...
class  LVQDTargetCalculator
 Construct target matrices from factors of guide matrices. More...
class  MetricWeight
 Use metric value as target weight. More...
class  ReferenceMeshInterface
 Class for accessing reference element topology. More...
class  ReferenceMesh
class  RefMeshTargetCalculator
class  RefSizeTargetCalculator
class  RemainingWeight
 c2_k = 1 - c1_k More...
class  TargetCalculator
struct  TargetReaderData
 Internal structure used by TargetReader. More...
class  TargetReader
 Read targets from tag data. More...
class  TargetWriter
class  WeightCalculator
struct  WeightReaderData
 Internal structure used by WeightReader. More...
class  WeightReader
 Read targets from tag data. More...
class  AWMetric
 A metric for comparing a matrix A with a target matrix W. More...
class  AWMetric2D
class  AWMetric3D
class  AWMetricBarrier
 A metric for comparing a matrix A with a target matrix W. More...
class  AWMetricBarrier2D
class  AWMetricBarrier3D
class  AWMetricNonBarrier
 The parent class for all AWMetricNonBarrier sub-classes. More...
class  AWMetricNonBarrier2D
class  AWMetricNonBarrier3D
class  InvTransBarrier
class  TMixed
 Use different target metrics for surface and volume elements. More...
class  TOffset
class  TPower2
class  TScale
class  TSquared
class  TSum
class  AWShape2DB1
class  AWShape2DNB1
class  AWShape2DNB2
class  TInverseMeanRatio
class  TShape2DNB2
class  TShape3DB2
 3.3.8: 1/9 ^2(T) - 1, Kappa(T) = |T||T|^-1 = |T||adj(T)/ More...
class  TShapeB1
 Metric sensitive to shape. More...
class  TShapeNB1
 Metric sensitive to shape. More...
class  AWShapeOrientNB1
class  TShapeOrientB1
class  TShapeOrientB2
class  TShapeOrientNB1
class  TShapeOrientNB2
class  AWShapeSizeB1
class  TShapeSize2DB2
class  TShapeSize2DNB1
class  TShapeSize2DNB2
class  TShapeSize3DB2
class  TShapeSize3DB4
class  TShapeSize3DNB1
 \( |T|^3 - 3 \sqrt{3} \tau + \gamma (\tau - 1)^2 \) More...
class  TShapeSizeB1
class  TShapeSizeB3
class  TShapeSizeNB3
class  AWShapeSizeOrientNB1
class  TShapeSizeOrientB1
class  TShapeSizeOrientB2
class  TShapeSizeOrientNB1
class  AWSizeB1
class  AWSizeNB1
class  TSizeB1
class  TSizeNB1
class  TTau
 det(T) More...
class  TMetric
class  TMetric2D
class  TMetric3D
class  TMetricBarrier
class  TMetricBarrier2D
class  TMetricBarrier3D
class  TMetricNonBarrier
class  TMetricNonBarrier2D
class  TMetricNonBarrier3D
struct  DimConst
 Dimension-specific constants. More...
struct  DimConst< 2 >
struct  DimConst< 3 >
class  AWUntangleBeta
class  TUntangle1
 Untangle metric. More...
class  TUntangleBeta
 Untangle metric. More...
class  TUntangleMu
 Composite untangle metric. More...
class  DeformingDomainWrapper
 Smooth mesh with deforming domain (deforming geometry) More...
class  DeformingCurveSmoother
 Utility to do curve smoothing. More...
class  LaplaceWrapper
class  PaverMinEdgeLengthWrapper
class  ShapeImprovementWrapper
 Wrapper which performs a Feasible Newton solve using an \(\ell_2^2 \) objective function template with inverse mean ratio. More...
class  ShapeImprover
 Wrapper that implements TMP-based shape improvement. More...
class  SizeAdaptShapeWrapper
class  UntangleWrapper
 Wrapper that implements several TMP-based untanglers. More...
class  ViscousCFDTetShapeWrapper
class  Wrapper
 Interface for wrappers. More...
class  MsqCommonIGeom
 Common code for specific implementations of MeshDomain on ITAPS interfaces. More...
class  MsqIGeom
 A MBMesquite::MeshDomain implemented on top of the ITAPS iGeom API. More...
class  MsqIMesh
 Mesquite iMesh Adapter. More...
class  MsqIMeshP
 Mesquite iMesh Adapter. More...
class  MsqIRel
class  MsqMOAB
class  CircleDomainTest
class  LineDomainTest
class  TestRunner
 A class the runs cppunit tests, outputs results in an organized manner. More...

Typedefs

typedef EntityIterator VertexIterator
typedef EntityIterator ElementIterator
typedef void * TagHandle
typedef int StatusCode
typedef double real
typedef struct
MBMesquite::VertexPack 
VertexPack
typedef struct
MBMesquite::VertexIdMapKey 
VertexIdMapKey
typedef std::map
< VertexIdMapKey, int,
VertexIdLessFunc
VertexIdMap
typedef void(* msq_sig_handler_t )(int)

Enumerations

enum  TCType {
  NONE = 0, GRADIENT_L2_NORM_ABSOLUTE = 1 << 0, GRADIENT_INF_NORM_ABSOLUTE = 1 << 1, GRADIENT_L2_NORM_RELATIVE = 1 << 2,
  GRADIENT_INF_NORM_RELATIVE = 1 << 3, KKT = 1 << 4, QUALITY_IMPROVEMENT_ABSOLUTE = 1 << 5, QUALITY_IMPROVEMENT_RELATIVE = 1 << 6,
  NUMBER_OF_ITERATES = 1 << 7, CPU_TIME = 1 << 8, VERTEX_MOVEMENT_ABSOLUTE = 1 << 9, VERTEX_MOVEMENT_ABS_EDGE_LENGTH = 1 << 10,
  VERTEX_MOVEMENT_RELATIVE = 1 << 11, SUCCESSIVE_IMPROVEMENTS_ABSOLUTE = 1 << 12, SUCCESSIVE_IMPROVEMENTS_RELATIVE = 1 << 13, BOUNDED_VERTEX_MOVEMENT = 1 << 14,
  UNTANGLED_MESH = 1 << 15
}
enum  StatusCodeValues { MSQ_FAILURE = 0, MSQ_SUCCESS }
enum  EntityTopology {
  POLYGON = 7, TRIANGLE = 8, QUADRILATERAL = 9, POLYHEDRON = 10,
  TETRAHEDRON = 11, HEXAHEDRON = 12, PRISM = 13, PYRAMID = 14,
  SEPTAHEDRON = 15, MIXED
}
enum  AssessSchemes {
  NO_SCHEME = 0, ELEMENT_AVG_QM = 1, ELEMENT_MAX_QM = 2, TMP_QUALITY_METRIC = 3,
  QUALITY_METRIC = 4
}
enum  ReleaseType { RELEASE, BETA, ALPHA }
enum  Rotate { COUNTERCLOCKWISE = 1, CLOCKWISE = 0 }

Functions

int get_parallel_rank ()
int get_parallel_size ()
double reduce_parallel_max (double value)
size_t vertices_in_topology (EntityTopology)
MESQUITE_EXPORT const char * version_string (bool)
MESQUITE_EXPORT unsigned int major_version_number ()
MESQUITE_EXPORT unsigned int minor_version_number ()
MESQUITE_EXPORT unsigned int patch_version_number ()
MESQUITE_EXPORT
MBMesquite::ReleaseType 
release_type ()
template<class T >
T MSQ_MIN_2 (T a, T b)
template<class T >
T MSQ_MAX_2 (T a, T b)
double cbrt (double d)
double cbrt_sqr (double d)
bool divide (double num, double den, double &result)
 Perform safe division (no overflow or div by zero).
template<typename T >
Tarrptr (std::vector< T > &v, bool check_zero_size=false)
 get array pointer from std::vector
template<typename T >
const Tarrptr (const std::vector< T > &v, bool check_zero_size=false)
static void derivatives_at_corner (unsigned corner, NodeSet nodeset, size_t *vertices, MsqVector< 2 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_edge (unsigned edge, NodeSet nodeset, size_t *vertices, MsqVector< 2 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_elem (NodeSet nodeset, size_t *vertices, MsqVector< 2 > *derivs, size_t &num_vtx)
static void coefficients_at_corner (unsigned corner, double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void coefficients_at_mid_edge (unsigned edge, NodeSet nodeset, double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void coefficients_at_mid_face (unsigned face, NodeSet nodeset, double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void coefficients_at_mid_elem (NodeSet nodeset, double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void get_linear_derivatives (size_t *vertices, MsqVector< 3 > *derivs)
static void derivatives_at_corner (unsigned corner, NodeSet nodeset, size_t *vertices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_edge (unsigned edge, NodeSet nodeset, size_t *vertices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_face (unsigned face, NodeSet nodeset, size_t *vertices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_elem (NodeSet nodeset, size_t *vertices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void get_linear_derivatives (size_t *vertices, MsqVector< 2 > *derivs)
static int coeff_xi_sign (unsigned coeff)
static int coeff_eta_sign (unsigned coeff)
static int coeff_zeta_sign (unsigned coeff)
static void coefficients_at_mid_edge (unsigned edge, double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void coefficients_at_mid_face (unsigned face, double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void coefficients_at_mid_elem (double *coeff_out, size_t *indices_out, size_t &num_coeff)
static void derivatives_at_corner (unsigned corner, size_t *vertex_indices_out, MsqVector< 3 > *d_coeff_d_xi_out, size_t &num_vtx)
static void derivatives_at_mid_edge (unsigned edge, size_t *vertex_indices_out, MsqVector< 3 > *d_coeff_d_xi_out, size_t &num_vtx)
static void derivatives_at_mid_face (unsigned face, size_t *vertex_indices_out, MsqVector< 3 > *d_coeff_d_xi_out, size_t &num_vtx)
static void derivatives_at_mid_elem (size_t *vertex_indices_out, MsqVector< 3 > *d_coeff_d_xi_out, size_t &num_vtx)
static void set_equal_derivatives (double value, size_t *indices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void set_edge_derivatives (unsigned base_corner, double value, size_t *indices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void set_corner_derivatives (unsigned corner, double value, size_t *indices, MsqVector< 3 > *derivs, size_t &num_vtx)
static void derivatives_at_corner (unsigned corner, size_t *vertex_indices, MsqVector< 2 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_edge (unsigned edge, size_t *vertices, MsqVector< 2 > *derivs, size_t &num_vtx)
static void derivatives_at_mid_elem (size_t *vertices, MsqVector< 2 > *derivs, size_t &num_vtx)
std::ostream & operator<< (std::ostream &s, NodeSet set)
std::ostream & operator<< (std::ostream &str, Sample s)
static void init_tri (Vector3D *coords, double side)
static void init_tet (Vector3D *coords, double side)
static void init_pyr (Vector3D *coords, double side)
static void init_wdg (Vector3D *coords, double side)
static void init_hex_pyr (Vector3D *coords, double height)
static const Vector3D *const * init_unit_edge (Vector3D **)
static const Vector3D *const * init_unit_elem (Vector3D **)
const Vector3Dunit_edge_element (EntityTopology type, bool unit_height_pyramid=false)
 Get ideal element with unit edge length.
const Vector3Dunit_element (EntityTopology type, bool unit_height_pyramid=false)
 Get ideal element with unit area or volume.
static bool is_side_boundary (MeshImplData *myMesh, size_t elem, unsigned side_dim, unsigned side_num, MsqError &err)
 Helper function for MeshImpl::mark_skin_fixed.
static void get_field_names (const TagDescription &tag, std::string &field_out, std::string &member_out, MsqError &err)
static double corner_volume (const Vector3D &v0, const Vector3D &v1, const Vector3D &v2, const Vector3D &v3)
ostream & operator<< (ostream &stream, const MsqMeshEntity &entity)
void parallel_barrier ()
static const char * mpi_err_string (int error_code)
static bool vertex_map_insert (VertexIdMap &map, size_t glob_id, int proc_id, int value)
static int vertex_map_find (const VertexIdMap &map, size_t glob_id, int proc_id)
static void my_quicksort (int *a, size_t *b, MBMesquite::Mesh::VertexHandle *c, int i, int j)
static int hash6432shift (unsigned long long key)
static unsigned long long hash64shift (unsigned long long key)
static double generate_random_number (int generate_random_numbers, int proc_id, size_t glob_id)
static void project_to_plane (Vector3D &vect, const Vector3D &norm)
static int width (double d)
static int width (size_t t)
static int width (const void *ptr)
ostream & operator<< (ostream &stream, const PatchData &pd)
void print_patch_data (const PatchData &pd)
int popcount (unsigned int x)
 Count number of 1-bits in an unsigned integer.
static bool compare_sides (unsigned num_vtx, const unsigned *idx_set_1, const Mesh::VertexHandle *vtx_set_1, const unsigned *idx_set_2, const Mesh::VertexHandle *vtx_set_2)
 Helper function for 'find_skin'.
static void find_skin (Mesh *mesh, std::vector< Mesh::VertexHandle > &skin_verts, std::vector< Mesh::ElementHandle > &skin_elems, MsqError &err)
 Skin mesh.
static void dimension_sort_domains (MeshDomain **domains, const int *dims, unsigned count, std::vector< DomainClassifier::DomainSet > &results, int dim_indices[4], MsqError &err)
 Group MeshDomain objectects by topological dimension.
static void geom_classify_vertices (Mesh *mesh, DomainClassifier::DomainSet *dim_sorted_domains, unsigned num_domain, const std::vector< Mesh::VertexHandle > &vertices, double epsilon, MsqError &err)
 Classify mesh vertices using vertex position.
static void vert_classify_elements (Mesh *mesh, DomainClassifier::DomainSet *dim_sorted_domains, unsigned num_domain, int dim_indices[4], const std::vector< Mesh::ElementHandle > &elems, std::vector< Mesh::ElementHandle > &unknown_elems, MsqError &err)
 Classify mesh elements using vertex classification.
static void geom_classify_elements (Mesh *mesh, DomainClassifier::DomainSet *dim_sorted_domains, unsigned num_domain, int dim_indices[4], const std::vector< Mesh::ElementHandle > &elems, std::vector< Mesh::ElementHandle > &unknown_elems, double epsilon, MsqError &err)
 Classify mesh elements geometrically.
static bool next_vertex (Mesh *mesh, Mesh::VertexHandle &vtx, std::set< Mesh::VertexHandle > &unseen, MsqError &err)
static bool operator< (const Mesh::EntityHandle h, const DomainClassifier::DomainBlock &b)
static bool operator< (const DomainClassifier::DomainBlock &b, const Mesh::EntityHandle h)
static bool operator< (const DomainClassifier::DomainBlock &b, const DomainClassifier::DomainBlock &c)
bool operator< (const EdgeIterator::Edge &e1, const EdgeIterator::Edge &e2)
bool operator== (const EdgeIterator::Edge &e1, const EdgeIterator::Edge &e2)
std::ostream & operator<< (std::ostream &s, const Matrix3D &A)
std::istream & operator>> (std::istream &s, Matrix3D &A)
bool operator== (const Matrix3D &lhs, const Matrix3D &rhs)
bool operator!= (const Matrix3D &lhs, const Matrix3D &rhs)
Matrix3D operator- (const Matrix3D &A)
const Matrix3D operator+ (const Matrix3D &A, const Matrix3D &B)
Matrix3D operator+ (const Matrix3D &A, const SymMatrix3D &B)
Matrix3D operator+ (const SymMatrix3D &B, const Matrix3D &A)
const Matrix3D operator- (const Matrix3D &A, const Matrix3D &B)
Matrix3D operator- (const Matrix3D &A, const SymMatrix3D &B)
Matrix3D operator- (const SymMatrix3D &B, const Matrix3D &A)
const Matrix3D mult_element (const Matrix3D &A, const Matrix3D &B)
 Multiplies entry by entry. This is NOT a matrix multiplication.
double Frobenius_2 (const Matrix3D &A)
 Return the square of the Frobenius norm of A, i.e. sum (diag (A' * A))
Matrix3D transpose (const Matrix3D &A)
Matrix3D plus_transpose (const Matrix3D &A, const Matrix3D &B)
 \( + B^T \)
const Matrix3D operator* (const Matrix3D &A, const Matrix3D &B)
const Matrix3D operator* (const Matrix3D &A, const SymMatrix3D &B)
const Matrix3D operator* (const SymMatrix3D &B, const Matrix3D &A)
const Matrix3D operator* (const SymMatrix3D &a, const SymMatrix3D &b)
const Matrix3D operator* (double s, const Matrix3D &A)
void matmult (Matrix3D &C, const Matrix3D &A, const Matrix3D &B)
 \( C = A \times B \)
const Vector3D operator* (const Matrix3D &A, const Vector3D &x)
 Computes \( A v \) .
const Vector3D operator* (const Vector3D &x, const Matrix3D &A)
 Computes \( v^T A \) .
void eqAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
void plusEqAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
void eqTransAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
void plusEqTransAx (Vector3D &v, const Matrix3D &A, const Vector3D &x)
void plusEqaA (Matrix3D &B, const double a, const Matrix3D &A)
double det (const Matrix3D &A)
void inv (Matrix3D &Ainv, const Matrix3D &A)
void timesInvA (Matrix3D &B, const Matrix3D &A)
void QR (Matrix3D &Q, Matrix3D &R, const Matrix3D &A)
std::ostream & operator<< (std::ostream &, const MsqError::Trace &)
 Print MsqError::Trace.
std::ostream & operator<< (std::ostream &, const MsqError &)
 Print message and stack trace.
std::ostream & operator<< (std::ostream &s, const MsqHessian &h)
 Prints out the MsqHessian blocks.
void axpy (Vector3D res[], size_t size_r, const MsqHessian &H, const Vector3D x[], size_t size_x, const Vector3D y[], size_t size_y, MsqError &)
std::string process_itaps_error (int ierr)
void msq_sigint_handler (int)
template<unsigned R1, unsigned C1, unsigned R2, unsigned C2>
void set_region (MsqMatrix< R1, C1 > &d, unsigned r, unsigned c, MsqMatrix< R2, C2 > &s)
 Set a subset of this matrix to some other matrix.
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator- (const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator+ (const MsqMatrix< R, C > &m, double s)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator+ (double s, const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator+ (const MsqMatrix< R, C > &A, const MsqMatrix< R, C > &B)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator- (const MsqMatrix< R, C > &m, double s)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator- (double s, const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator- (const MsqMatrix< R, C > &A, const MsqMatrix< R, C > &B)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator* (const MsqMatrix< R, C > &m, double s)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator* (double s, const MsqMatrix< R, C > &m)
template<unsigned R, unsigned RC, unsigned C>
double multiply_helper_result_val (unsigned r, unsigned c, const MsqMatrix< R, RC > &A, const MsqMatrix< RC, C > &B)
template<unsigned R, unsigned RC, unsigned C>
MsqMatrix< R, Coperator* (const MsqMatrix< R, RC > &A, const MsqMatrix< RC, C > &B)
template<unsigned R, unsigned C>
MsqMatrix< R, Coperator/ (const MsqMatrix< R, C > &m, double s)
template<unsigned RC>
double cofactor (const MsqMatrix< RC, RC > &m, unsigned r, unsigned c)
template<unsigned RC>
double det (const MsqMatrix< RC, RC > &m)
double det (const MsqMatrix< 2, 2 > &m)
double det (const MsqMatrix< 3, 3 > &m)
MsqMatrix< 2, 2 > adj (const MsqMatrix< 2, 2 > &m)
MsqMatrix< 2, 2 > transpose_adj (const MsqMatrix< 2, 2 > &m)
MsqMatrix< 3, 3 > adj (const MsqMatrix< 3, 3 > &m)
MsqMatrix< 3, 3 > transpose_adj (const MsqMatrix< 3, 3 > &m)
template<unsigned R, unsigned C>
MsqMatrix< R, Cinverse (const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
MsqMatrix< R, Ctranspose (const MsqMatrix< C, R > &m)
template<unsigned RC>
double trace (const MsqMatrix< RC, RC > &m)
template<unsigned R, unsigned C>
double sqr_Frobenius (const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
double Frobenius (const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
bool operator== (const MsqMatrix< R, C > &A, const MsqMatrix< R, C > &B)
template<unsigned R, unsigned C>
bool operator!= (const MsqMatrix< R, C > &A, const MsqMatrix< R, C > &B)
template<unsigned R, unsigned C>
std::ostream & operator<< (std::ostream &str, const MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
std::istream & operator>> (std::istream &str, MsqMatrix< R, C > &m)
template<unsigned R>
double sqr_length (const MsqMatrix< R, 1 > &v)
template<unsigned C>
double sqr_length (const MsqMatrix< 1, C > &v)
template<unsigned R>
double length (const MsqMatrix< R, 1 > &v)
template<unsigned C>
double length (const MsqMatrix< 1, C > &v)
template<unsigned R, unsigned C>
double inner_product (const MsqMatrix< R, C > &m1, const MsqMatrix< R, C > &m2)
template<unsigned R, unsigned C>
MsqMatrix< R, Couter (const MsqMatrix< R, 1 > &v1, const MsqMatrix< C, 1 > &v2)
template<unsigned R, unsigned C>
MsqMatrix< R, Couter (const MsqMatrix< 1, R > &v1, const MsqMatrix< 1, C > &v2)
double vector_product (const MsqMatrix< 2, 1 > &v1, const MsqMatrix< 2, 1 > &v2)
double vector_product (const MsqMatrix< 1, 2 > &v1, const MsqMatrix< 1, 2 > &v2)
MsqMatrix< 3, 1 > vector_product (const MsqMatrix< 3, 1 > &a, const MsqMatrix< 3, 1 > &b)
MsqMatrix< 1, 3 > vector_product (const MsqMatrix< 1, 3 > &a, const MsqMatrix< 1, 3 > &b)
template<unsigned R, unsigned C>
double operator% (const MsqMatrix< R, C > &v1, const MsqMatrix< R, C > &v2)
double operator* (const MsqMatrix< 2, 1 > &v1, const MsqMatrix< 2, 1 > &v2)
double operator* (const MsqMatrix< 1, 2 > &v1, const MsqMatrix< 1, 2 > &v2)
MsqMatrix< 3, 1 > operator* (const MsqMatrix< 3, 1 > &v1, const MsqMatrix< 3, 1 > &v2)
MsqMatrix< 1, 3 > operator* (const MsqMatrix< 1, 3 > &v1, const MsqMatrix< 1, 3 > &v2)
void QR (const MsqMatrix< 3, 3 > &A, MsqMatrix< 3, 3 > &Q, MsqMatrix< 3, 3 > &R)
void QR (const MsqMatrix< 2, 2 > &A, MsqMatrix< 2, 2 > &Q, MsqMatrix< 2, 2 > &R)
MESQUITE_EXPORT std::ostream & operator<< (std::ostream &, StopWatchCollection &coll)
MESQUITE_EXPORT void print_timing_diagnostics (int debugflag)
MESQUITE_EXPORT void print_timing_diagnostics (std::ostream &stream)
SymMatrix3D operator- (const SymMatrix3D &m)
SymMatrix3D operator+ (const SymMatrix3D &a, const SymMatrix3D &b)
SymMatrix3D operator- (const SymMatrix3D &a, const SymMatrix3D &b)
SymMatrix3D operator* (const SymMatrix3D &a, double s)
SymMatrix3D operator* (double s, const SymMatrix3D &a)
SymMatrix3D operator/ (const SymMatrix3D &a, double s)
SymMatrix3D operator/ (double s, const SymMatrix3D &a)
Vector3D operator* (const Vector3D &v, const SymMatrix3D &m)
Vector3D operator* (const SymMatrix3D &m, const Vector3D &v)
SymMatrix3D outer (const Vector3D &v)
SymMatrix3D outer_plus_transpose (const Vector3D &u, const Vector3D &v)
const SymMatrix3Dtranspose (const SymMatrix3D &a)
double det (const SymMatrix3D &a)
SymMatrix3D inverse (const SymMatrix3D &a)
double Frobenius_2 (const SymMatrix3D &a)
double Frobenius (const SymMatrix3D &a)
std::ostream & operator<< (std::ostream &s, const MBMesquite::Vector3D &v)
const Vector3D operator+ (const Vector3D &lhs, const Vector3D &rhs)
const Vector3D operator- (const Vector3D &lhs, const Vector3D &rhs)
const Vector3D operator* (const Vector3D &lhs, const double scalar)
const Vector3D operator* (const double scalar, const Vector3D &rhs)
const Vector3D operator/ (const Vector3D &lhs, const double scalar)
double operator% (const Vector3D &lhs, const Vector3D &rhs)
double inner (const Vector3D lhs[], const Vector3D rhs[], int n)
double inner (const std::vector< Vector3D > &lhs, const std::vector< Vector3D > &rhs)
double operator% (const double scalar, const Vector3D &rhs)
double operator% (const Vector3D &lhs, const double scalar)
const Vector3D operator* (const Vector3D &lhs, const Vector3D &rhs)
double inner_product (const Vector3D *v1, const Vector3D *v2, size_t n)
double length_squared (const Vector3D *v, int n)
double length_squared (const std::vector< Vector3D > &v)
double length (const Vector3D *v, int n)
double length (const std::vector< Vector3D > &v)
double Linf (const Vector3D *v, int n)
double Linf (const std::vector< Vector3D > &v)
bool operator== (const Vector3D &v1, const Vector3D &v2)
bool operator!= (const Vector3D &v1, const Vector3D &v2)
const char * default_name (bool free_only)
static double condition3x3 (const double A[9])
template<typename T >
static void free_vector (std::vector< T > &v)
static void plus_eq_scaled (Vector3D *v, double s, const Vector3D *x, size_t n)
static void negate (Vector3D *out, const Vector3D *in, size_t nn)
static void times_eq_minus (Vector3D *v, double s, const Vector3D *x, size_t n)
static void checkpoint_bytes (Mesh *mesh, std::vector< unsigned char > &saved_bytes, MsqError &err)
static void restore_bytes (Mesh *mesh, std::vector< unsigned char > &saved_bytes, MsqError &err)
static void save_or_restore_debug_state (bool save)
template<typename HessIter >
static double sum_corner_diagonals (EntityTopology type, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], HessIter corner_diag_blocks, Vector3D vertex_grads[], SymMatrix3D vertex_hessians[])
template<typename HessIter >
static double sum_sqr_corner_diagonals (EntityTopology type, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], HessIter corner_diag_blocks, Vector3D vertex_grads[], SymMatrix3D vertex_hessians[])
template<typename HessIter >
static double pmean_corner_diagonals (EntityTopology type, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], HessIter corner_diag_blocks, Vector3D vertex_grads[], SymMatrix3D vertex_hessians[], double p)
template<typename HessIter >
static double average_corner_diagonals (EntityTopology type, QualityMetric::AveragingMethod method, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], HessIter corner_diag_blocks, Vector3D vertex_grads[], SymMatrix3D vertex_hessians[], MsqError &err)
static double sum_corner_hessians (EntityTopology type, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], const Matrix3D corner_hessians[], Vector3D vertex_grads[], Matrix3D vertex_hessians[])
static double sum_sqr_corner_hessians (EntityTopology type, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], const Matrix3D corner_hessians[], Vector3D vertex_grads[], Matrix3D vertex_hessians[])
static double pmean_corner_hessians (EntityTopology type, unsigned num_corner, const double corner_values[], const Vector3D corner_grads[], const Matrix3D corner_hessians[], Vector3D vertex_grads[], Matrix3D vertex_hessians[], double p)
static void print (const char *title, const char *name1, const char *name2, const SimpleStats &s1, const SimpleStats &s2, const SimpleStats &sd)
bool operator< (const EdgeData &e1, const EdgeData &e2)
bool operator== (const EdgeData &e1, const EdgeData &e2)
static double get_delta_C (const PatchData &pd, const std::vector< size_t > &indices, MsqError &err)
static bool condition_number_2d (const Vector3D temp_vec[], size_t e_ind, PatchData &pd, double &fval, MsqError &err)
static bool condition_number_3d (const Vector3D temp_vec[], PatchData &, double &fval, MsqError &)
bool m_fcn_2e (double &obj, const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c)
bool g_fcn_2e (double &obj, Vector3D g_obj[3], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c)
bool h_fcn_2e (double &obj, Vector3D g_obj[3], Matrix3D h_obj[6], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c)
bool m_fcn_2i (double &obj, const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
bool g_fcn_2i (double &obj, Vector3D g_obj[3], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
bool h_fcn_2i (double &obj, Vector3D g_obj[3], Matrix3D h_obj[6], const Vector3D x[3], const Vector3D &n, const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
bool m_fcn_3e (double &obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3e (double &obj, Vector3D g_obj[4], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3e (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3e_v3 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3e_v0 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3e_v1 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3e_v2 (double &obj, Vector3D &g_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3e_v3 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3e_v0 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3e_v1 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3e_v2 (double &obj, Vector3D &g_obj, Matrix3D &h_obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool m_fcn_3i (double &obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
bool g_fcn_3i (double &obj, Vector3D g_obj[4], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
int h_fcn_3i (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c, const Vector3D &d)
bool m_fcn_3p (double &obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3p (double &obj, Vector3D g_obj[4], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3p (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool m_fcn_3w (double &obj, const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool g_fcn_3w (double &obj, Vector3D g_obj[4], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
bool h_fcn_3w (double &obj, Vector3D g_obj[4], Matrix3D h_obj[10], const Vector3D x[4], const double a, const Exponent &b, const Exponent &c)
void surface_to_2d (const MsqMatrix< 3, 2 > &A, const MsqMatrix< 3, 2 > &W_32, MsqMatrix< 2, 2 > &W_22, MsqMatrix< 3, 2 > &RZ)
 Calculate R and Z such that \(W\prime = Z^{-1} W\) and \(A\prime = (RZ)^{-1} A\).
static void append_elem_samples (PatchData &pd, size_t e, std::vector< size_t > &handles)
void get_sample_pt_evaluations (PatchData &pd, std::vector< size_t > &handles, bool free, MsqError &err)
void get_elem_sample_points (PatchData &pd, size_t elem, std::vector< size_t > &handles, MsqError &)
template<int DIM>
void gradient (size_t num_free_verts, const MsqVector< DIM > *dNdxi, const MsqMatrix< 3, DIM > &dmdA, std::vector< Vector3D > &grad)
 Calculate gradient from derivatives of mapping function terms and derivatives of target metric.
template<int DIM, typename MAT >
void hessian (size_t num_free_verts, const MsqVector< DIM > *dNdxi, const MsqMatrix< DIM, DIM > *d2mdA2, MAT *hess)
 Calculate Hessian from derivatives of mapping function terms and derivatives of target metric.
template<int DIM>
void hessian_diagonal (size_t num_free_verts, const MsqVector< DIM > *dNdxi, const MsqMatrix< DIM, DIM > *d2mdA2, SymMatrix3D *diagonal)
 Calculate Hessian from derivatives of mapping function terms and derivatives of target metric.
static void get_u_perp (const MsqVector< 3 > &u, MsqVector< 3 > &u_perp)
static bool project_to_perp_plane (MsqMatrix< 3, 2 > J, const MsqVector< 3 > &u, const MsqVector< 3 > &u_perp, MsqMatrix< 2, 2 > &A, MsqMatrix< 3, 2 > &S_a_transpose_Theta)
static void project_to_matrix_plane (const MsqMatrix< 3, 2 > &M_in, MsqMatrix< 2, 2 > &M_out, MsqVector< 3 > &u, MsqVector< 3 > &u_perp)
static void populate_data (PatchData &pd, CachedTargetData *data, TargetCalculator *calc, MsqError &err)
static bool ideal_constant_skew_I_3D (EntityTopology element_type, MsqMatrix< 3, 3 > &q)
static bool ideal_constant_skew_I_2D (EntityTopology element_type, MsqMatrix< 2, 2 > &q)
static NodeSet get_nodeset (EntityTopology type, int num_nodes, MsqError &err)
static TagHandle get_tag (Mesh *mesh, unsigned num_matrices, unsigned dimension, const char *base_name, bool orient_surface, MsqError &err)
static double da (double dot)
static TagHandle get_tag (Mesh *mesh, unsigned num_doubles, const std::string &base_name, MsqError &err)
template<unsigned Dim>
static double do_finite_difference (int r, int c, AWMetric *metric, MsqMatrix< Dim, Dim > A, const MsqMatrix< Dim, Dim > &W, double value, MsqError &err)
template<unsigned Dim>
static bool do_numerical_gradient (AWMetric *mu, MsqMatrix< Dim, Dim > A, const MsqMatrix< Dim, Dim > &W, double &result, MsqMatrix< Dim, Dim > &wrt_A, MsqError &err)
template<unsigned Dim>
static bool do_numerical_hessian (AWMetric *metric, MsqMatrix< Dim, Dim > A, const MsqMatrix< Dim, Dim > &W, double &value, MsqMatrix< Dim, Dim > &grad, MsqMatrix< Dim, Dim > *Hess, MsqError &err)
template<unsigned DIM>
static bool eval (const MsqMatrix< DIM, DIM > &T, double &result)
template<unsigned DIM>
static bool grad (const MsqMatrix< DIM, DIM > &T, double &result, MsqMatrix< DIM, DIM > &wrt_T)
template<unsigned DIM>
static bool hess (const MsqMatrix< DIM, DIM > &T, double &result, MsqMatrix< DIM, DIM > &deriv_wrt_T, MsqMatrix< DIM, DIM > *second_wrt_T)
template<unsigned DIM>
static bool eval (const MsqMatrix< DIM, DIM > &A, const MsqMatrix< DIM, DIM > &W, double &result)
template<unsigned DIM>
static bool grad (const MsqMatrix< DIM, DIM > &A, const MsqMatrix< DIM, DIM > &W, double &result, MsqMatrix< DIM, DIM > &deriv)
template<unsigned DIM>
static bool hess (const MsqMatrix< DIM, DIM > &A, const MsqMatrix< DIM, DIM > &W, double &result, MsqMatrix< DIM, DIM > &deriv, MsqMatrix< DIM, DIM > *second)
template<unsigned Dim>
static double do_finite_difference (int r, int c, TMetric *metric, MsqMatrix< Dim, Dim > A, double value, MsqError &err)
template<unsigned Dim>
static bool do_numerical_gradient (TMetric *mu, MsqMatrix< Dim, Dim > A, double &result, MsqMatrix< Dim, Dim > &wrt_A, MsqError &err)
template<unsigned Dim>
static bool do_numerical_hessian (TMetric *metric, MsqMatrix< Dim, Dim > A, double &value, MsqMatrix< Dim, Dim > &grad, MsqMatrix< Dim, Dim > *Hess, MsqError &err)
template<unsigned D>
void hess_scale_t (MsqMatrix< D, D > R[D *(D+1)/2], double alpha)
 \( R *= s \)
void hess_scale (MsqMatrix< 3, 3 > R[6], double alpha)
void hess_scale (MsqMatrix< 2, 2 > R[3], double alpha)
void set_scaled_I (MsqMatrix< 3, 3 > R[6], double alpha)
 \( R = \alpha I_9 \)
void pluseq_scaled_I (MsqMatrix< 3, 3 > R[6], double alpha)
 \( R += \alpha I_9 \)
void pluseq_scaled_I (MsqMatrix< 3, 3 > &R, double alpha)
 \( R += \alpha I_9 \)
void set_scaled_I (MsqMatrix< 2, 2 > R[3], double alpha)
 \( R = \alpha I_4 \)
void pluseq_scaled_I (MsqMatrix< 2, 2 > R[3], double alpha)
 \( R += \alpha I_4 \)
void pluseq_scaled_I (MsqMatrix< 2, 2 > &R, double alpha)
 \( R += \alpha I_4 \)
void pluseq_scaled_2nd_deriv_of_det (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &T)
 \( R += \alpha \frac{\partial}{\partial T}det(T) \)
void pluseq_scaled_2nd_deriv_of_det (MsqMatrix< 2, 2 > R[3], double alpha)
 \( R += \alpha \frac{\partial}{\partial T}det(T) \)
void pluseq_scaled_2nd_deriv_of_det (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &)
void set_scaled_2nd_deriv_of_det (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &T)
 \( R = \alpha \frac{\partial}{\partial T}det(T) \)
void set_scaled_2nd_deriv_of_det (MsqMatrix< 2, 2 > R[3], double alpha)
 \( R = \alpha \frac{\partial}{\partial T}det(T) \)
void set_scaled_2nd_deriv_of_det (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &)
void pluseq_scaled_2nd_deriv_tr_adj (MsqMatrix< 2, 2 > R[3], double alpha)
 \( R += \alpha \frac{\partial^2}{\partial T^2}tr(adj T) \)
void pluseq_scaled_2nd_deriv_tr_adj (MsqMatrix< 3, 3 > R[6], double alpha)
 \( R += \alpha \frac{\partial^2}{\partial T^2}tr(adj T) \)
void set_scaled_2nd_deriv_norm_sqr_adj (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &T)
 \( R += \alpha \frac{\partial^2}{\partial T^2}|adj T|^2 \)
void set_scaled_2nd_deriv_norm_sqr_adj (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &T)
 \( R += \alpha \frac{\partial^2}{\partial T^2}|adj T|^2 \)
template<unsigned D>
void pluseq_scaled_outer_product_t (MsqMatrix< D, D > R[D *(D+1)/2], double alpha, const MsqMatrix< D, D > &M)
 \( R += \alpha \left( M \otimes M \right) \)
void pluseq_scaled_outer_product (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &M)
void pluseq_scaled_outer_product (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &M)
template<unsigned D>
void set_scaled_outer_product_t (MsqMatrix< D, D > R[D *(D+1)/2], double alpha, const MsqMatrix< D, D > &M)
 \( R = \alpha \left( M \otimes M \right) \)
void set_scaled_outer_product (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &M)
void set_scaled_outer_product (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &M)
void pluseq_scaled_sum_outer_product (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &B)
 \( R += \alpha \left( A \otimes B + B \otimes A \right) \)
void pluseq_scaled_sum_outer_product (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &B)
 \( R += \alpha \left( A \otimes B + B \otimes A \right) \)
void set_scaled_sum_outer_product (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &A, const MsqMatrix< 3, 3 > &B)
 \( R = \alpha \left( A \otimes B + B \otimes A \right) \)
void set_scaled_sum_outer_product (MsqMatrix< 2, 2 > R[3], double alpha, const MsqMatrix< 2, 2 > &A, const MsqMatrix< 2, 2 > &B)
 \( R = \alpha \left( A \otimes B + B \otimes A \right) \)
void pluseq_scaled_outer_product_I_I (MsqMatrix< 3, 3 > R[6], double alpha)
 \( R += \alpha (I \otimes I) \)
void pluseq_scaled_outer_product_I_I (MsqMatrix< 2, 2 > R[3], double alpha)
 \( R += \alpha (I \otimes I) \)
void pluseq_I_outer_product (MsqMatrix< 3, 3 > R[6], const MsqMatrix< 3, 3 > &A)
 \( R += I \otimes A \)
void pluseq_outer_product_I (MsqMatrix< 3, 3 > R[6], const MsqMatrix< 3, 3 > &A)
 \( R += A \otimes I \)
template<unsigned D>
void pluseq_scaled_sum_outer_product_I_t (MsqMatrix< D, D > R[D *(D+1)/2], double alpha, const MsqMatrix< D, D > &A)
 \( R += \alpha \left( I \otimes A + A \otimes I \right) \)
void pluseq_scaled_sum_outer_product_I (MsqMatrix< 3, 3 > R[6], double alpha, const MsqMatrix< 3, 3 > &A_in)
void pluseq_scaled_sum_outer_product_I (MsqMatrix< 2, 2 > R[2], double alpha, const MsqMatrix< 2, 2 > &A_in)
template<unsigned D>
void second_deriv_wrt_product_factor_t (MsqMatrix< D, D > R[D *(D+1)/2], const MsqMatrix< D, D > &Z)
 \( \frac{\partial^2 f}{\partial (AZ)^2} \Rightarrow \frac{\partial^2 f}{\partial A^2} \)
void second_deriv_wrt_product_factor (MsqMatrix< 3, 3 > R[6], const MsqMatrix< 3, 3 > &Z)
void second_deriv_wrt_product_factor (MsqMatrix< 2, 2 > R[3], const MsqMatrix< 2, 2 > &Z)
void set_scaled_2nd_deriv_wrt_psi (MsqMatrix< 2, 2 > R[3], const double alpha, const double psi, const MsqMatrix< 2, 2 > &T)
 \( R = \alpha * \frac{\partial^2 \psi(T)}{\partial T^2} \)
template<unsigned D>
void pluseq_scaled_t (MsqMatrix< D, D > R[D *(D+1)/2], double alpha, const MsqMatrix< D, D > Z[D *(D+1)/2])
 \( R = R + \alpha * Z \)
void pluseq_scaled_2nd_deriv_tr_adj (MsqMatrix< 2, 2 > *, double)
void pluseq_I_outer_product (MsqMatrix< 2, 2 > R[3], const MsqMatrix< 2, 2 > &A)
void pluseq_outer_product_I (MsqMatrix< 2, 2 > R[3], const MsqMatrix< 2, 2 > &A)
template<unsigned D>
void pluseq_scaled (MsqMatrix< D, D > R[D *(D+1)/2], double alpha, const MsqMatrix< D, D > Z[D *(D+1)/2])
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (CircleDomainTest,"CircleDomainTest")
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (CircleDomainTest,"Unit")
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (LineDomainTest,"LineDomainTest")
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (LineDomainTest,"Unit")
void destroy_patch_with_domain (PatchData &pd)
 must be called in sync with create_...._patch_with_domain
void move_vertex (PatchData &pd, const Vector3D &position, const Vector3D &delta, MsqError &err)
void create_one_hex_patch (PatchData &one_hex_patch, MsqError &err)
void create_one_tet_patch (PatchData &one_tet_patch, MsqError &err)
 creates a Patch containing an ideal tetrahedra
void create_one_pyr_patch (PatchData &one_pyr_patch, MsqError &err)
 create patch containing one ideal pyramid
void create_one_wdg_patch (PatchData &one_wdg_patch, MsqError &err)
 create patch containing one ideal wedge
void create_one_inverted_tet_patch (PatchData &one_tet_patch, MsqError &err)
 creates a Patch containing an ideal tetrahedra, inverted
void create_one_quad_patch (PatchData &one_qua_patch, MsqError &err)
 creates a Patch containing an ideal quadrilateral
void create_one_tri_patch (PatchData &one_tri_patch, MsqError &err)
void create_two_tri_patch (PatchData &pd, MsqError &err)
void create_four_quads_patch (PatchData &four_quads, MsqError &err)
void create_six_quads_patch_with_domain (PatchData &pd, MsqError &err)
void create_six_quads_patch_inverted_with_domain (PatchData &pd, MsqError &err)
void create_twelve_hex_patch (PatchData &pd, MsqError &err)
void create_twelve_hex_patch_inverted (PatchData &pd, MsqError &err)
void create_qm_two_tri_patch_with_domain (PatchData &triPatch, MsqError &err)
void create_qm_two_quad_patch_with_domain (PatchData &quadPatch, MsqError &err)
void create_qm_two_tet_patch (PatchData &tetPatch, MsqError &err)
void create_qm_two_pyr_patch (PatchData &pyrPatch, MsqError &err)
void create_qm_two_wdg_patch (PatchData &wdgPatch, MsqError &err)
void create_qm_two_hex_patch (PatchData &hexPatch, MsqError &err)
void create_ideal_element_patch (PatchData &pd, EntityTopology type, size_t num_nodes, MsqError &err)

Variables

const bool IQ_TRAP_FPE_DEFAULT = false
const unsigned long GRAD_FLAGS
const unsigned long OF_FLAGS
const unsigned long MOVEMENT_FLAGS
const bool OF_FREE_EVALS_ONLY = true
const int MSQ_MAX_NUM_VERT_PER_ENT = 8
const int MSQ_HIST_SIZE = 7
static const double MSQ_SQRT_TWO = std::sqrt( 2.0 )
static const double MSQ_SQRT_THREE = std::sqrt( 3.0 )
static const double MSQ_SQRT_THREE_DIV_TWO = MSQ_SQRT_THREE / 2.0
static const double MSQ_SQRT_THREE_INV = 1.0 / MSQ_SQRT_THREE
static const double MSQ_SQRT_TWO_INV = 1.0 / MSQ_SQRT_TWO
static const double MSQ_SQRT_TWO_DIV_SQRT_THREE = MSQ_SQRT_TWO / MSQ_SQRT_THREE
static const double MSQ_ONE_THIRD = 1.0 / 3.0
static const double MSQ_TWO_THIRDS = 2.0 / 3.0
static const double MSQ_3RT_2_OVER_6RT_3 = std::pow( 2 / MSQ_SQRT_THREE, MSQ_ONE_THIRD )
const unsigned MSQ_UINT_MAX = ~(unsigned)0
const int MSQ_INT_MAX = MSQ_UINT_MAX >> 1
const int MSQ_INT_MIN = ~MSQ_INT_MAX
const double MSQ_DBL_MIN = 1.0E-30
const double MSQ_MIN = MSQ_DBL_MIN
const double MSQ_DBL_MAX = 1.0E30
const double MSQ_MAX = MSQ_DBL_MAX
const double MSQ_MAX_CAP = 1.e6
static const unsigned edges [][2] = { { 0, 1 }, { 1, 2 }, { 2, 0 }, { 0, 3 }, { 1, 3 }, { 2, 3 } }
const double ft = 4.0 / 3.0
const double ho_dr [6][4]
const double ho_ds [6][4]
const double ho_dt [6][4]
static const int zeros [6] = { 0, 2, 1, 2, 1, 0 }
static const int signs [6] = { -1, 1, -1, -1, 1, 1 }
static const double edr [3][3] = { { 0.0, -2.0, 2.0 }, { 0.0, 2.0, 2.0 }, { 0.0, -2.0, -2.0 } }
static const double eds [3][3] = { { -2.0, -2.0, 0.0 }, { 2.0, 2.0, 0.0 }, { 2.0, -2.0, 0.0 } }
static const double fdr [] = { 0.0, 4.0 / 3.0, -4.0 / 3.0 }
static const double fds [] = { -4.0 / 3.0, 4.0 / 3.0, 0.0 }
static const char * nonlinear_error = "Attempt to use LinearHexahedron mapping function for a nonlinear element\n"
const unsigned xi = 0
const unsigned eta = 1
const unsigned zeta = 2
const int edge_dir [] = { xi, eta, xi, eta, zeta, zeta, zeta, zeta, xi, eta, xi, eta }
const int edge_beg [] = { 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7 }
const int edge_end [] = { 1, 2, 3, 0, 4, 5, 6, 7, 5, 6, 7, 4 }
const int edge_opposite [] = { 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1 }
const int edge_beg_orth1 []
const int edge_beg_orth2 []
const int edge_end_orth1 []
const int edge_end_orth2 []
const int face_vtx [6][4]
const int face_opp [6] = { 2, 3, 0, 1, 5, 4 }
const int face_dir [6] = { eta, xi, eta, xi, zeta, zeta }
static const int faces [5][5]
const int sign [2][4]
const PatchSet::PatchHandle GLOBAL_PATCH_HANDLE = 0
static Vector3D unit_quad [4]
static Vector3D unit_hex [8]
static Vector3D unit_edge_tri [3]
static Vector3D unit_edge_tet [4]
static Vector3D unit_edge_pyr [5]
static Vector3D unit_edge_wdg [6]
static Vector3D unit_height_pyr [5]
static Vector3D unit_tri [3]
static Vector3D unit_tet [4]
static Vector3D unit_pyr [5]
static Vector3D unit_wdg [6]
static Vector3D unit_hex_pyr [5]
const char * MESQUITE_FIELD_TAG = "MesquiteTags"
const char *const vtk_type_names []
const std::vector< size_t > dummy_list
const Vector3D dummy_vtx
const char long_polygon_name [] = "Polygon"
const char long_triangle_name [] = "Triangle"
const char long_quadrilateral_name [] = "Quadrilateral"
const char long_polyhedron_name [] = "Polyhedron"
const char long_tetrahedron_name [] = "Tetrahedron"
const char long_hexahedron_name [] = "Hexahedron"
const char long_prism_name [] = "Prism"
const char long_pyramid_name [] = "Pyramd"
const char long_septahedron_name [] = "Septahedron"
const char short_polygon_name [] = "Polygon"
const char short_triangle_name [] = "Tri"
const char short_quadrilateral_name [] = "Quad"
const char short_polyhedron_name [] = "Polyhedron"
const char short_tetrahedron_name [] = "Tet"
const char short_hexahedron_name [] = "Hex"
const char short_prism_name [] = "Pri"
const char short_pyramid_name [] = "Pyr"
const char short_septahedron_name [] = "Sept"
msq_sig_handler_t oldHandler = SIG_ERR
MBMesquite::StopWatchCollection GlobalStopWatches
const unsigned vtk_pixel_order [] = { 0, 1, 3, 2 }
const unsigned vtk_voxel_order [] = { 0, 1, 3, 2, 4, 5, 7, 6 }
const unsigned vtk_wedge_order []
const unsigned vtk_hex_order []
static const VtkTypeInfo typeInfoList []
const unsigned typeInfoListLen = sizeof( typeInfoList ) / sizeof( typeInfoList[0] )
const unsigned reverseIndexList [][3]
const double EPSILON = 1e-16
const int MSQ_MAX_OPT_ITER = 20
const double TRI_XFORM_VALS [] = { 1.0, -1.0 / sqrt( 3.0 ), 0.0, 2.0 / sqrt( 3.0 ) }
MsqMatrix< 2, 2 > TRI_XFORM (TRI_XFORM_VALS)
const double TET_XFORM_VALS []
MsqMatrix< 3, 3 > TET_XFORM (TET_XFORM_VALS)
static const std::string & barrier_violated_msg_aw
static const std::string & barrier_violated_msg
const int P = 3
const
DeformingDomainWrapper::MeshCharacteristic 
DEFAULT_METRIC_TYPE = DeformingDomainWrapper::SHAPE
const bool DEFAULT_CULLING = true
const double DEFAULT_CPU_TIME = 0.0
const double DEFAULT_MOVEMENT_FACTOR = 0.01
const int DEFAULT_INNER_ITERATIONS = 2
const char DEFAULT_CURVE_TAG [] = "MesquiteCurveFraction"
const
DeformingCurveSmoother::Scheme 
DEFAULT_CURVE_TYPE = DeformingCurveSmoother::PROPORTIONAL
const bool CULLING_DEFAULT = true
const int DEFAULT_ITERATION_LIMIT = 100
const double DEF_UNT_BETA = 1e-8
const double DEF_SUC_EPS = 1e-4
const double DEFAULT_BETA = 0.0
const int DEFUALT_PARALLEL_ITERATIONS = 10
const char *const VERTEX_BYTE_TAG_NAME = "MesquiteVertexByte"

Detailed Description

Implements the NonSmoothDescent class member functions.

NonSmoothDescent.cpp

Author:
Lori Freitag
Date:
2002-07-20

Typedef Documentation

Definition at line 63 of file MeshInterface.hpp.

typedef void( * MBMesquite::msq_sig_handler_t)(int)

Definition at line 36 of file MsqInterrupt.cpp.

typedef double MBMesquite::real

Definition at line 82 of file Mesquite.hpp.

Definition at line 80 of file Mesquite.hpp.

typedef void* MBMesquite::TagHandle

Type used to refer to a tag defintion

Definition at line 66 of file MeshInterface.hpp.

Definition at line 62 of file ParallelHelper.hpp.

Definition at line 61 of file MeshInterface.hpp.


Enumeration Type Documentation

Enumerator:
NO_SCHEME 
ELEMENT_AVG_QM 
ELEMENT_MAX_QM 
TMP_QUALITY_METRIC 
QUALITY_METRIC 

Definition at line 104 of file Mesquite.hpp.

Enumerator:
POLYGON 
TRIANGLE 
QUADRILATERAL 
POLYHEDRON 
TETRAHEDRON 
HEXAHEDRON 
PRISM 
PYRAMID 
SEPTAHEDRON 
MIXED 

Definition at line 90 of file Mesquite.hpp.

{
    POLYGON       = 7,
    TRIANGLE      = 8,
    QUADRILATERAL = 9,
    POLYHEDRON    = 10,
    TETRAHEDRON   = 11,
    HEXAHEDRON    = 12,
    PRISM         = 13,
    PYRAMID       = 14,
    SEPTAHEDRON   = 15,
    MIXED
};
Enumerator:
RELEASE 
BETA 
ALPHA 

Definition at line 118 of file Mesquite.hpp.

Enumerator:
COUNTERCLOCKWISE 
CLOCKWISE 

Definition at line 50 of file NonSmoothDescent.cpp.

Enumerator:
MSQ_FAILURE 
MSQ_SUCCESS 

Definition at line 84 of file Mesquite.hpp.

defines the termination criterion

Enumerator:
NONE 
GRADIENT_L2_NORM_ABSOLUTE 

checks the gradient \(\nabla f \) of objective function \(f : I\!\!R^{3N} \rightarrow I\!\!R \) against a double \(d\) and stops when \(\sqrt{\sum_{i=1}^{3N}\nabla f_i^2}<d\)

GRADIENT_INF_NORM_ABSOLUTE 

checks the gradient \(\nabla f \) of objective function \(f : I\!\!R^{3N} \rightarrow I\!\!R \) against a double \(d\) and stops when \( \max_{i=1}^{3N} \nabla f_i < d \)

GRADIENT_L2_NORM_RELATIVE 

terminates on the j_th iteration when \(\sqrt{\sum_{i=1}^{3N}\nabla f_{i,j}^2}<d\sqrt{\sum_{i=1}^{3N}\nabla f_{i,0}^2}\) That is, terminates when the norm of the gradient is small than some scaling factor times the norm of the original gradient.

GRADIENT_INF_NORM_RELATIVE 

terminates on the j_th iteration when \(\max_{i=1 \cdots 3N}\nabla f_{i,j}<d \max_{i=1 \cdots 3N}\nabla f_{i,0}\) That is, terminates when the norm of the gradient is small than some scaling factor times the norm of the original gradient. (Using the infinity norm.)

KKT 

Not yet implemented.

QUALITY_IMPROVEMENT_ABSOLUTE 

Terminates when the objective function value is smaller than the given scalar value.

QUALITY_IMPROVEMENT_RELATIVE 

Terminates when the objective function value is smaller than the given scalar value times the original objective function value.

NUMBER_OF_ITERATES 

Terminates when the number of iterations exceeds a given integer.

CPU_TIME 

Terminates when the algorithm exceeds an allotted time limit (given in seconds).

VERTEX_MOVEMENT_ABSOLUTE 

Terminates when a the maximum distance moved by any vertex during the previous iteration is below the given value.

VERTEX_MOVEMENT_ABS_EDGE_LENGTH 

Terminates when a the maximum distance moved by any vertex during the previous iteration is below a value calculated from the edge lengths of the initial mesh.

VERTEX_MOVEMENT_RELATIVE 

Terminates when a the maximum distance moved by any vertex during the previous iteration is below the given value times the maximum distance moved by any vertex over the entire course of the optimization.

SUCCESSIVE_IMPROVEMENTS_ABSOLUTE 

Terminates when the decrease in the objective function value since the previous iteration is below the given value.

SUCCESSIVE_IMPROVEMENTS_RELATIVE 

Terminates when the decrease in the objective function value since the previous iteration is below the given value times the decrease in the objective function value since the beginning of this optimization process.

BOUNDED_VERTEX_MOVEMENT 

Terminates when any vertex leaves the bounding box, defined by the given value, d. That is, when the absolute value of a single coordinate of vertex's position exceeds d.

UNTANGLED_MESH 

Terminate when no elements are inverted.

Definition at line 71 of file TerminationCriterion.cpp.

{
    NONE = 0,
    //! checks the gradient \f$\nabla f \f$ of objective function
    //! \f$f : I\!\!R^{3N} \rightarrow I\!\!R \f$ against a double \f$d\f$
    //! and stops when \f$\sqrt{\sum_{i=1}^{3N}\nabla f_i^2}<d\f$
    GRADIENT_L2_NORM_ABSOLUTE = 1 << 0,
    //! checks the gradient \f$\nabla f \f$ of objective function
    //! \f$f : I\!\!R^{3N} \rightarrow I\!\!R \f$ against a double \f$d\f$
    //! and stops when \f$ \max_{i=1}^{3N} \nabla f_i < d \f$
    GRADIENT_INF_NORM_ABSOLUTE = 1 << 1,
    //! terminates on the j_th iteration when
    //! \f$\sqrt{\sum_{i=1}^{3N}\nabla f_{i,j}^2}<d\sqrt{\sum_{i=1}^{3N}\nabla f_{i,0}^2}\f$
    //!  That is, terminates when the norm of the gradient is small
    //! than some scaling factor times the norm of the original gradient.
    GRADIENT_L2_NORM_RELATIVE = 1 << 2,
    //! terminates on the j_th iteration when
    //! \f$\max_{i=1 \cdots 3N}\nabla f_{i,j}<d \max_{i=1 \cdots 3N}\nabla f_{i,0}\f$
    //!  That is, terminates when the norm of the gradient is small
    //! than some scaling factor times the norm of the original gradient.
    //! (Using the infinity norm.)
    GRADIENT_INF_NORM_RELATIVE = 1 << 3,
    //! Not yet implemented.
    KKT = 1 << 4,
    //! Terminates when the objective function value is smaller than
    //! the given scalar value.
    QUALITY_IMPROVEMENT_ABSOLUTE = 1 << 5,
    //! Terminates when the objective function value is smaller than
    //! the given scalar value times the original objective function
    //! value.
    QUALITY_IMPROVEMENT_RELATIVE = 1 << 6,
    //! Terminates when the number of iterations exceeds a given integer.
    NUMBER_OF_ITERATES = 1 << 7,
    //! Terminates when the algorithm exceeds an allotted time limit
    //! (given in seconds).
    CPU_TIME = 1 << 8,
    //! Terminates when a the maximum distance moved by any vertex
    //! during the previous iteration is below the given value.
    VERTEX_MOVEMENT_ABSOLUTE = 1 << 9,
    //! Terminates when a the maximum distance moved by any vertex
    //! during the previous iteration is below a value calculated
    //! from the edge lengths of the initial mesh.
    VERTEX_MOVEMENT_ABS_EDGE_LENGTH = 1 << 10,
    //! Terminates when a the maximum distance moved by any vertex
    //! during the previous iteration is below the given value
    //! times the maximum distance moved by any vertex over the
    //! entire course of the optimization.
    VERTEX_MOVEMENT_RELATIVE = 1 << 11,
    //! Terminates when the decrease in the objective function value since
    //! the previous iteration is below the given value.
    SUCCESSIVE_IMPROVEMENTS_ABSOLUTE = 1 << 12,
    //! Terminates when the decrease in the objective function value since
    //! the previous iteration is below the given value times the
    //! decrease in the objective function value since the beginning
    //! of this optimization process.
    SUCCESSIVE_IMPROVEMENTS_RELATIVE = 1 << 13,
    //! Terminates when any vertex leaves the bounding box, defined
    //! by the given value, d.  That is, when the absolute value of
    //! a single coordinate of vertex's position exceeds d.
    BOUNDED_VERTEX_MOVEMENT = 1 << 14,
    //! Terminate when no elements are inverted
    UNTANGLED_MESH = 1 << 15
};

Function Documentation

MsqMatrix< 2, 2 > MBMesquite::adj ( const MsqMatrix< 2, 2 > &  m) [inline]

Definition at line 997 of file MsqMatrix.hpp.

Referenced by moab::Skinner::add_adjacency(), all_adjacency_regression(), check_meshset_common(), check_order_by_sets_and_adj(), check_set_contents(), MBMesquite::MeshImplData::clear_element(), moab::ReadHDF5::delete_non_side_elements(), MBMesquite::TShapeSize3DB2::evaluate(), MBMesquite::AWShape2DB1::evaluate(), MBMesquite::AWShape2DNB2::evaluate(), MBMesquite::TShapeSizeOrientB2::evaluate(), MBMesquite::TShape3DB2::evaluate(), MBMesquite::AffineMapMetric::evaluate(), MBMesquite::TShapeSize3DB2::evaluate_with_grad(), MBMesquite::AWShape2DNB2::evaluate_with_grad(), MBMesquite::TShape3DB2::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB2::evaluate_with_grad(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::AffineMapMetric::evaluate_with_indices(), moab::Skinner::find_match(), find_side(), moab::Skinner::find_skin_vertices_1D(), moab::Skinner::find_skin_vertices_2D(), moab::Skinner::find_skin_vertices_3D(), MBMesquite::PatchData::get_adjacent_vertex_indices(), moab::ReorderTool::int_order_from_sets_and_adj(), moab::MeshSet::intersect(), inverse(), main(), mb_skin_verts_common(), mb_upward_adjacencies_test(), moab::MergeMesh::merge_higher_dimensions(), moab::Core::print_database(), print_elem_desc(), prism_issue(), moab::Skinner::remove_adjacency(), MBMesquite::MeshImplData::set_element(), MBMesquite::MeshImplData::skin(), QualityMetricTest::test_diagonal_tau(), test_getEntArrAdj_conn(), test_getEntArrAdj_down(), test_getEntArrAdj_none(), test_getEntArrAdj_up(), test_getEntArrAdj_vertex(), QualityMetricTest::test_gradient_tau(), QualityMetricTest::test_Hessian_tau(), test_read_handle_tag_common(), test_read_side(), SlaveBoundaryVerticesTest::test_slaved_common(), test_wedges(), MBMesquite::MeshImpl::vertices_get_attached_elements(), and moab::FBEngine::weave_lateral_face_from_edges().

{
    MsqMatrix< 2, 2 > result;
    result( 0, 0 ) = m( 1, 1 );
    result( 0, 1 ) = -m( 0, 1 );
    result( 1, 0 ) = -m( 1, 0 );
    result( 1, 1 ) = m( 0, 0 );
    return result;
}
MsqMatrix< 3, 3 > MBMesquite::adj ( const MsqMatrix< 3, 3 > &  m) [inline]

Definition at line 1017 of file MsqMatrix.hpp.

{
    MsqMatrix< 3, 3 > result;

    result( 0, 0 ) = m( 1, 1 ) * m( 2, 2 ) - m( 1, 2 ) * m( 2, 1 );
    result( 0, 1 ) = m( 0, 2 ) * m( 2, 1 ) - m( 0, 1 ) * m( 2, 2 );
    result( 0, 2 ) = m( 0, 1 ) * m( 1, 2 ) - m( 0, 2 ) * m( 1, 1 );

    result( 1, 0 ) = m( 1, 2 ) * m( 2, 0 ) - m( 1, 0 ) * m( 2, 2 );
    result( 1, 1 ) = m( 0, 0 ) * m( 2, 2 ) - m( 0, 2 ) * m( 2, 0 );
    result( 1, 2 ) = m( 0, 2 ) * m( 1, 0 ) - m( 0, 0 ) * m( 1, 2 );

    result( 2, 0 ) = m( 1, 0 ) * m( 2, 1 ) - m( 1, 1 ) * m( 2, 0 );
    result( 2, 1 ) = m( 0, 1 ) * m( 2, 0 ) - m( 0, 0 ) * m( 2, 1 );
    result( 2, 2 ) = m( 0, 0 ) * m( 1, 1 ) - m( 0, 1 ) * m( 1, 0 );

    return result;
}
static void MBMesquite::append_elem_samples ( PatchData &  pd,
size_t  e,
std::vector< size_t > &  handles 
) [inline, static]

Definition at line 115 of file TargetMetricUtil.cpp.

References MBMesquite::NodeSet::corner_node(), corners, edges, MBMesquite::PatchData::element_by_index(), faces, MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::PatchData::get_samples(), MBMesquite::ElemSampleQM::handle(), MBMesquite::NodeSet::mid_edge_node(), MBMesquite::NodeSet::mid_face_node(), MBMesquite::NodeSet::mid_region_node(), and MBMesquite::NodeSet::num_nodes().

Referenced by get_elem_sample_points(), and get_sample_pt_evaluations().

{
    NodeSet samples     = pd.get_samples( e );
    EntityTopology type = pd.element_by_index( e ).get_element_type();
    size_t curr_size    = handles.size();
    handles.resize( curr_size + samples.num_nodes() );
    std::vector< size_t >::iterator i = handles.begin() + curr_size;
    for( unsigned j = 0; j < TopologyInfo::corners( type ); ++j )
        if( samples.corner_node( j ) ) *( i++ ) = ElemSampleQM::handle( Sample( 0, j ), e );
    for( unsigned j = 0; j < TopologyInfo::edges( type ); ++j )
        if( samples.mid_edge_node( j ) ) *( i++ ) = ElemSampleQM::handle( Sample( 1, j ), e );
    for( unsigned j = 0; j < TopologyInfo::faces( type ); ++j )
        if( samples.mid_face_node( j ) ) *( i++ ) = ElemSampleQM::handle( Sample( 2, j ), e );
    if( TopologyInfo::dimension( type ) == 3 && samples.mid_region_node() )
        *( i++ ) = ElemSampleQM::handle( Sample( 3, 0 ), e );
}
template<typename T >
T* MBMesquite::arrptr ( std::vector< T > &  v,
bool  check_zero_size = false 
) [inline]

get array pointer from std::vector

Definition at line 245 of file Mesquite.hpp.

Referenced by MBMesquite::TerminationCriterion::accumulate_inner(), VtkTest::check_4quad_structured(), VtkTest::check_8hex_structured(), AveragingQMTest::check_average_and_weights(), VtkTest::check_field_attrib(), ExodusTest::check_mesh(), check_no_slaved_corners(), check_results(), check_slaved_coords(), MBMesquite::DomainClassifier::classify_by_tag(), MBMesquite::DomainClassifier::classify_geometrically(), MBMesquite::DomainClassifier::classify_skin_geometrically(), BCDTest::compare_bcd(), compare_node_coords(), compare_nodes(), MBMesquite::TagVertexMesh::copy_all_coordinates(), MBMesquite::BoundedCylinderDomain::create_curve(), MBMesquite::MsqIRel::domain_DoF(), elem_areas(), MBMesquite::MsqMOAB::elements_get_attached_vertices(), MBMesquite::MsqIMesh::elements_get_topologies(), MBMesquite::VertexConditionNumberQualityMetric::evaluate(), MBMesquite::TQualityMetric::evaluate_with_gradient(), MBMesquite::AWQualityMetric::evaluate_with_gradient(), MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient(), MBMesquite::TQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::TQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::AWQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal(), MBMesquite::TMPQualityMetric::evaluate_with_indices(), MBMesquite::PatchData::fill(), find_skin(), find_z10_extreme_elements(), MBMesquite::SphericalDomain::fit_vertices(), MBMesquite::PlanarDomain::fit_vertices(), geom_classify_elements(), MBMesquite::MsqIMesh::get_adjacent_entities(), MBMesquite::MsqMOAB::get_adjacent_entities(), MBMesquite::MeshImpl::get_all_elements(), MBMesquite::MsqIMesh::get_all_elements(), MBMesquite::MsqMOAB::get_all_elements(), MBMesquite::MeshImpl::get_all_vertices(), MBMesquite::MsqIMesh::get_all_vertices(), MBMesquite::MsqMOAB::get_all_vertices(), IdealTargetTest::get_calc_target(), MBMesquite::PatchData::get_connectivity_array(), MBMesquite::MsqCommonIGeom::get_dimension(), MBMesquite::PatchData::get_element_array(), MBMesquite::PatchData::get_element_handles_array(), MBMesquite::PatchData::get_element_index(), MBMesquite::MsqMOAB::get_flag_data(), MBMesquite::MsqIMesh::get_flag_data(), PatchDataTest::get_higher_order_vertices(), QualityMetricTester::get_ideal_element(), MBMesquite::VertexPatches::get_patch(), MBMesquite::VertexPatches::get_patch_handles(), PatchDataTest::get_quad8_mesh(), MBMesquite::ReferenceMesh::get_reference_vertex_coordinates(), get_slaved_coords(), MBMesquite::ConjugateGradient::get_step(), MBMesquite::PatchData::get_subpatch(), MBMesquite::PatchData::get_vertex_array(), MBMesquite::PatchData::get_vertex_handles_array(), MBMesquite::PatchData::get_vertex_index(), MBMesquite::PatchData::initialize_data(), MBMesquite::Instruction::initialize_vertex_byte(), is_side_boundary(), MBMesquite::TargetWriter::loop_over_mesh(), MBMesquite::SlaveBoundaryVertices::loop_over_mesh(), main(), make_domain(), iMeshTest::matchElementConnectivity(), iMeshTest::matchVertexCoordinates(), MBMesquite::MeshUtil::meshes_are_different(), next_vertex(), MBMesquite::MsqCommonIGeom::normal(), UnOptimizer::optimize_vertex_positions(), MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::ConjugateGradient::optimize_vertex_positions(), MBMesquite::SteepestDescent::optimize_vertex_positions(), MBMesquite::FeasibleNewton::optimize_vertex_positions(), MBMesquite::QualityAssessor::Assessor::print_histogram(), process_domain_args(), MBMesquite::MeshImpl::read_exodus(), MBMesquite::TerminationCriterion::reset_inner(), run(), MBMesquite::QualityAssessor::scale_histograms(), MBMesquite::MsqIMesh::set_active_set(), MBMesquite::MsqMOAB::set_active_set(), MBMesquite::PatchData::set_mesh_entities(), XYRectangleTest::setUp(), MBMesquite::XYRectangle::setup(), MeshInterfaceTest::setUp(), MeshImplTest::skin_mesh_higher_order(), MeshImplTest::skin_mesh_mixed(), tag_patch_slaved(), AveragingQMTest::test_average_and_weights_geometric(), AveragingQMTest::test_average_and_weights_harmonic(), AveragingQMTest::test_average_and_weights_hms(), AveragingQMTest::test_average_and_weights_linear(), AveragingQMTest::test_average_and_weights_maximum(), AveragingQMTest::test_average_and_weights_minimum(), AveragingQMTest::test_average_and_weights_rms(), AveragingQMTest::test_average_and_weights_sum(), AveragingQMTest::test_average_and_weights_sum_squared(), DomainClassifierTest::test_classify_by_geometry(), DomainClassifierTest::test_classify_by_handle(), DomainClassifierTest::test_classify_by_tag(), DomainClassifierTest::test_classify_skin(), XYRectangleTest::test_closest_point(), BoundedCylinderDomainTest::test_create_curve_from_mesh(), PMeanPTemplateTest::test_diagonal(), ConicDomainTest::test_domain_DoF(), SphericalDomainTest::test_domain_DoF(), XYRectangleTest::test_domain_DoF(), MeshInterfaceTest::test_element_get_attached_vertex_indices(), MeshInterfaceTest::test_elements_get_topology(), SphericalDomainTest::test_fit_vertices(), PatchDataTest::test_fixed_by_geom_dim(), PMeanPTemplateTest::test_gradient(), TerminationCriterionTest::test_gradient_common(), PMeanPTemplateTest::test_Hessian(), ObjectiveFunctionTest::test_LInf_value(), ObjectiveFunctionTest::test_LPtoP_value(), ObjectiveFunctionTest::test_max_value(), XYRectangleTest::test_normal_at(), PatchDataTest::test_patch_data_mesh_calcualted_ho_nodes(), PatchDataTest::test_quad8_patch(), VtkTest::test_read_fixed_attrib(), VtkTest::test_read_quadratic(), VtkTest::test_read_simple_scalar_attrib(), VtkTest::test_read_unstructured(), VtkTest::test_read_vector_attrib(), SlaveBoundaryVerticesTest::test_slaved_common(), XYRectangleTest::test_snap_to(), ArrayMeshTest::test_tag_data(), QualityAssessorTest::test_tag_element(), QualityAssessorTest::test_tag_inverted(), QualityAssessorTest::test_tag_vertex(), MBMesquite::DomainClassifier::test_valid_classification(), DomainClassifierTest::test_valid_classification(), MeshInterfaceTest::test_vertex_byte(), MeshInterfaceTest::test_vertex_get_attached_elements(), MeshInterfaceTest::test_vertex_is_fixed(), PatchSetTest::test_vertex_patches(), MeshInterfaceTest::test_vertices(), iMeshTest::testDoubleTag(), iMeshTest::testIntTag(), iMeshTest::testVertexFlag(), iMeshTest::testVertexFlagNone(), tet_dihedral_angle_ratios(), MBMesquite::PatchData::update_cached_normals(), uwt(), MBMesquite::MsqMOAB::vertices_get_attached_elements(), MBMesquite::MsqIMesh::vertices_get_byte(), MBMesquite::MsqMOAB::vertices_get_byte(), MBMesquite::TagVertexMesh::vertices_get_coordinates(), MBMesquite::MsqIMesh::vertices_get_coordinates(), MBMesquite::MsqMOAB::vertices_get_coordinates(), MBMesquite::MsqIMesh::vertices_set_byte(), MBMesquite::MsqMOAB::vertices_set_byte(), MBMesquite::MeshImpl::vtk_read_polygons(), MBMesquite::MeshImpl::vtk_read_scalar_attrib(), MBMesquite::MeshImpl::vtk_read_unstructured_grid(), MBMesquite::MeshImpl::vtk_store_cell_data(), MBMesquite::MeshImpl::vtk_store_point_data(), MBMesquite::MeshWriter::write_eps_triangle(), MBMesquite::MeshImpl::write_exodus(), MBMesquite::MeshWriter::write_stl(), and MBMesquite::MeshImpl::write_vtk().

{
    if( check_zero_size && !v.size() ) return 0;
    assert( !v.empty() );
    return &v[0];
}
template<typename T >
const T* MBMesquite::arrptr ( const std::vector< T > &  v,
bool  check_zero_size = false 
) [inline]

Definition at line 252 of file Mesquite.hpp.

{
    if( check_zero_size && !v.size() ) return 0;
    assert( !v.empty() );
    return &v[0];
}
template<typename HessIter >
static double MBMesquite::average_corner_diagonals ( EntityTopology  type,
QualityMetric::AveragingMethod  method,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
HessIter  corner_diag_blocks,
Vector3D  vertex_grads[],
SymMatrix3D  vertex_hessians[],
MsqError &  err 
) [inline, static]

Definition at line 286 of file AveragingQM.cpp.

References corners, MBMesquite::QualityMetric::HARMONIC, MBMesquite::QualityMetric::HMS, inv(), MBMesquite::MsqError::INVALID_STATE, MBMesquite::QualityMetric::LINEAR, MSQ_SETERR, pmean_corner_diagonals(), MBMesquite::QualityMetric::RMS, MBMesquite::Vector3D::set(), MBMesquite::QualityMetric::SUM, sum_corner_diagonals(), sum_sqr_corner_diagonals(), and MBMesquite::QualityMetric::SUM_SQUARED.

Referenced by MBMesquite::AveragingQM::average_corner_hessian_diagonals().

{
    unsigned i;
    double avg, inv;

    // Zero gradients and Hessians
    const unsigned num_vertex = TopologyInfo::corners( type );
    for( i = 0; i < num_vertex; ++i )
    {
        vertex_grads[i].set( 0.0 );
        vertex_hessians[i] = SymMatrix3D( 0.0 );
    }

    switch( method )
    {
        case QualityMetric::SUM:
            avg = sum_corner_diagonals( type, num_corner, corner_values, corner_grads, corner_diag_blocks, vertex_grads,
                                        vertex_hessians );
            break;

        case QualityMetric::LINEAR:
            avg = sum_corner_diagonals( type, num_corner, corner_values, corner_grads, corner_diag_blocks, vertex_grads,
                                        vertex_hessians );
            inv = 1.0 / num_corner;
            avg *= inv;
            for( i = 0; i < num_vertex; ++i )
            {
                vertex_grads[i] *= inv;
                vertex_hessians[i] *= inv;
            }
            break;

        case QualityMetric::SUM_SQUARED:
            avg = sum_sqr_corner_diagonals( type, num_corner, corner_values, corner_grads, corner_diag_blocks,
                                            vertex_grads, vertex_hessians );
            break;

        case QualityMetric::RMS:
            avg = pmean_corner_diagonals( type, num_corner, corner_values, corner_grads, corner_diag_blocks,
                                          vertex_grads, vertex_hessians, 2.0 );
            break;

        case QualityMetric::HARMONIC:
            avg = pmean_corner_diagonals( type, num_corner, corner_values, corner_grads, corner_diag_blocks,
                                          vertex_grads, vertex_hessians, -1.0 );
            break;

        case QualityMetric::HMS:
            avg = pmean_corner_diagonals( type, num_corner, corner_values, corner_grads, corner_diag_blocks,
                                          vertex_grads, vertex_hessians, -2.0 );
            break;

        default:
            MSQ_SETERR( err )( "averaging method not available.", MsqError::INVALID_STATE );
            return 0.0;
    }

    return avg;
}
void MBMesquite::axpy ( Vector3D  res[],
size_t  size_r,
const MsqHessian &  H,
const Vector3D  x[],
size_t  size_x,
const Vector3D  y[],
size_t  size_y,
MsqError &   
) [inline]
Parameters:
res,:array of Vector3D in which the result is stored.
size_r,:size of the res array.
x,:vector multiplied by the Hessian.
size_x,:size of the x array.
y,:vector added to the Hessian vector product. Set to 0 (NULL) if not needed.
size_y,:size of the y array. Set to 0 if not needed.

Definition at line 252 of file MsqHessian.hpp.

References eqAx(), MBMesquite::MsqHessian::mColIndex, MBMesquite::MsqHessian::mEntries, MBMesquite::MsqHessian::mRowStart, MBMesquite::MsqHessian::mSize, plusEqAx(), and plusEqTransAx().

Referenced by MsqHessianTest::test_axpy().

{
    if( ( size_r != H.mSize ) || ( size_x != H.mSize ) || ( size_y != H.mSize && size_y != 0 ) )
    {
        // throw an error
    }

    Vector3D tmpx, tmpm;  // for cache opt.
    size_t* col     = H.mColIndex;
    const size_t nn = H.mSize;
    size_t rl;  // row length
    size_t el;  // entries index
    size_t lo;
    size_t c;  // column index
    size_t i, j;

    if( y != 0 )
    {
        for( i = 0; i < nn; ++i )
        {
            res[i] = y[i];
        }
    }
    else
    {  // y == 0
        for( i = 0; i < nn; ++i )
        {
            res[i] = 0.;
        }
    }

    el = 0;
    for( i = 0; i < nn; ++i )
    {
        rl = H.mRowStart[i + 1] - H.mRowStart[i];
        lo = *col++;

        // Diagonal entry
        tmpx = x[i];
        eqAx( tmpm, H.mEntries[el], tmpx );
        ++el;

        // Non-diagonal entries
        for( j = 1; j < rl; ++j )
        {
            c = *col++;
            //          res[i] += H.mEntries[e] * x[c];
            plusEqAx( tmpm, H.mEntries[el], x[c] );
            //          res[c] += transpose(H.mEntries[e]) * tmpxi;
            plusEqTransAx( res[c], H.mEntries[el], tmpx );
            ++el;
        }
        res[lo] += tmpm;
    }
}
double MBMesquite::cbrt_sqr ( double  d) [inline]

Definition at line 207 of file Mesquite.hpp.

References cbrt(), and MSQ_TWO_THIRDS.

Referenced by MBMesquite::Exponent::invTwoThirds(), and MBMesquite::Exponent::powTwoThirds().

{
#ifdef MOAB_HAVE_CBRT
    return ::cbrt( d * d );
#else
    return std::pow( d, MSQ_TWO_THIRDS );
#endif
}
static void MBMesquite::checkpoint_bytes ( Mesh *  mesh,
std::vector< unsigned char > &  saved_bytes,
MsqError &  err 
) [static]

Definition at line 441 of file VertexMover.cpp.

References MBMesquite::Mesh::get_all_vertices(), MSQ_ERRRTN, and MBMesquite::Mesh::vertices_get_byte().

Referenced by MBMesquite::VertexMover::loop_over_mesh().

{
    std::vector< Mesh::VertexHandle > vertexHandlesArray;
    mesh->get_all_vertices( vertexHandlesArray, err );MSQ_ERRRTN( err );
    saved_bytes.resize( vertexHandlesArray.size() );
    mesh->vertices_get_byte( &vertexHandlesArray[0], &saved_bytes[0], vertexHandlesArray.size(), err );MSQ_ERRRTN( err );
}
static int MBMesquite::coeff_eta_sign ( unsigned  coeff) [inline, static]

Definition at line 55 of file LinearHexahedron.cpp.

Referenced by derivatives_at_corner(), derivatives_at_mid_edge(), and derivatives_at_mid_face().

{
    return 2 * ( ( coeff / 2 ) % 2 ) - 1;
}
static int MBMesquite::coeff_xi_sign ( unsigned  coeff) [inline, static]

Definition at line 51 of file LinearHexahedron.cpp.

Referenced by derivatives_at_corner(), derivatives_at_mid_edge(), and derivatives_at_mid_face().

{
    return 2 * ( ( ( coeff + 1 ) / 2 ) % 2 ) - 1;
}
static int MBMesquite::coeff_zeta_sign ( unsigned  coeff) [inline, static]

Definition at line 59 of file LinearHexahedron.cpp.

Referenced by derivatives_at_corner(), derivatives_at_mid_edge(), and derivatives_at_mid_face().

{
    return 2 * ( coeff / 4 ) - 1;
}
static void MBMesquite::coefficients_at_corner ( unsigned  corner,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]
static void MBMesquite::coefficients_at_mid_edge ( unsigned  edge,
NodeSet  nodeset,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]

Definition at line 71 of file TetLagrangeShape.cpp.

References MBMesquite::NodeSet::mid_edge_node().

Referenced by MBMesquite::LinearPrism::coefficients(), MBMesquite::LinearHexahedron::coefficients(), MBMesquite::LinearPyramid::coefficients(), and MBMesquite::TetLagrangeShape::coefficients().

{
    if( nodeset.mid_edge_node( edge ) )
    {  // if mid-edge node is present
        num_coeff      = 1;
        indices_out[0] = 4 + edge;
        coeff_out[0]   = 1.0;
    }
    else
    {  // no mid node on edge
        num_coeff    = 2;
        coeff_out[0] = coeff_out[1] = 0.5;
        if( edge < 3 )
        {
            indices_out[0] = edge;
            indices_out[1] = ( edge + 1 ) % 3;
        }
        else
        {
            indices_out[0] = edge - 3;
            indices_out[1] = 3;
        }
    }
}
static void MBMesquite::coefficients_at_mid_edge ( unsigned  edge,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]

Definition at line 85 of file LinearHexahedron.cpp.

References edge_beg, and edge_end.

{
    num_coeff      = 2;
    coeff_out[0]   = 0.5;
    coeff_out[1]   = 0.5;
    indices_out[0] = edge_beg[edge];
    indices_out[1] = edge_end[edge];
}
static void MBMesquite::coefficients_at_mid_elem ( double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]

Definition at line 116 of file LinearHexahedron.cpp.

{
    num_coeff      = 8;
    coeff_out[0]   = 0.125;
    coeff_out[1]   = 0.125;
    coeff_out[2]   = 0.125;
    coeff_out[3]   = 0.125;
    coeff_out[4]   = 0.125;
    coeff_out[5]   = 0.125;
    coeff_out[6]   = 0.125;
    coeff_out[7]   = 0.125;
    indices_out[0] = 0;
    indices_out[1] = 1;
    indices_out[2] = 2;
    indices_out[3] = 3;
    indices_out[4] = 4;
    indices_out[5] = 5;
    indices_out[6] = 6;
    indices_out[7] = 7;
}
static void MBMesquite::coefficients_at_mid_elem ( NodeSet  nodeset,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]

Definition at line 200 of file TetLagrangeShape.cpp.

References MBMesquite::NodeSet::mid_edge_node().

Referenced by MBMesquite::LinearPrism::coefficients(), MBMesquite::LinearHexahedron::coefficients(), MBMesquite::LinearPyramid::coefficients(), and MBMesquite::TetLagrangeShape::coefficients().

{
    num_coeff      = 4;
    indices_out[0] = 0;
    indices_out[1] = 1;
    indices_out[2] = 2;
    indices_out[3] = 3;
    coeff_out[0]   = -0.125;
    coeff_out[1]   = -0.125;
    coeff_out[2]   = -0.125;
    coeff_out[3]   = -0.125;
    if( nodeset.mid_edge_node( 0 ) )
    {
        indices_out[num_coeff] = 4;
        coeff_out[num_coeff]   = 0.25;
        ++num_coeff;
    }
    else
    {
        coeff_out[0] += 0.125;
        coeff_out[1] += 0.125;
    }
    if( nodeset.mid_edge_node( 1 ) )
    {
        indices_out[num_coeff] = 5;
        coeff_out[num_coeff]   = 0.25;
        ++num_coeff;
    }
    else
    {
        coeff_out[1] += 0.125;
        coeff_out[2] += 0.125;
    }
    if( nodeset.mid_edge_node( 2 ) )
    {
        indices_out[num_coeff] = 6;
        coeff_out[num_coeff]   = 0.25;
        ++num_coeff;
    }
    else
    {
        coeff_out[2] += 0.125;
        coeff_out[0] += 0.125;
    }
    if( nodeset.mid_edge_node( 3 ) )
    {
        indices_out[num_coeff] = 7;
        coeff_out[num_coeff]   = 0.25;
        ++num_coeff;
    }
    else
    {
        coeff_out[0] += 0.125;
        coeff_out[3] += 0.125;
    }
    if( nodeset.mid_edge_node( 4 ) )
    {
        indices_out[num_coeff] = 8;
        coeff_out[num_coeff]   = 0.25;
        ++num_coeff;
    }
    else
    {
        coeff_out[1] += 0.125;
        coeff_out[3] += 0.125;
    }
    if( nodeset.mid_edge_node( 5 ) )
    {
        indices_out[num_coeff] = 9;
        coeff_out[num_coeff]   = 0.25;
        ++num_coeff;
    }
    else
    {
        coeff_out[2] += 0.125;
        coeff_out[3] += 0.125;
    }
}
static void MBMesquite::coefficients_at_mid_face ( unsigned  face,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]

Definition at line 103 of file LinearHexahedron.cpp.

References face_vtx.

{
    num_coeff      = 4;
    coeff_out[0]   = 0.25;
    coeff_out[1]   = 0.25;
    coeff_out[2]   = 0.25;
    coeff_out[3]   = 0.25;
    indices_out[0] = face_vtx[face][0];
    indices_out[1] = face_vtx[face][1];
    indices_out[2] = face_vtx[face][2];
    indices_out[3] = face_vtx[face][3];
}
static void MBMesquite::coefficients_at_mid_face ( unsigned  face,
NodeSet  nodeset,
double *  coeff_out,
size_t *  indices_out,
size_t &  num_coeff 
) [static]

Definition at line 100 of file TetLagrangeShape.cpp.

References MBMesquite::NodeSet::mid_edge_node().

Referenced by MBMesquite::LinearPrism::coefficients(), MBMesquite::LinearHexahedron::coefficients(), MBMesquite::LinearPyramid::coefficients(), and MBMesquite::TetLagrangeShape::coefficients().

{
    const double one_ninth  = 1.0 / 9.0;
    const double two_ninth  = 2.0 / 9.0;
    const double four_ninth = 4.0 / 9.0;

    if( face < 3 )
    {
        const int next = ( face + 1 ) % 3;
        indices_out[0] = face;
        indices_out[1] = next;
        indices_out[2] = 3;
        coeff_out[0]   = -one_ninth;
        coeff_out[1]   = -one_ninth;
        coeff_out[2]   = -one_ninth;
        num_coeff      = 3;
        if( nodeset.mid_edge_node( face ) )
        {
            indices_out[num_coeff] = 4 + face;
            coeff_out[num_coeff]   = four_ninth;
            ++num_coeff;
        }
        else
        {
            coeff_out[0] += two_ninth;
            coeff_out[1] += two_ninth;
        }
        if( nodeset.mid_edge_node( 3 + next ) )
        {
            indices_out[num_coeff] = 7 + next;
            coeff_out[num_coeff]   = four_ninth;
            ++num_coeff;
        }
        else
        {
            coeff_out[1] += two_ninth;
            coeff_out[2] += two_ninth;
        }
        if( nodeset.mid_edge_node( 3 + face ) )
        {
            indices_out[num_coeff] = 7 + face;
            coeff_out[num_coeff]   = four_ninth;
            ++num_coeff;
        }
        else
        {
            coeff_out[0] += two_ninth;
            coeff_out[2] += two_ninth;
        }
    }
    else
    {
        assert( face == 3 );
        indices_out[0] = 0;
        indices_out[1] = 1;
        indices_out[2] = 2;
        coeff_out[0]   = -one_ninth;
        coeff_out[1]   = -one_ninth;
        coeff_out[2]   = -one_ninth;
        num_coeff      = 3;
        if( nodeset.mid_edge_node( 0 ) )
        {
            indices_out[num_coeff] = 4;
            coeff_out[num_coeff]   = four_ninth;
            ++num_coeff;
        }
        else
        {
            coeff_out[0] += two_ninth;
            coeff_out[1] += two_ninth;
        }
        if( nodeset.mid_edge_node( 1 ) )
        {
            indices_out[num_coeff] = 5;
            coeff_out[num_coeff]   = four_ninth;
            ++num_coeff;
        }
        else
        {
            coeff_out[1] += two_ninth;
            coeff_out[2] += two_ninth;
        }
        if( nodeset.mid_edge_node( 2 ) )
        {
            indices_out[num_coeff] = 6;
            coeff_out[num_coeff]   = four_ninth;
            ++num_coeff;
        }
        else
        {
            coeff_out[2] += two_ninth;
            coeff_out[0] += two_ninth;
        }
    }
}
template<unsigned RC>
double MBMesquite::cofactor ( const MsqMatrix< RC, RC > &  m,
unsigned  r,
unsigned  c 
) [inline]

Definition at line 966 of file MsqMatrix.hpp.

References det(), and sign.

{
    const double sign[] = { 1.0, -1.0 };
    return sign[( r + c ) % 2] * det( MsqMatrix< RC - 1, RC - 1 >( m, r, c ) );
}
static bool MBMesquite::compare_sides ( unsigned  num_vtx,
const unsigned *  idx_set_1,
const Mesh::VertexHandle *  vtx_set_1,
const unsigned *  idx_set_2,
const Mesh::VertexHandle *  vtx_set_2 
) [static]

Helper function for 'find_skin'.

Check the vertices on element sides to see if the elements are adjacent.

Parameters:
num_vtxNumber of vertices in each element side
idx_set_1Indices into the first element's vertex list at which the side vertices are located.
vtx_set_1Vertex of first element.
idx_set_2Indices into the second element's vertex list at which the side vertices are located.
vtx_set_2Vertex of second element.

Definition at line 149 of file DomainClassifier.cpp.

Referenced by TopologyInfoTest::compare_sides(), find_skin(), and is_side_boundary().

{
    unsigned i;
    for( i = 0;; ++i )
    {
        if( i >= num_vtx ) return false;
        if( vtx_set_1[idx_set_1[0]] == vtx_set_2[idx_set_2[i]] ) break;
    }

    if( num_vtx == 1 ) return true;

    if( vtx_set_1[idx_set_1[1]] == vtx_set_2[idx_set_2[( i + 1 ) % num_vtx]] )
    {
        for( unsigned j = 2; j < num_vtx; ++j )
            if( vtx_set_1[idx_set_1[j]] != vtx_set_2[idx_set_2[( i + j ) % num_vtx]] ) return false;
        return true;
    }
    else if( vtx_set_1[idx_set_1[1]] == vtx_set_2[idx_set_2[( i + num_vtx - 1 ) % num_vtx]] )
    {
        for( unsigned j = 2; j < num_vtx; ++j )
            if( vtx_set_1[idx_set_1[j]] != vtx_set_2[idx_set_2[( i + num_vtx - j ) % num_vtx]] ) return false;
        return true;
    }
    else
    {
        return false;
    }
}
static double MBMesquite::condition3x3 ( const double  A[9]) [static]

Definition at line 1270 of file NonSmoothDescent.cpp.

References EPSILON.

Referenced by MBMesquite::NonSmoothDescent::singular_test().

{
    //   int ierr;
    double a11, a12, a13;
    double a21, a22, a23;
    double a31, a32, a33;
    //   double s1, s2, s4, s3, t0;
    double s1, s2, s3;
    double denom;
    //   double one = 1.0;
    double temp;
    bool zero_denom = true;

    a11 = A[0];
    a12 = A[1];
    a13 = A[2];
    a21 = A[3];
    a22 = A[4];
    a23 = A[5];
    a31 = A[6];
    a32 = A[7];
    a33 = A[8];

    denom = -a11 * a22 * a33 + a11 * a23 * a32 + a21 * a12 * a33 - a21 * a13 * a32 - a31 * a12 * a23 + a31 * a13 * a22;

    if( ( fabs( a11 ) > EPSILON ) && ( fabs( denom / a11 ) > EPSILON ) )
    {
        zero_denom = false;
    }
    if( ( fabs( a22 ) > EPSILON ) && ( fabs( denom / a22 ) > EPSILON ) )
    {
        zero_denom = false;
    }
    if( ( fabs( a33 ) > EPSILON ) && ( fabs( denom / a33 ) > EPSILON ) )
    {
        zero_denom = false;
    }

    if( zero_denom )
    {
        return HUGE_VAL;
    }
    else
    {
        s1 = sqrt( a11 * a11 + a12 * a12 + a13 * a13 + a21 * a21 + a22 * a22 + a23 * a23 + a31 * a31 + a32 * a32 +
                   a33 * a33 );

        temp = ( -a22 * a33 + a23 * a32 ) / denom;
        s3   = temp * temp;
        temp = ( a12 * a33 - a13 * a32 ) / denom;
        s3 += temp * temp;
        temp = ( a12 * a23 - a13 * a22 ) / denom;
        s3 += temp * temp;
        temp = ( a21 * a33 - a23 * a31 ) / denom;
        s3 += temp * temp;
        temp = ( a11 * a33 - a13 * a31 ) / denom;
        s3 += temp * temp;
        temp = ( a11 * a23 - a13 * a21 ) / denom;
        s3 += temp * temp;
        temp = ( a21 * a32 - a22 * a31 ) / denom;
        s3 += temp * temp;
        temp = ( -a11 * a32 + a12 * a31 ) / denom;
        s3 += temp * temp;
        temp = ( -a11 * a22 + a12 * a21 ) / denom;
        s3 += temp * temp;

        s2 = sqrt( s3 );
        return s1 * s2;
    }
}
static bool MBMesquite::condition_number_2d ( const Vector3D  temp_vec[],
size_t  e_ind,
PatchData &  pd,
double &  fval,
MsqError &  err 
) [inline, static]

Definition at line 48 of file ConditionNumberFunctions.hpp.

References MBMesquite::PatchData::get_domain_normal_at_element(), MSQ_ERRZERO, and MBMesquite::Vector3D::normalize().

Referenced by MBMesquite::VertexConditionNumberQualityMetric::evaluate(), and MBMesquite::ConditionNumberQualityMetric::evaluate().

{
    // norm squared of J
    double term1 = temp_vec[0] % temp_vec[0] + temp_vec[1] % temp_vec[1];

    Vector3D unit_surf_norm;
    pd.get_domain_normal_at_element( e_ind, unit_surf_norm, err );
    MSQ_ERRZERO( err );
    unit_surf_norm.normalize();

    // det J
    double temp_var = unit_surf_norm % ( temp_vec[0] * temp_vec[1] );

    // revert to old, non-barrier form
    if( temp_var <= 0.0 ) return false;
    fval = term1 / ( 2.0 * temp_var );
    return true;

    /*
    double h;
    double delta=pd.get_barrier_delta(err); MSQ_ERRZERO(err);

    // Note: technically, we want delta=eta*tau-max
    //       whereas the function above gives delta=eta*alpha-max
    //
    //       Because the only requirement on eta is eta << 1,
    //       and because tau-max = alpha-max/0.707 we can
    //       ignore the discrepancy

    if (delta==0) {
       if (temp_var < MSQ_DBL_MIN ) {
          return false;
       }
       else {
          h=temp_var;
       }

    // Note: when delta=0, the vertex_barrier_function
    //       formally gives h=temp_var as well.
    //       We just do it this way to avoid any
    //       roundoff issues.
    // Also: when delta=0, this metric is identical
    //       to the original condition number with
    //       the barrier at temp_var=0
    }
    else {
       h = QualityMetric::vertex_barrier_function(temp_var,delta);

       if (h<MSQ_DBL_MIN && fabs(temp_var) > MSQ_DBL_MIN ) {
         h = delta*delta/fabs(temp_var); }
       // Note: Analytically, h is strictly positive, but
       //       it can be zero numerically if temp_var
       //       is a large negative number
       //       In the case h=0, we use a different analytic
       //       approximation to compute h.
    }

    if (h<MSQ_DBL_MIN) {
      MSQ_SETERR(err)( "Barrier function is zero due to excessively large "
                       "negative area compared to delta. /n Try to untangle "
                       "mesh another way. ", MsqError::INVALID_MESH);
      return false;
    }

    fval=term1/(2*h);

    if (fval>MSQ_MAX_CAP) {
       fval=MSQ_MAX_CAP;
    }
    return true;
    */
}
static bool MBMesquite::condition_number_3d ( const Vector3D  temp_vec[],
PatchData &  ,
double &  fval,
MsqError &   
) [inline, static]

Definition at line 127 of file ConditionNumberFunctions.hpp.

Referenced by MBMesquite::VertexConditionNumberQualityMetric::evaluate(), and MBMesquite::ConditionNumberQualityMetric::evaluate().

{
    // norm squared of J
    double term1 = temp_vec[0] % temp_vec[0] + temp_vec[1] % temp_vec[1] + temp_vec[2] % temp_vec[2];
    // norm squared of adjoint of J
    double term2 = ( temp_vec[0] * temp_vec[1] ) % ( temp_vec[0] * temp_vec[1] ) +
                   ( temp_vec[1] * temp_vec[2] ) % ( temp_vec[1] * temp_vec[2] ) +
                   ( temp_vec[2] * temp_vec[0] ) % ( temp_vec[2] * temp_vec[0] );
    // det of J
    double temp_var = temp_vec[0] % ( temp_vec[1] * temp_vec[2] );

    // revert to old, non-barrier formulation
    if( temp_var <= 0.0 ) return false;
    fval = sqrt( term1 * term2 ) / ( 3.0 * temp_var );
    return true;

    /*
    double h;
    double delta=pd.get_barrier_delta(err); MSQ_ERRZERO(err);

    // Note: technically, we want delta=eta*tau-max
    //       whereas the function above gives delta=eta*alpha-max
    //
    //       Because the only requirement on eta is eta << 1,
    //       and because tau-max = alpha-max/0.707 we can
    //       ignore the discrepancy

    if (delta==0) {
       if (temp_var < MSQ_DBL_MIN ) {
          return false;
       }
       else {
          h=temp_var;
       }

    // Note: when delta=0, the vertex_barrier_function
    //       formally gives h=temp_var as well.
    //       We just do it this way to avoid any
    //       roundoff issues.
    // Also: when delta=0, this metric is identical
    //       to the original condition number with
    //       the barrier at temp_var=0

    }
    else {
       h = QualityMetric::vertex_barrier_function(temp_var,delta);

       if (h<MSQ_DBL_MIN && fabs(temp_var) > MSQ_DBL_MIN ) {
         h = delta*delta/fabs(temp_var); }

       // Note: Analytically, h is strictly positive, but
       //       it can be zero numerically if temp_var
       //       is a large negative number
       //       In the h=0, we use a different analytic
       //       approximation to compute h.
    }
    if (h<MSQ_DBL_MIN) {
      MSQ_SETERR(err)("Barrier function is zero due to excessively large "
                      "negative area compared to delta. /n Try to untangle "
                      "mesh another way. ", MsqError::INVALID_MESH);
      return false;
    }

    fval=sqrt(term1*term2)/(3*h);

    if (fval>MSQ_MAX_CAP) {
       fval=MSQ_MAX_CAP;
    }
    return true;
    */
}
static double MBMesquite::corner_volume ( const Vector3D &  v0,
const Vector3D &  v1,
const Vector3D &  v2,
const Vector3D &  v3 
) [inline, static]

Definition at line 104 of file MsqMeshEntity.cpp.

Referenced by MBMesquite::MsqMeshEntity::compute_unsigned_area().

{
    return ( v1 - v0 ) * ( v2 - v0 ) % ( v3 - v0 );
}
MBMesquite::CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( CircleDomainTest  ,
"CircleDomainTest"   
)
MBMesquite::CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( LineDomainTest  ,
"LineDomainTest"   
)
MBMesquite::CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( CircleDomainTest  ,
"Unit"   
)
MBMesquite::CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( LineDomainTest  ,
"Unit"   
)
MBMesquite::create_four_quads_patch ( PatchData &  four_quads,
MsqError &  err 
) [inline]

our 2D set up: 4 quads, center vertex outcentered by (0,-0.5) 7____6____5 | | | | 2 | 3 | 8-_ | _-4 vertex 1 is at (0,0) | -_0_- | vertex 5 is at (2,2) | 0 | 1 | 1----2----3

Definition at line 237 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), and QUADRILATERAL.

Referenced by PMeanPMetricTest::setUp(), CachingTargetTest::setUp(), ExtraDataTest::test_notify_new_patch_fill(), ExtraDataTest::test_notify_new_patch_sub(), and ExtraDataTest::test_notify_subpatch().

{
    double coords[] = { 1, .5, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 1, 2, 0, 0, 2, 0, 0, 1, 0 };

    size_t indices[] = { 1, 2, 0, 8, 2, 3, 4, 0, 8, 0, 6, 7, 0, 4, 5, 6 };

    four_quads.fill( 9, coords, 4, QUADRILATERAL, indices, 0, err );
}
void MBMesquite::create_ideal_element_patch ( PatchData &  pd,
EntityTopology  type,
size_t  num_nodes,
MsqError &  err 
) [inline]

Definition at line 468 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::attach_settings(), conn, corners, dim, MBMesquite::PatchData::fill(), fixed, MSQ_ERRRTN, n, MBMesquite::PatchData::set_domain(), MBMesquite::Settings::set_slaved_ho_node_mode(), settings, MBMesquite::Settings::SLAVE_NONE, unit_edge_element(), and MBMesquite::PlanarDomain::XY.

Referenced by MsqMeshEntityTest::test_check_element_orientation().

{
    static PlanarDomain zplane( PlanarDomain::XY );
    static Settings settings;
    settings.set_slaved_ho_node_mode( Settings::SLAVE_NONE );
    pd.attach_settings( &settings );

    // build list of vertex coordinates
    const Vector3D* corners = unit_edge_element( type );
    std::vector< Vector3D > coords( corners, corners + TopologyInfo::corners( type ) );
    bool mids[4] = { false };
    TopologyInfo::higher_order( type, num_nodes, mids[1], mids[2], mids[3], err );MSQ_ERRRTN( err );
    std::vector< size_t > conn( coords.size() );
    for( unsigned i = 0; i < coords.size(); ++i )
        conn[i] = i;

    for( unsigned dim = 1; dim <= TopologyInfo::dimension( type ); ++dim )
    {
        if( !mids[dim] ) continue;

        int num_side;
        if( dim == TopologyInfo::dimension( type ) )
            num_side = 1;
        else
            num_side = TopologyInfo::adjacent( type, dim );

        for( int s = 0; s < num_side; ++s )
        {
            unsigned idx = TopologyInfo::higher_order_from_side( type, num_nodes, dim, s, err );MSQ_ERRRTN( err );
            conn.push_back( idx );

            unsigned n;
            const unsigned* side = TopologyInfo::side_vertices( type, dim, s, n, err );MSQ_ERRRTN( err );
            Vector3D avg = coords[side[0]];
            for( unsigned v = 1; v < n; ++v )
                avg += coords[side[v]];
            avg *= 1.0 / n;
            coords.push_back( avg );
        }
    }

    bool* fixed = new bool[coords.size()];
    std::fill( fixed, fixed + coords.size(), false );
    pd.fill( coords.size(), coords[0].to_array(), 1, &type, &num_nodes, &conn[0], fixed, err );
    delete[] fixed;MSQ_ERRRTN( err );

    if( TopologyInfo::dimension( type ) == 2 ) pd.set_domain( &zplane );
}
void MBMesquite::create_one_hex_patch ( PatchData &  one_hex_patch,
MsqError &  err 
) [inline]

creates a patch containing one ideal hexahedra

Definition at line 98 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), and HEXAHEDRON.

Referenced by MsqMeshEntityTest::setUp().

{
    double coords[] = { 1.0, 1.0, 1.0, 2.0, 1.0, 1.0, 2.0, 2.0, 1.0, 1.0, 2.0, 1.0,
                        1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 2.0, 2.0 };

    size_t indices[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };

    one_hex_patch.fill( 8, coords, 1, HEXAHEDRON, indices, 0, err );
}
void MBMesquite::create_one_inverted_tet_patch ( PatchData &  one_tet_patch,
MsqError &  err 
) [inline]

creates a Patch containing an ideal tetrahedra, inverted

Definition at line 159 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), and TETRAHEDRON.

{
    double coords[] = {
        1, 1, 1, 2, 1, 1, 1.5, 1 + sqrt( 3.0 ) / 2.0, 1, 1.5, 1 + sqrt( 3.0 ) / 6.0, 1 - sqrt( 2.0 ) / sqrt( 3.0 ),
    };

    size_t indices[4] = { 0, 1, 2, 3 };

    one_tet_patch.fill( 4, coords, 1, TETRAHEDRON, indices, 0, err );
}
void MBMesquite::create_one_pyr_patch ( PatchData &  one_pyr_patch,
MsqError &  err 
) [inline]

create patch containing one ideal pyramid

Definition at line 130 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), and PYRAMID.

{
    /* Equilateral triangles
    double coords[] = { 1, -1, 0,
                        1,  1, 0,
                       -1,  1, 0,
                       -1, -1, 0,
                        0,  0, sqrt(2) };
    */
    /* Unit height */
    double coords[] = { 1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 0, 0, 2 };

    size_t indices[5] = { 0, 1, 2, 3, 4 };

    one_pyr_patch.fill( 5, coords, 1, PYRAMID, indices, 0, err );
}
void MBMesquite::create_one_quad_patch ( PatchData &  one_qua_patch,
MsqError &  err 
) [inline]

creates a Patch containing an ideal quadrilateral

Definition at line 171 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), and QUADRILATERAL.

Referenced by MsqMeshEntityTest::setUp().

{
    double coords[] = { 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1 };

    size_t indices[4] = { 0, 1, 2, 3 };

    one_qua_patch.fill( 4, coords, 1, QUADRILATERAL, indices, 0, err );
}
void MBMesquite::create_one_tet_patch ( PatchData &  one_tet_patch,
MsqError &  err 
) [inline]

creates a Patch containing an ideal tetrahedra

Definition at line 109 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), and TETRAHEDRON.

Referenced by LVQDTargetTest::setUp(), and MsqMeshEntityTest::setUp().

{
    double coords[] = { 1.0,
                        1.0,
                        1.0,
                        2.0,
                        1.0,
                        1.0,
                        1.5,
                        1 + sqrt( 3.0 ) / 2.0,
                        1.0,
                        1.5,
                        1 + sqrt( 3.0 ) / 6.0,
                        1 + sqrt( 2.0 ) / sqrt( 3.0 ) };

    size_t indices[4] = { 0, 1, 2, 3 };

    one_tet_patch.fill( 4, coords, 1, TETRAHEDRON, indices, 0, err );
}
MBMesquite::create_one_tri_patch ( PatchData &  one_tri_patch,
MsqError &  err 
) [inline]

2 / \ creates a Patch containing an ideal triangle / \ 0-----1 This Patch also has the normal information.

Definition at line 187 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), MBMesquite::PatchData::set_domain(), and TRIANGLE.

Referenced by LVQDTargetTest::setUp(), and MsqMeshEntityTest::setUp().

{
    /* ************** Creates normal info ******************* */
    Vector3D pnt( 0, 0, 0 );
    Vector3D s_norm( 0, 0, 3 );
    one_tri_patch.set_domain( new PlanarDomain( s_norm, pnt ) );

    /* *********************FILL tri************************* */
    double coords[] = { 1, 1, 1, 2, 1, 1, 1.5, 1 + sqrt( 3.0 ) / 2.0, 1 };

    size_t indices[3] = { 0, 1, 2 };
    one_tri_patch.fill( 3, coords, 1, TRIANGLE, indices, 0, err );
}
void MBMesquite::create_one_wdg_patch ( PatchData &  one_wdg_patch,
MsqError &  err 
) [inline]

create patch containing one ideal wedge

Definition at line 148 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), MSQ_SQRT_THREE, and PRISM.

{
    double hgt      = 0.5 * MSQ_SQRT_THREE;
    double coords[] = { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.5, hgt, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.5, hgt, 1.0 };

    size_t indices[6] = { 0, 1, 2, 3, 4, 5 };

    one_wdg_patch.fill( 6, coords, 1, PRISM, indices, 0, err );
}
void MBMesquite::create_qm_two_hex_patch ( PatchData &  hexPatch,
MsqError &  err 
) [inline]

Definition at line 456 of file PatchDataInstances.hpp.

References conn, MBMesquite::PatchData::fill(), and HEXAHEDRON.

Referenced by CachingTargetTest::setUp().

{
    double coords[] = { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,  1.0, 1.0, 0.0, 1.0,
                        1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 2.0, 0.0, 0.0, 2.0, 1.0, 0.0, 2.0, -1.0, 1.0, 3.0, 2.0, 1.0 };

    const size_t conn[] = { 0, 1, 2, 3, 4, 5, 6, 7, 1, 8, 9, 2, 5, 10, 11, 6 };

    hexPatch.fill( 12, coords, 2, HEXAHEDRON, conn, 0, err );
}
void MBMesquite::create_qm_two_pyr_patch ( PatchData &  pyrPatch,
MsqError &  err 
) [inline]

Definition at line 407 of file PatchDataInstances.hpp.

References conn, MBMesquite::PatchData::fill(), and PYRAMID.

{
    /* Equilateral triangles
    double coords[] = { 1, -1, 0,
                        1,  1, 0,
                       -1,  1, 0,
                       -1, -1, 0,
                        0,  0, sqrt(2) };
    */
    /* Unit height */
    double coords[] = { /* Equilateral triangles */
                        /*   1, -1, 0,
                             1,  1, 0,
                            -1,  1, 0,
                            -1, -1, 0,
                             0,  0, sqrt(2)  */
                        /* Unit height */
                        1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 0, 0, 2,
                        /* Apex for a squashed pyramid */
                        0, 0, -1 };

    const size_t conn[] = { 0, 1, 2, 3, 4, 3, 2, 1, 0, 5 };

    pyrPatch.fill( 6, coords, 2, PYRAMID, conn, 0, err );
}
void MBMesquite::create_qm_two_quad_patch_with_domain ( PatchData &  quadPatch,
MsqError &  err 
) [inline]

Definition at line 373 of file PatchDataInstances.hpp.

References conn, MBMesquite::PatchData::fill(), QUADRILATERAL, and MBMesquite::PatchData::set_domain().

{
    Vector3D pnt( 0, 0, 0 );
    Vector3D s_norm( 0, 0, 3 );
    quadPatch.set_domain( new PlanarDomain( s_norm, pnt ) );

    double coords[] = { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 2.0, -1.0, .5, 1.5, 1.0, 1.0 };

    const size_t conn[] = { 0, 1, 2, 3, 1, 4, 5, 2 };

    quadPatch.fill( 6, coords, 2, QUADRILATERAL, conn, 0, err );
}
void MBMesquite::create_qm_two_tet_patch ( PatchData &  tetPatch,
MsqError &  err 
) [inline]

Definition at line 391 of file PatchDataInstances.hpp.

References conn, MBMesquite::PatchData::fill(), and TETRAHEDRON.

Referenced by ObjectiveFunctionTests::compare_numerical_hessian(), ObjectiveFunctionTest::test_compute_ana_hessian_tet(), and ObjectiveFunctionTest::test_compute_ana_hessian_tet_scaled().

{
    double coords[] = {
        0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.5, sqrt( 3.0 ) / 2.0, 0.0, 0.5, sqrt( 3.0 ) / 6.0, sqrt( 2.0 ) / sqrt( 3.0 ),
        2.0, 3.0, -.5 };

    const size_t conn[] = { 0, 1, 2, 3, 1, 4, 2, 3 };

    tetPatch.fill( 5, coords, 2, TETRAHEDRON, conn, 0, err );
}
void MBMesquite::create_qm_two_tri_patch_with_domain ( PatchData &  triPatch,
MsqError &  err 
) [inline]

Definition at line 353 of file PatchDataInstances.hpp.

References conn, MBMesquite::PatchData::fill(), MBMesquite::PatchData::set_domain(), and TRIANGLE.

{
    Vector3D pnt( 0, 0, 0 );
    Vector3D s_norm( 0, 0, 3 );
    triPatch.set_domain( new PlanarDomain( s_norm, pnt ) );

    double coords[] = { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.5, sqrt( 3.0 ) / 2.0, 0.0, 2.0, -4.0, 2.0 };

    const size_t conn[] = { 0, 1, 2, 0, 3, 1 };

    triPatch.fill( 4, coords, 2, TRIANGLE, conn, 0, err );
}
void MBMesquite::create_qm_two_wdg_patch ( PatchData &  wdgPatch,
MsqError &  err 
) [inline]

Definition at line 438 of file PatchDataInstances.hpp.

References conn, MBMesquite::PatchData::fill(), MSQ_SQRT_THREE, and PRISM.

{
    double hgt      = 0.5 * MSQ_SQRT_THREE;
    double coords[] = { // ideal prism vertices
                        0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.5, hgt, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.5, hgt, 1.0,
                        // top vertices for stretched wedge
                        0.5, -3.0, 0.0, 0.5, -4.0, 1.0 };

    const size_t conn[] = { 0, 1, 2, 3, 4, 5, 1, 0, 6, 4, 3, 7 };

    wdgPatch.fill( 8, coords, 2, PRISM, conn, 0, err );
}
MBMesquite::create_six_quads_patch_inverted_with_domain ( PatchData &  four_quads,
MsqError &  err 
) [inline]

our 2D set up: 6 quads, 1 center vertex outcentered by (0,-0.5), the other centered 7____6____5___11 | | | | | 2 | 3 | 5 | 8 | 4---10 vertex 1 is at (0,0) |\ /| | vertex 11 is at (3,2) | | | 4 | 1----2----3----9 \ / 0 use destroy_patch_with_domain() in sync.

Definition at line 288 of file PatchDataInstances.hpp.

References create_six_quads_patch_with_domain(), MBMesquite::PatchData::move_vertex(), and MSQ_CHKERR.

{
    create_six_quads_patch_with_domain( pd, err );MSQ_CHKERR( err );

    Vector3D displacement( 0, -1.5, 0 );

    pd.move_vertex( displacement, 0, err );
}
void MBMesquite::create_six_quads_patch_with_domain ( PatchData &  pd,
MsqError &  err 
) [inline]

Definition at line 258 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), fixed, QUADRILATERAL, and MBMesquite::PatchData::set_domain().

Referenced by create_six_quads_patch_inverted_with_domain(), and MsqFreeVertexIndexIteratorTest::setUp().

{
    // associates domain
    Vector3D pnt( 0, 0, 0 );
    Vector3D s_norm( 0, 0, 3 );
    pd.set_domain( new PlanarDomain( s_norm, pnt ) );

    double coords[] = { 1, .5, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0,
                        1, 2,  0, 0, 2, 0, 0, 1, 0, 3, 0, 0, 3, 1, 0, 3, 2, 0 };

    size_t indices[] = { 1, 2, 0, 8, 2, 3, 4, 0, 8, 0, 6, 7, 0, 4, 5, 6, 3, 9, 10, 4, 4, 10, 11, 5 };

    bool fixed[] = { false, true, true, true, false, true, true, true, true, true, true, true };

    pd.fill( 12, coords, 6, QUADRILATERAL, indices, fixed, err );
}
MBMesquite::create_twelve_hex_patch ( PatchData &  pd,
MsqError &  err 
) [inline]

3D set up: 12 quads, one center vertex outcentered by (0,-0.5), the other centered. Vertex 1 is at (0,0,-1). Vertex 35 is at (3,2,1).

7____6____5___11 19___18____17__23 31___30___29___35 | | | | | | | | | | | | | 2 | 3 | 5 | | | | | | 8 | 9 | 11 | 8----0----4---10 20-_ | _16---22 32---24---28---34 | | | | | -12_- | | | | | | | 0 | 1 | 4 | | | | | | 6 | 7 | 10 | 1----2----3----9 13---14---15---21 25---26---27---33

Definition at line 309 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), fixed, and HEXAHEDRON.

Referenced by ObjectiveFunctionTests::compare_diagonal_gradient(), ObjectiveFunctionTests::compare_hessian_diagonal(), ObjectiveFunctionTests::compare_hessian_gradient(), ObjectiveFunctionTests::compare_numerical_gradient(), create_twelve_hex_patch_inverted(), CompositeOFTest::get_hessians(), CachingTargetTest::test_cache_cleared(), TerminationCriterionTest::test_gradient_common(), CompositeOFTest::test_multiply_hess_diagonal(), CompositeOFTest::test_multiply_hessian(), PatchDataTest::test_sub_patch(), TerminationCriterionTest::test_untangled_mesh(), TerminationCriterionTest::test_vertex_bound(), and TerminationCriterionTest::test_vertex_movement_common().

{
    double coords[] = { 1, 1,  -1, 0, 0, -1, 1, 0, -1, 2, 0, -1, 2, 1, -1, 2, 2, -1,
                        1, 2,  -1, 0, 2, -1, 0, 1, -1, 3, 0, -1, 3, 1, -1, 3, 2, -1,

                        1, .5, 0,  0, 0, 0,  1, 0, 0,  2, 0, 0,  2, 1, 0,  2, 2, 0,
                        1, 2,  0,  0, 2, 0,  0, 1, 0,  3, 0, 0,  3, 1, 0,  3, 2, 0,

                        1, 1,  1,  0, 0, 1,  1, 0, 1,  2, 0, 1,  2, 1, 1,  2, 2, 1,
                        1, 2,  1,  0, 2, 1,  0, 1, 1,  3, 0, 1,  3, 1, 1,  3, 2, 1 };

    size_t connectivity[] = { 1,  2,  0,  8,  13, 14, 12, 20,    // 0
                              2,  3,  4,  0,  14, 15, 16, 12,    // 1
                              8,  0,  6,  7,  20, 12, 18, 19,    // 2
                              0,  4,  5,  6,  12, 16, 17, 18,    // 3
                              3,  9,  10, 4,  15, 21, 22, 16,    // 4
                              4,  10, 11, 5,  16, 22, 23, 17,    // 5
                              13, 14, 12, 20, 25, 26, 24, 32,    // 6
                              14, 15, 16, 12, 26, 27, 28, 24,    // 7
                              20, 12, 18, 19, 32, 24, 30, 31,    // 8
                              12, 16, 17, 18, 24, 28, 29, 30,    // 9
                              15, 21, 22, 16, 27, 33, 34, 28,    // 10
                              16, 22, 23, 17, 28, 34, 35, 29 };  // 11

    bool fixed[] = { true,  true, true, true, true,  true, true, true, true, true, true, true,
                     false, true, true, true, false, true, true, true, true, true, true, true,
                     true,  true, true, true, true,  true, true, true, true, true, true, true };

    pd.fill( 36, coords, 12, HEXAHEDRON, connectivity, fixed, err );
}
void MBMesquite::create_twelve_hex_patch_inverted ( PatchData &  pd,
MsqError &  err 
) [inline]

Definition at line 340 of file PatchDataInstances.hpp.

References create_twelve_hex_patch(), move_vertex(), and MSQ_CHKERR.

{
    create_twelve_hex_patch( pd, err );MSQ_CHKERR( err );
    move_vertex( pd, Vector3D( 2, 1, 0 ), Vector3D( 0, 0, 1.5 ), err );MSQ_CHKERR( err );
}
MBMesquite::create_two_tri_patch ( PatchData &  one_tri_patch,
MsqError &  err 
) [inline]

2 / \ creates a Patch containing two ideal triangles / 0 \ 0-----1 \ 1 / \ / 3 This Patch also has the normal information.

Definition at line 211 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::fill(), MBMesquite::PatchData::set_domain(), and TRIANGLE.

Referenced by MsqHessianTest::setUp().

{
    /* ************** Creates normal info ******************* */
    Vector3D pnt( 0, 0, 1 );
    Vector3D s_norm( 0, 0, 3 );
    pd.set_domain( new PlanarDomain( s_norm, pnt ) );

    // **********************FILL tri*************************

    double coords[] = { 1, 1, 1, 2, 1, 1, 1.5, 1 + sqrt( 3.0 ) / 2.0, 1, 1.5, 1 - sqrt( 3.0 ) / 2.0, 1 };

    size_t indices[] = { 0, 1, 2, 0, 3, 1 };

    pd.fill( 4, coords, 2, TRIANGLE, indices, 0, err );
}
const char* MBMesquite::default_name ( bool  free_only)

Definition at line 71 of file QualityAssessor.cpp.

Referenced by MBMesquite::QualityAssessor::QualityAssessor().

{
    static const char all_name[]  = "QualityAssessor";
    static const char free_name[] = "QualityAssessor(free only)";
    return free_only ? free_name : all_name;
}
static void MBMesquite::derivatives_at_corner ( unsigned  corner,
size_t *  vertex_indices,
MsqVector< 2 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 106 of file LinearQuadrilateral.cpp.

References eta, sign, and xi.

{
    const unsigned adj_in_xi  = ( 5 - corner ) % 4;
    const unsigned adj_in_eta = 3 - corner;

    num_vtx           = 3;
    vertex_indices[0] = corner;
    vertex_indices[1] = adj_in_xi;
    vertex_indices[2] = adj_in_eta;

    derivs[0][0] = sign[xi][corner];
    derivs[0][1] = sign[eta][corner];
    derivs[1][0] = sign[xi][adj_in_xi];
    derivs[1][1] = 0.0;
    derivs[2][0] = 0.0;
    derivs[2][1] = sign[eta][adj_in_eta];
}
static void MBMesquite::derivatives_at_corner ( unsigned  corner,
NodeSet  nodeset,
size_t *  vertices,
MsqVector< 2 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 130 of file QuadLagrangeShape.cpp.

References MBMesquite::NodeSet::mid_edge_node(), and mid_xi.

Referenced by MBMesquite::LinearPrism::derivatives(), MBMesquite::LinearHexahedron::derivatives(), MBMesquite::TriLagrangeShape::derivatives(), MBMesquite::QuadLagrangeShape::derivatives(), MBMesquite::LinearQuadrilateral::derivatives(), and MBMesquite::TetLagrangeShape::derivatives().

{
    static const unsigned xi_adj_corners[]  = { 1, 0, 3, 2 };
    static const unsigned xi_adj_edges[]    = { 0, 0, 2, 2 };
    static const unsigned eta_adj_corners[] = { 3, 2, 1, 0 };
    static const unsigned eta_adj_edges[]   = { 3, 1, 1, 3 };

    static const double corner_xi[]  = { -1, 1, 1, -1 };  // xi values by corner
    static const double corner_eta[] = { -1, -1, 1, 1 };  // eta values by corner
    static const double other_xi[]   = { 1, -1, -1, 1 };  // xi values for adjacent corner in xi direction
    static const double other_eta[]  = { 1, 1, -1, -1 };  // eta values for adjcent corner in eta direction
    static const double mid_xi[]     = { 2, -2, -2, 2 };  // xi values for mid-node in xi direction
    static const double mid_eta[]    = { 2, 2, -2, -2 };  // eta values for mid-node in eta direction

    num_vtx     = 3;
    vertices[0] = corner;
    vertices[1] = xi_adj_corners[corner];
    vertices[2] = eta_adj_corners[corner];

    derivs[0][0] = corner_xi[corner];
    derivs[0][1] = corner_eta[corner];
    derivs[1][0] = other_xi[corner];
    derivs[1][1] = 0.0;
    derivs[2][0] = 0.0;
    derivs[2][1] = other_eta[corner];

    if( nodeset.mid_edge_node( xi_adj_edges[corner] ) )
    {
        vertices[num_vtx]  = 4 + xi_adj_edges[corner];
        derivs[num_vtx][0] = 2.0 * mid_xi[corner];
        derivs[num_vtx][1] = 0.0;
        derivs[0][0] -= mid_xi[corner];
        derivs[1][0] -= mid_xi[corner];
        ++num_vtx;
    }

    if( nodeset.mid_edge_node( eta_adj_edges[corner] ) )
    {
        vertices[num_vtx]  = 4 + eta_adj_edges[corner];
        derivs[num_vtx][0] = 0.0;
        derivs[num_vtx][1] = 2.0 * mid_eta[corner];
        derivs[0][1] -= mid_eta[corner];
        derivs[2][1] -= mid_eta[corner];
        ++num_vtx;
    }
}
static void MBMesquite::derivatives_at_corner ( unsigned  corner,
size_t *  vertex_indices_out,
MsqVector< 3 > *  d_coeff_d_xi_out,
size_t &  num_vtx 
) [static]

Definition at line 169 of file LinearHexahedron.cpp.

References coeff_eta_sign(), coeff_xi_sign(), and coeff_zeta_sign().

{
    const int xi_sign   = coeff_xi_sign( corner );
    const int eta_sign  = coeff_eta_sign( corner );
    const int zeta_sign = coeff_zeta_sign( corner );
    const int offset    = 4 * ( corner / 4 );
    // const int adj_in_xi   = offset + (9 - corner)%4;
    const int adj_in_xi   = corner + 1 - 2 * ( corner % 2 );
    const int adj_in_eta  = 3 + 2 * offset - (int)corner;
    const int adj_in_zeta = corner - zeta_sign * 4;

    num_vtx               = 4;
    vertex_indices_out[0] = corner;
    vertex_indices_out[1] = adj_in_xi;
    vertex_indices_out[2] = adj_in_eta;
    vertex_indices_out[3] = adj_in_zeta;

    d_coeff_d_xi_out[0][0] = xi_sign;
    d_coeff_d_xi_out[0][1] = eta_sign;
    d_coeff_d_xi_out[0][2] = zeta_sign;

    d_coeff_d_xi_out[1][0] = -xi_sign;
    d_coeff_d_xi_out[1][1] = 0.0;
    d_coeff_d_xi_out[1][2] = 0.0;

    d_coeff_d_xi_out[2][0] = 0.0;
    d_coeff_d_xi_out[2][1] = -eta_sign;
    d_coeff_d_xi_out[2][2] = 0.0;

    d_coeff_d_xi_out[3][0] = 0.0;
    d_coeff_d_xi_out[3][1] = 0.0;
    d_coeff_d_xi_out[3][2] = -zeta_sign;
}
static void MBMesquite::derivatives_at_corner ( unsigned  corner,
NodeSet  nodeset,
size_t *  vertices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 337 of file TetLagrangeShape.cpp.

References get_linear_derivatives(), and MBMesquite::NodeSet::mid_edge_node().

{
    // begin with derivatives for linear tetrahedron
    num_vtx = 4;
    get_linear_derivatives( vertices, derivs );

    // adjust for the presence of mid-edge nodes
    switch( corner )
    {
        case 0:
            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = 4.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                derivs[0][0] -= 2.0;
                derivs[1][0] -= 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 4.0;
                derivs[num_vtx][2] = 0.0;
                derivs[0][1] -= 2.0;
                derivs[2][1] -= 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 4.0;
                derivs[0][2] -= 2.0;
                derivs[3][2] -= 2.0;
                ++num_vtx;
            }
            break;

        case 1:
            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = -4.0;
                derivs[num_vtx][1] = -4.0;
                derivs[num_vtx][2] = -4.0;
                derivs[0][0] += 2.0;
                derivs[0][1] += 2.0;
                derivs[0][2] += 2.0;
                derivs[1][0] += 2.0;
                derivs[1][1] += 2.0;
                derivs[1][2] += 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 4.0;
                derivs[num_vtx][2] = 0.0;
                derivs[1][1] -= 2.0;
                derivs[2][1] -= 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 4.0;
                derivs[1][2] -= 2.0;
                derivs[3][2] -= 2.0;
                ++num_vtx;
            }
            break;

        case 2:
            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 4.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                derivs[1][0] -= 2.0;
                derivs[2][0] -= 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = -4.0;
                derivs[num_vtx][1] = -4.0;
                derivs[num_vtx][2] = -4.0;
                derivs[0][0] += 2.0;
                derivs[0][1] += 2.0;
                derivs[0][2] += 2.0;
                derivs[2][0] += 2.0;
                derivs[2][1] += 2.0;
                derivs[2][2] += 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 4.0;
                derivs[2][2] -= 2.0;
                derivs[3][2] -= 2.0;
                ++num_vtx;
            }
            break;

        case 3:
            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = -4.0;
                derivs[num_vtx][1] = -4.0;
                derivs[num_vtx][2] = -4.0;
                derivs[0][0] += 2.0;
                derivs[0][1] += 2.0;
                derivs[0][2] += 2.0;
                derivs[3][0] += 2.0;
                derivs[3][1] += 2.0;
                derivs[3][2] += 2.0;
                ++num_vtx;
            }
            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 4.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                derivs[1][0] -= 2.0;
                derivs[3][0] -= 2.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 4.0;
                derivs[num_vtx][2] = 0.0;
                derivs[2][1] -= 2.0;
                derivs[3][1] -= 2.0;
                ++num_vtx;
            }
            break;
    }
}
static void MBMesquite::derivatives_at_mid_edge ( unsigned  edge,
size_t *  vertices,
MsqVector< 2 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 124 of file LinearQuadrilateral.cpp.

References sign.

{
    const unsigned start_vtx  = edge;
    const unsigned end_vtx    = ( edge + 1 ) % 4;
    const unsigned othr1_vtx  = ( edge + 2 ) % 4;
    const unsigned othr2_vtx  = ( edge + 3 ) % 4;
    const unsigned direction  = edge % 2;
    const unsigned orthogonal = 1 - direction;

    num_vtx     = 4;
    vertices[0] = 0;
    vertices[1] = 1;
    vertices[2] = 2;
    vertices[3] = 3;

    derivs[start_vtx][direction] = sign[direction][start_vtx];
    derivs[end_vtx][direction]   = sign[direction][end_vtx];
    derivs[othr1_vtx][direction] = 0.0;
    derivs[othr2_vtx][direction] = 0.0;

    derivs[0][orthogonal] = 0.5 * sign[orthogonal][0];
    derivs[1][orthogonal] = 0.5 * sign[orthogonal][1];
    derivs[2][orthogonal] = 0.5 * sign[orthogonal][2];
    derivs[3][orthogonal] = 0.5 * sign[orthogonal][3];
}
static void MBMesquite::derivatives_at_mid_edge ( unsigned  edge,
NodeSet  nodeset,
size_t *  vertices,
MsqVector< 2 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 181 of file QuadLagrangeShape.cpp.

References MBMesquite::NodeSet::have_any_mid_node(), MBMesquite::NodeSet::mid_edge_node(), MBMesquite::NodeSet::mid_face_node(), and value().

Referenced by MBMesquite::LinearPrism::derivatives(), MBMesquite::LinearHexahedron::derivatives(), MBMesquite::TriLagrangeShape::derivatives(), MBMesquite::QuadLagrangeShape::derivatives(), MBMesquite::LinearQuadrilateral::derivatives(), and MBMesquite::TetLagrangeShape::derivatives().

{
    static const double values[][9]      = { { -0.5, -0.5, 0.5, 0.5, -1.0, 2.0, 1.0, 2.0, 4.0 },
                                        { -0.5, 0.5, 0.5, -0.5, -2.0, 1.0, -2.0, -1.0, -4.0 },
                                        { -0.5, -0.5, 0.5, 0.5, -1.0, -2.0, 1.0, -2.0, -4.0 },
                                        { -0.5, 0.5, 0.5, -0.5, 2.0, 1.0, 2.0, -1.0, 4.0 } };
    static const double edge_values[][2] = { { -1, 1 }, { -1, 1 }, { 1, -1 }, { 1, -1 } };
    const unsigned prev_corner           = edge;              // index of start vertex of edge
    const unsigned next_corner           = ( edge + 1 ) % 4;  // index of end vertex of edge
    const unsigned is_eta_edge           = edge % 2;          // edge is xi = +/- 0
    const unsigned is_xi_edge            = 1 - is_eta_edge;   // edge is eta = +/- 0
    // const unsigned mid_edge_node = edge + 4;     // mid-edge node index
    const unsigned prev_opposite = ( prev_corner + 3 ) % 4;  // index of corner adjacent to prev_corner
    const unsigned next_opposite = ( next_corner + 1 ) % 4;  // index of corner adjacent to next_corner;

    // First do derivatives along edge (e.g. wrt xi if edge is eta = +/-1)
    num_vtx                = 2;
    vertices[0]            = prev_corner;
    vertices[1]            = next_corner;
    derivs[0][is_eta_edge] = edge_values[edge][0];
    derivs[0][is_xi_edge]  = 0.0;
    derivs[1][is_eta_edge] = edge_values[edge][1];
    derivs[1][is_xi_edge]  = 0.0;
    // That's it for the edge-direction derivatives.  No other vertices contribute.

    // Next handle the linear element case.  Handle this as a special case first,
    // so the generalized solution doesn't impact performance for linear elements
    // too much.
    if( !nodeset.have_any_mid_node() )
    {
        num_vtx                = 4;
        vertices[2]            = prev_opposite;
        vertices[3]            = next_opposite;
        derivs[0][is_xi_edge]  = values[edge][prev_corner];
        derivs[1][is_xi_edge]  = values[edge][next_corner];
        derivs[2][is_xi_edge]  = values[edge][prev_opposite];
        derivs[2][is_eta_edge] = 0.0;
        derivs[3][is_xi_edge]  = values[edge][next_opposite];
        derivs[3][is_eta_edge] = 0.0;
        return;
    }

    // Initial (linear) contribution for each corner
    double v[4] = { values[edge][0], values[edge][1], values[edge][2], values[edge][3] };

    // If mid-face node is present
    double v8 = 0.0;
    if( nodeset.mid_face_node( 0 ) )
    {
        v8                           = values[edge][8];
        vertices[num_vtx]            = 8;
        derivs[num_vtx][is_eta_edge] = 0.0;
        derivs[num_vtx][is_xi_edge]  = v8;
        v[0] -= 0.25 * v8;
        v[1] -= 0.25 * v8;
        v[2] -= 0.25 * v8;
        v[3] -= 0.25 * v8;
        ++num_vtx;
    }

    // If mid-edge nodes are present
    for( unsigned i = 0; i < 4; ++i )
    {
        if( nodeset.mid_edge_node( i ) )
        {
            const double value = values[edge][i + 4] - 0.5 * v8;
            if( fabs( value ) > 0.125 )
            {
                v[i] -= 0.5 * value;
                v[( i + 1 ) % 4] -= 0.5 * value;
                vertices[num_vtx]            = i + 4;
                derivs[num_vtx][is_eta_edge] = 0.0;
                derivs[num_vtx][is_xi_edge]  = value;
                ++num_vtx;
            }
        }
    }

    // update values for adjacent corners
    derivs[0][is_xi_edge] = v[prev_corner];
    derivs[1][is_xi_edge] = v[next_corner];
    // do other two corners
    if( fabs( v[prev_opposite] ) > 0.125 )
    {
        vertices[num_vtx]            = prev_opposite;
        derivs[num_vtx][is_eta_edge] = 0.0;
        derivs[num_vtx][is_xi_edge]  = v[prev_opposite];
        ++num_vtx;
    }
    if( fabs( v[next_opposite] ) > 0.125 )
    {
        vertices[num_vtx]            = next_opposite;
        derivs[num_vtx][is_eta_edge] = 0.0;
        derivs[num_vtx][is_xi_edge]  = v[next_opposite];
        ++num_vtx;
    }
}
static void MBMesquite::derivatives_at_mid_edge ( unsigned  edge,
size_t *  vertex_indices_out,
MsqVector< 3 > *  d_coeff_d_xi_out,
size_t &  num_vtx 
) [static]

Definition at line 206 of file LinearHexahedron.cpp.

References coeff_eta_sign(), coeff_xi_sign(), coeff_zeta_sign(), edge_beg, edge_beg_orth1, edge_beg_orth2, edge_dir, edge_end, edge_end_orth1, edge_end_orth2, signs, and vtx().

{
    const int direction = edge_dir[edge];
    const int ortho1    = ( direction + 1 ) % 3;
    const int ortho2    = ( direction + 2 ) % 3;
    const int vtx       = edge_beg[edge];
    const int signs[]   = { coeff_xi_sign( vtx ), coeff_eta_sign( vtx ), coeff_zeta_sign( vtx ) };
    const int sign_dir  = signs[direction];
    const int sign_or1  = signs[ortho1];
    const int sign_or2  = signs[ortho2];

    num_vtx               = 6;
    vertex_indices_out[0] = edge_beg[edge];
    vertex_indices_out[1] = edge_end[edge];
    vertex_indices_out[2] = edge_beg_orth1[edge];
    vertex_indices_out[3] = edge_end_orth1[edge];
    vertex_indices_out[4] = edge_beg_orth2[edge];
    vertex_indices_out[5] = edge_end_orth2[edge];

    d_coeff_d_xi_out[0][direction] = sign_dir;
    d_coeff_d_xi_out[0][ortho1]    = sign_or1 * 0.5;
    d_coeff_d_xi_out[0][ortho2]    = sign_or2 * 0.5;

    d_coeff_d_xi_out[1][direction] = -sign_dir;
    d_coeff_d_xi_out[1][ortho1]    = sign_or1 * 0.5;
    d_coeff_d_xi_out[1][ortho2]    = sign_or2 * 0.5;

    d_coeff_d_xi_out[2][direction] = 0.0;
    d_coeff_d_xi_out[2][ortho1]    = -sign_or1 * 0.5;
    d_coeff_d_xi_out[2][ortho2]    = 0.0;

    d_coeff_d_xi_out[3][direction] = 0.0;
    d_coeff_d_xi_out[3][ortho1]    = -sign_or1 * 0.5;
    d_coeff_d_xi_out[3][ortho2]    = 0.0;

    d_coeff_d_xi_out[4][direction] = 0.0;
    d_coeff_d_xi_out[4][ortho1]    = 0.0;
    d_coeff_d_xi_out[4][ortho2]    = -sign_or2 * 0.5;

    d_coeff_d_xi_out[5][direction] = 0.0;
    d_coeff_d_xi_out[5][ortho1]    = 0.0;
    d_coeff_d_xi_out[5][ortho2]    = -sign_or2 * 0.5;
}
static void MBMesquite::derivatives_at_mid_edge ( unsigned  edge,
NodeSet  nodeset,
size_t *  vertices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 497 of file TetLagrangeShape.cpp.

References MBMesquite::NodeSet::mid_edge_node(), and sign.

{
    int sign;
    num_vtx = 2;
    switch( edge )
    {
        case 0:
            vertices[0]  = 0;
            derivs[0][0] = -1.0;
            derivs[0][1] = -1.0;
            derivs[0][2] = -1.0;

            vertices[1]  = 1;
            derivs[1][0] = 1.0;
            derivs[1][1] = 0.0;
            derivs[1][2] = 0.0;

            if( nodeset.mid_edge_node( 1 ) == nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 2;
                sign               = 1 - 2 * nodeset.mid_edge_node( 1 );
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = sign;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 3 ) == nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 3;
                sign               = 1 - 2 * nodeset.mid_edge_node( 3 );
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = sign;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                derivs[0][1] += 1.0;
                derivs[0][2] += 1.0;
                derivs[1][1] += 1.0;
                derivs[1][2] += 1.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                derivs[1][1] -= 1.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                derivs[0][1] -= 1.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                derivs[0][2] -= 1.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                derivs[1][2] -= 1.0;
                ++num_vtx;
            }
            break;

        case 1:
            vertices[0]  = 1;
            derivs[0][0] = 1.0;
            derivs[0][1] = 0.0;
            derivs[0][2] = 0.0;

            vertices[1]  = 2;
            derivs[1][0] = 0.0;
            derivs[1][1] = 1.0;
            derivs[1][2] = 0.0;

            if( nodeset.mid_edge_node( 0 ) == nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 0;
                sign               = 2 * nodeset.mid_edge_node( 0 ) - 1;
                derivs[num_vtx][0] = sign;
                derivs[num_vtx][1] = sign;
                derivs[num_vtx][2] = sign;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 4 ) == nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 3;
                sign               = 1 - 2 * nodeset.mid_edge_node( 4 );
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = sign;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[0][0] += 1.0;
                derivs[0][1] += 1.0;
                derivs[0][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][0] -= 1.0;
                derivs[0][1] -= 1.0;
                derivs[1][0] -= 1.0;
                derivs[1][1] -= 1.0;
            }

            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[1][0] += 1.0;
                derivs[1][1] += 1.0;
                derivs[1][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                ++num_vtx;
                derivs[0][2] -= 1.0;
            }

            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                ++num_vtx;
                derivs[1][2] -= 1.0;
            }
            break;

        case 2:
            vertices[0]  = 0;
            derivs[0][0] = -1.0;
            derivs[0][1] = -1.0;
            derivs[0][2] = -1.0;

            vertices[1]  = 2;
            derivs[1][0] = 0.0;
            derivs[1][1] = 1.0;
            derivs[1][2] = 0.0;

            if( nodeset.mid_edge_node( 0 ) == nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 1;
                sign               = 1 - 2 * nodeset.mid_edge_node( 0 );
                derivs[num_vtx][0] = sign;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 3 ) == nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 3;
                sign               = 1 - 2 * nodeset.mid_edge_node( 3 );
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = sign;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][0] -= 1.0;
            }

            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[1][0] -= 1.0;
            }

            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[0][0] += 1.0;
                derivs[0][2] += 1.0;
                derivs[1][0] += 1.0;
                derivs[1][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                ++num_vtx;
                derivs[0][2] -= 1.0;
            }

            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                ++num_vtx;
                derivs[1][2] -= 1.0;
            }
            break;

        case 3:
            vertices[0]  = 0;
            derivs[0][0] = -1.0;
            derivs[0][1] = -1.0;
            derivs[0][2] = -1.0;

            vertices[1]  = 3;
            derivs[1][0] = 0.0;
            derivs[1][1] = 0.0;
            derivs[1][2] = 1.0;

            if( nodeset.mid_edge_node( 0 ) == nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 1;
                sign               = 1 - 2 * nodeset.mid_edge_node( 0 );
                derivs[num_vtx][0] = sign;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 2 ) == nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 2;
                sign               = 1 - 2 * nodeset.mid_edge_node( 2 );
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = sign;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][0] -= 1.0;
            }

            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][1] -= 1.0;
            }

            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][0] += 1.0;
                derivs[0][1] += 1.0;
                derivs[1][0] += 1.0;
                derivs[1][1] += 1.0;
            }

            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[1][0] -= 1.0;
            }

            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[1][1] -= 1.0;
            }
            break;

        case 4:
            vertices[0]  = 1;
            derivs[0][0] = 1.0;
            derivs[0][1] = 0.0;
            derivs[0][2] = 0.0;

            vertices[1]  = 3;
            derivs[1][0] = 0.0;
            derivs[1][1] = 0.0;
            derivs[1][2] = 1.0;

            if( nodeset.mid_edge_node( 0 ) == nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 0;
                sign               = 2 * nodeset.mid_edge_node( 0 ) - 1;
                derivs[num_vtx][0] = sign;
                derivs[num_vtx][1] = sign;
                derivs[num_vtx][2] = sign;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 1 ) == nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 2;
                sign               = 1 - 2 * nodeset.mid_edge_node( 1 );
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = sign;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 0 ) )
            {
                vertices[num_vtx]  = 4;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[0][0] += 1.0;
                derivs[0][1] += 1.0;
                derivs[0][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][1] -= 1.0;
            }

            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[1][0] += 1.0;
                derivs[1][1] += 1.0;
                derivs[1][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 2.0;
                ++num_vtx;
                derivs[0][0] -= 1.0;
                derivs[0][2] -= 1.0;
                derivs[1][0] -= 1.0;
                derivs[1][2] -= 1.0;
            }

            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[1][1] -= 1.0;
            }
            break;

        case 5:
            vertices[0]  = 2;
            derivs[0][0] = 0.0;
            derivs[0][1] = 1.0;
            derivs[0][2] = 0.0;

            vertices[1]  = 3;
            derivs[1][0] = 0.0;
            derivs[1][1] = 0.0;
            derivs[1][2] = 1.0;

            if( nodeset.mid_edge_node( 2 ) == nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 0;
                sign               = 2 * nodeset.mid_edge_node( 2 ) - 1;
                derivs[num_vtx][0] = sign;
                derivs[num_vtx][1] = sign;
                derivs[num_vtx][2] = sign;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 1 ) == nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 1;
                sign               = 1 - 2 * nodeset.mid_edge_node( 1 );
                derivs[num_vtx][0] = sign;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
            }

            if( nodeset.mid_edge_node( 1 ) )
            {
                vertices[num_vtx]  = 5;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[0][0] -= 1.0;
            }

            if( nodeset.mid_edge_node( 2 ) )
            {
                vertices[num_vtx]  = 6;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[0][0] += 1.0;
                derivs[0][1] += 1.0;
                derivs[0][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 3 ) )
            {
                vertices[num_vtx]  = 7;
                derivs[num_vtx][0] = -2.0;
                derivs[num_vtx][1] = -2.0;
                derivs[num_vtx][2] = -2.0;
                ++num_vtx;
                derivs[1][0] += 1.0;
                derivs[1][1] += 1.0;
                derivs[1][2] += 1.0;
            }

            if( nodeset.mid_edge_node( 4 ) )
            {
                vertices[num_vtx]  = 8;
                derivs[num_vtx][0] = 2.0;
                derivs[num_vtx][1] = 0.0;
                derivs[num_vtx][2] = 0.0;
                ++num_vtx;
                derivs[1][0] -= 1.0;
            }

            if( nodeset.mid_edge_node( 5 ) )
            {
                vertices[num_vtx]  = 9;
                derivs[num_vtx][0] = 0.0;
                derivs[num_vtx][1] = 2.0;
                derivs[num_vtx][2] = 2.0;
                ++num_vtx;
                derivs[0][1] -= 1.0;
                derivs[0][2] -= 1.0;
                derivs[1][1] -= 1.0;
                derivs[1][2] -= 1.0;
            }
            break;
    }
}
static void MBMesquite::derivatives_at_mid_elem ( size_t *  vertices,
MsqVector< 2 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 150 of file LinearQuadrilateral.cpp.

{
    num_vtx      = 4;
    vertices[0]  = 0;
    derivs[0][0] = -0.5;
    derivs[0][1] = -0.5;
    vertices[1]  = 1;
    derivs[1][0] = 0.5;
    derivs[1][1] = -0.5;
    vertices[2]  = 2;
    derivs[2][0] = 0.5;
    derivs[2][1] = 0.5;
    vertices[3]  = 3;
    derivs[3][0] = -0.5;
    derivs[3][1] = 0.5;
}
static void MBMesquite::derivatives_at_mid_elem ( NodeSet  nodeset,
size_t *  vertices,
MsqVector< 2 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 283 of file QuadLagrangeShape.cpp.

References MBMesquite::NodeSet::both_edge_nodes(), MBMesquite::NodeSet::have_any_mid_node(), and MBMesquite::NodeSet::mid_edge_node().

Referenced by MBMesquite::LinearPrism::derivatives(), MBMesquite::LinearHexahedron::derivatives(), MBMesquite::TriLagrangeShape::derivatives(), MBMesquite::QuadLagrangeShape::derivatives(), MBMesquite::LinearQuadrilateral::derivatives(), and MBMesquite::TetLagrangeShape::derivatives().

{
    // fast linear case
    // This is provided as an optimization for linear elements.
    // If this block of code were removed, the general-case code
    // below should produce the same result.
    if( !nodeset.have_any_mid_node() )
    {
        num_vtx      = 4;
        vertices[0]  = 0;
        derivs[0][0] = -0.5;
        derivs[0][1] = -0.5;
        vertices[1]  = 1;
        derivs[1][0] = 0.5;
        derivs[1][1] = -0.5;
        vertices[2]  = 2;
        derivs[2][0] = 0.5;
        derivs[2][1] = 0.5;
        vertices[3]  = 3;
        derivs[3][0] = -0.5;
        derivs[3][1] = 0.5;
        return;
    }

    num_vtx = 0;

    // N_0
    if( !nodeset.both_edge_nodes( 0, 3 ) )
    {  // if eiter adjacent mid-edge node is missing
        vertices[num_vtx]  = 0;
        derivs[num_vtx][0] = nodeset.mid_edge_node( 3 ) ? 0.0 : -0.5;
        derivs[num_vtx][1] = nodeset.mid_edge_node( 0 ) ? 0.0 : -0.5;
        ++num_vtx;
    }

    // N_1
    if( !nodeset.both_edge_nodes( 0, 1 ) )
    {  // if eiter adjacent mid-edge node is missing
        vertices[num_vtx]  = 1;
        derivs[num_vtx][0] = nodeset.mid_edge_node( 1 ) ? 0.0 : 0.5;
        derivs[num_vtx][1] = nodeset.mid_edge_node( 0 ) ? 0.0 : -0.5;
        ++num_vtx;
    }

    // N_2
    if( !nodeset.both_edge_nodes( 1, 2 ) )
    {  // if eiter adjacent mid-edge node is missing
        vertices[num_vtx]  = 2;
        derivs[num_vtx][0] = nodeset.mid_edge_node( 1 ) ? 0.0 : 0.5;
        derivs[num_vtx][1] = nodeset.mid_edge_node( 2 ) ? 0.0 : 0.5;
        ++num_vtx;
    }

    // N_3
    if( !nodeset.both_edge_nodes( 2, 3 ) )
    {  // if eiter adjacent mid-edge node is missing
        vertices[num_vtx]  = 3;
        derivs[num_vtx][0] = nodeset.mid_edge_node( 3 ) ? 0.0 : -0.5;
        derivs[num_vtx][1] = nodeset.mid_edge_node( 2 ) ? 0.0 : 0.5;
        ++num_vtx;
    }

    // N_4
    if( nodeset.mid_edge_node( 0 ) )
    {
        vertices[num_vtx]  = 4;
        derivs[num_vtx][0] = 0.0;
        derivs[num_vtx][1] = -1.0;
        ++num_vtx;
    }

    // N_5
    if( nodeset.mid_edge_node( 1 ) )
    {
        vertices[num_vtx]  = 5;
        derivs[num_vtx][0] = 1.0;
        derivs[num_vtx][1] = 0.0;
        ++num_vtx;
    }

    // N_6
    if( nodeset.mid_edge_node( 2 ) )
    {
        vertices[num_vtx]  = 6;
        derivs[num_vtx][0] = 0.0;
        derivs[num_vtx][1] = 1.0;
        ++num_vtx;
    }

    // N_7
    if( nodeset.mid_edge_node( 3 ) )
    {
        vertices[num_vtx]  = 7;
        derivs[num_vtx][0] = -1.0;
        derivs[num_vtx][1] = 0.0;
        ++num_vtx;
    }

    // N_8 (mid-quad node) never contributes to Jacobian at element center!!!
}
static void MBMesquite::derivatives_at_mid_elem ( size_t *  vertex_indices_out,
MsqVector< 3 > *  d_coeff_d_xi_out,
size_t &  num_vtx 
) [static]

Definition at line 314 of file LinearHexahedron.cpp.

{
    num_vtx               = 8;
    vertex_indices_out[0] = 0;
    vertex_indices_out[1] = 1;
    vertex_indices_out[2] = 2;
    vertex_indices_out[3] = 3;
    vertex_indices_out[4] = 4;
    vertex_indices_out[5] = 5;
    vertex_indices_out[6] = 6;
    vertex_indices_out[7] = 7;

    d_coeff_d_xi_out[0][0] = -0.25;
    d_coeff_d_xi_out[0][1] = -0.25;
    d_coeff_d_xi_out[0][2] = -0.25;

    d_coeff_d_xi_out[1][0] = 0.25;
    d_coeff_d_xi_out[1][1] = -0.25;
    d_coeff_d_xi_out[1][2] = -0.25;

    d_coeff_d_xi_out[2][0] = 0.25;
    d_coeff_d_xi_out[2][1] = 0.25;
    d_coeff_d_xi_out[2][2] = -0.25;

    d_coeff_d_xi_out[3][0] = -0.25;
    d_coeff_d_xi_out[3][1] = 0.25;
    d_coeff_d_xi_out[3][2] = -0.25;

    d_coeff_d_xi_out[4][0] = -0.25;
    d_coeff_d_xi_out[4][1] = -0.25;
    d_coeff_d_xi_out[4][2] = 0.25;

    d_coeff_d_xi_out[5][0] = 0.25;
    d_coeff_d_xi_out[5][1] = -0.25;
    d_coeff_d_xi_out[5][2] = 0.25;

    d_coeff_d_xi_out[6][0] = 0.25;
    d_coeff_d_xi_out[6][1] = 0.25;
    d_coeff_d_xi_out[6][2] = 0.25;

    d_coeff_d_xi_out[7][0] = -0.25;
    d_coeff_d_xi_out[7][1] = 0.25;
    d_coeff_d_xi_out[7][2] = 0.25;
}
static void MBMesquite::derivatives_at_mid_elem ( NodeSet  nodeset,
size_t *  vertices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 1078 of file TetLagrangeShape.cpp.

References corners, edges, MBMesquite::NodeSet::mid_edge_node(), sign, signs, and zeros.

{

    bool corners[4]          = { false, false, false, false };
    double corner_vals[4][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };

    num_vtx = 0;
    for( unsigned i = 4; i < 10; ++i )
    {
        int sign = signs[i - 4];
        int zero = zeros[i - 4];

        if( nodeset.mid_edge_node( i - 4 ) )
        {
            vertices[num_vtx]     = i;
            derivs[num_vtx][0]    = (double)sign;
            derivs[num_vtx][1]    = (double)sign;
            derivs[num_vtx][2]    = (double)sign;
            derivs[num_vtx][zero] = 0.0;
            ++num_vtx;
        }
        else
        {
            for( unsigned j = 0; j < 2; ++j )
            {
                int corner      = edges[i - 4][j];
                int v1          = ( zero + 1 ) % 3;
                int v2          = ( zero + 2 ) % 3;
                corners[corner] = true;
                corner_vals[corner][v1] += 0.5 * sign;
                corner_vals[corner][v2] += 0.5 * sign;
            }
        }
    }

    for( unsigned i = 0; i < 4; ++i )
        if( corners[i] )
        {
            vertices[num_vtx]  = i;
            derivs[num_vtx][0] = corner_vals[i][0];
            derivs[num_vtx][1] = corner_vals[i][1];
            derivs[num_vtx][2] = corner_vals[i][2];
            ++num_vtx;
        }
}
static void MBMesquite::derivatives_at_mid_face ( unsigned  face,
size_t *  vertex_indices_out,
MsqVector< 3 > *  d_coeff_d_xi_out,
size_t &  num_vtx 
) [static]

Definition at line 253 of file LinearHexahedron.cpp.

References coeff_eta_sign(), coeff_xi_sign(), coeff_zeta_sign(), face_dir, face_opp, and face_vtx.

{
    const int vtx_signs[4][3] = { { coeff_xi_sign( face_vtx[face][0] ), coeff_eta_sign( face_vtx[face][0] ),
                                    coeff_zeta_sign( face_vtx[face][0] ) },
                                  { coeff_xi_sign( face_vtx[face][1] ), coeff_eta_sign( face_vtx[face][1] ),
                                    coeff_zeta_sign( face_vtx[face][1] ) },
                                  { coeff_xi_sign( face_vtx[face][2] ), coeff_eta_sign( face_vtx[face][2] ),
                                    coeff_zeta_sign( face_vtx[face][2] ) },
                                  { coeff_xi_sign( face_vtx[face][3] ), coeff_eta_sign( face_vtx[face][3] ),
                                    coeff_zeta_sign( face_vtx[face][3] ) } };
    const int ortho_dir       = face_dir[face];
    const int face_dir1       = ( ortho_dir + 1 ) % 3;
    const int face_dir2       = ( ortho_dir + 2 ) % 3;
    const int ortho_sign      = vtx_signs[0][ortho_dir];  // same for all 4 verts

    num_vtx               = 8;
    vertex_indices_out[0] = face_vtx[face][0];
    vertex_indices_out[1] = face_vtx[face][1];
    vertex_indices_out[2] = face_vtx[face][2];
    vertex_indices_out[3] = face_vtx[face][3];
    vertex_indices_out[4] = face_vtx[face_opp[face]][0];
    vertex_indices_out[5] = face_vtx[face_opp[face]][1];
    vertex_indices_out[6] = face_vtx[face_opp[face]][2];
    vertex_indices_out[7] = face_vtx[face_opp[face]][3];

    d_coeff_d_xi_out[0][ortho_dir] = ortho_sign * 0.25;
    d_coeff_d_xi_out[0][face_dir1] = vtx_signs[0][face_dir1] * 0.5;
    d_coeff_d_xi_out[0][face_dir2] = vtx_signs[0][face_dir2] * 0.5;

    d_coeff_d_xi_out[1][ortho_dir] = ortho_sign * 0.25;
    d_coeff_d_xi_out[1][face_dir1] = vtx_signs[1][face_dir1] * 0.5;
    d_coeff_d_xi_out[1][face_dir2] = vtx_signs[1][face_dir2] * 0.5;

    d_coeff_d_xi_out[2][ortho_dir] = ortho_sign * 0.25;
    d_coeff_d_xi_out[2][face_dir1] = vtx_signs[2][face_dir1] * 0.5;
    d_coeff_d_xi_out[2][face_dir2] = vtx_signs[2][face_dir2] * 0.5;

    d_coeff_d_xi_out[3][ortho_dir] = ortho_sign * 0.25;
    d_coeff_d_xi_out[3][face_dir1] = vtx_signs[3][face_dir1] * 0.5;
    d_coeff_d_xi_out[3][face_dir2] = vtx_signs[3][face_dir2] * 0.5;

    d_coeff_d_xi_out[4][ortho_dir] = -ortho_sign * 0.25;
    d_coeff_d_xi_out[4][face_dir1] = 0.0;
    d_coeff_d_xi_out[4][face_dir2] = 0.0;

    d_coeff_d_xi_out[5][ortho_dir] = -ortho_sign * 0.25;
    d_coeff_d_xi_out[5][face_dir1] = 0.0;
    d_coeff_d_xi_out[5][face_dir2] = 0.0;

    d_coeff_d_xi_out[6][ortho_dir] = -ortho_sign * 0.25;
    d_coeff_d_xi_out[6][face_dir1] = 0.0;
    d_coeff_d_xi_out[6][face_dir2] = 0.0;

    d_coeff_d_xi_out[7][ortho_dir] = -ortho_sign * 0.25;
    d_coeff_d_xi_out[7][face_dir1] = 0.0;
    d_coeff_d_xi_out[7][face_dir2] = 0.0;
}
static void MBMesquite::derivatives_at_mid_face ( unsigned  face,
NodeSet  nodeset,
size_t *  vertices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [static]

Definition at line 1044 of file TetLagrangeShape.cpp.

References edges, get_linear_derivatives(), ho_dr, ho_ds, ho_dt, and MBMesquite::NodeSet::mid_edge_node().

Referenced by MBMesquite::LinearPrism::derivatives(), MBMesquite::LinearHexahedron::derivatives(), and MBMesquite::TetLagrangeShape::derivatives().

{
    // begin with derivatives for linear tetrahedron
    num_vtx = 4;
    get_linear_derivatives( vertices, derivs );

    for( unsigned i = 0; i < 6; ++i )
        if( nodeset.mid_edge_node( i ) )
        {
            vertices[num_vtx]  = i + 4;
            derivs[num_vtx][0] = ho_dr[i][face];
            derivs[num_vtx][1] = ho_ds[i][face];
            derivs[num_vtx][2] = ho_dt[i][face];
            ++num_vtx;
            int j = edges[i][0];
            derivs[j][0] -= 0.5 * ho_dr[i][face];
            derivs[j][1] -= 0.5 * ho_ds[i][face];
            derivs[j][2] -= 0.5 * ho_dt[i][face];
            j = edges[i][1];
            derivs[j][0] -= 0.5 * ho_dr[i][face];
            derivs[j][1] -= 0.5 * ho_ds[i][face];
            derivs[j][2] -= 0.5 * ho_dt[i][face];
        }
}
void MBMesquite::destroy_patch_with_domain ( PatchData &  pd) [inline]

must be called in sync with create_...._patch_with_domain

Definition at line 67 of file PatchDataInstances.hpp.

References MBMesquite::PatchData::get_domain(), and MBMesquite::PatchData::set_domain().

Referenced by MsqHessianTest::tearDown(), MsqFreeVertexIndexIteratorTest::tearDown(), and MsqMeshEntityTest::tearDown().

{
    MeshDomain* domain = pd.get_domain();
    pd.set_domain( 0 );
    delete domain;

    // Mesh* mesh = pd.get_mesh();
    // pd.set_mesh( 0 );
    // delete mesh;
}
double MBMesquite::det ( const SymMatrix3D &  a) [inline]

Definition at line 236 of file SymMatrix3D.hpp.

{
    return a[0] * a[3] * a[5] + 2.0 * a[1] * a[2] * a[4] - a[0] * a[4] * a[4] - a[3] * a[2] * a[2] - a[5] * a[1] * a[1];
}
double MBMesquite::det ( const Matrix3D &  A) [inline]

Definition at line 805 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::v_.

Referenced by TargetCalculatorTest::check_valid_delta(), TargetCalculatorTest::check_valid_Q(), moab::GeomUtil::closest_location_on_tri(), cofactor(), condition_comp(), LinearMappingFunctionTest::do_ideal_test(), IdealTargetTest::do_test(), MBMesquite::TUntangleBeta::eval(), MBMesquite::TUntangle1::eval(), MBMesquite::AWUntangleBeta::eval(), MBMesquite::TShape2DNB2::evaluate(), MBMesquite::TShapeOrientB1::evaluate(), MBMesquite::TShapeSize2DB2::evaluate(), MBMesquite::TShapeSize2DNB1::evaluate(), MBMesquite::TShapeSize2DNB2::evaluate(), MBMesquite::TShapeSize3DB2::evaluate(), MBMesquite::TShapeSizeB1::evaluate(), MBMesquite::TShapeSizeOrientB1::evaluate(), MBMesquite::TSizeB1::evaluate(), MBMesquite::TInverseMeanRatio::evaluate(), MBMesquite::TShapeSizeB3::evaluate(), MBMesquite::InvTransBarrier::evaluate(), MBMesquite::AWShape2DNB1::evaluate(), MBMesquite::AWShape2DB1::evaluate(), MBMesquite::AWShape2DNB2::evaluate(), MBMesquite::TShapeOrientB2::evaluate(), MBMesquite::TShapeSizeOrientB2::evaluate(), MBMesquite::AWShapeSizeB1::evaluate(), MBMesquite::TShapeSizeNB3::evaluate(), MBMesquite::AWSizeB1::evaluate(), MBMesquite::TTau::evaluate(), MBMesquite::TShape3DB2::evaluate(), MBMesquite::TShapeB1::evaluate(), MBMesquite::TShapeNB1::evaluate(), MBMesquite::TShapeSize3DB4::evaluate(), MBMesquite::TShapeSize3DNB1::evaluate(), TriTauMetric::evaluate(), moab::LinearTet::evaluate_reverse(), moab::LinearTri::evaluate_reverse(), moab::EvalSet::evaluate_reverse(), MBMesquite::TShape2DNB2::evaluate_with_grad(), MBMesquite::TShapeOrientB1::evaluate_with_grad(), MBMesquite::TShapeSize2DB2::evaluate_with_grad(), MBMesquite::TShapeSize2DNB1::evaluate_with_grad(), MBMesquite::TShapeSize2DNB2::evaluate_with_grad(), MBMesquite::TShapeSize3DB2::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB1::evaluate_with_grad(), MBMesquite::TSizeB1::evaluate_with_grad(), MBMesquite::TShapeSizeB3::evaluate_with_grad(), MBMesquite::TInverseMeanRatio::evaluate_with_grad(), MBMesquite::TShapeOrientB2::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB2::evaluate_with_grad(), MBMesquite::AWShape2DNB2::evaluate_with_grad(), MBMesquite::AWShape2DNB1::evaluate_with_grad(), MBMesquite::TShapeSizeNB3::evaluate_with_grad(), MBMesquite::AWSizeB1::evaluate_with_grad(), MBMesquite::TShape3DB2::evaluate_with_grad(), MBMesquite::TShapeB1::evaluate_with_grad(), MBMesquite::TShapeNB1::evaluate_with_grad(), MBMesquite::TShapeSize3DB4::evaluate_with_grad(), MBMesquite::TShapeSize3DNB1::evaluate_with_grad(), MBMesquite::TShape2DNB2::evaluate_with_hess(), MBMesquite::TShapeOrientB1::evaluate_with_hess(), MBMesquite::TSizeB1::evaluate_with_hess(), MBMesquite::TShapeSize2DB2::evaluate_with_hess(), MBMesquite::TShapeSize2DNB1::evaluate_with_hess(), MBMesquite::TShapeSize2DNB2::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSizeB3::evaluate_with_hess(), MBMesquite::TInverseMeanRatio::evaluate_with_hess(), MBMesquite::TShapeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeNB3::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), MBMesquite::TShapeB1::evaluate_with_hess(), MBMesquite::TShapeNB1::evaluate_with_hess(), MBMesquite::TShapeSize3DB4::evaluate_with_hess(), MBMesquite::TShapeSize3DNB1::evaluate_with_hess(), TriTauMetric::evaluate_with_indices(), MBMesquite::TargetCalculator::factor_2D(), MBMesquite::SphericalDomain::fit_vertices(), MBMesquite::LambdaTarget::get_2D_target(), MBMesquite::LambdaTarget::get_3D_target(), moab::DGMSolver::get_tri_natural_coords(), MBMesquite::TUntangleBeta::grad(), MBMesquite::TUntangle1::grad(), MBMesquite::AWUntangleBeta::grad(), MBMesquite::TUntangleBeta::hess(), MBMesquite::TUntangle1::hess(), MBMesquite::MappingFunction2D::ideal(), MBMesquite::MappingFunction3D::ideal(), moab::Element::Map::ievaluate(), moab::element_utility::Linear_tet_map< Entity_handle, moab::Matrix3 >::integrate_scalar_field(), moab::ElemUtil::integrate_trilinear_hex(), MBMesquite::MsqPlane::intersect(), inv(), moab::Matrix::inverse(), inverse(), MBMesquite::MsqMeshEntity::inverted_jacobian_3d(), moab::Matrix3::is_positive_definite(), MBMesquite::TargetWriter::loop_over_mesh(), moab::SmoothFace::project_to_patch(), LVQDTargetTest::setUp(), MBMesquite::TargetCalculator::shape(), MBMesquite::TargetCalculator::size(), MBMesquite::TargetCalculator::skew(), moab::ElemUtil::VolMap::solve_inverse(), moab::element_utility::Linear_hex_map< moab::Matrix3 >::solve_inverse(), moab::element_utility::Spectral_hex_map< moab::Matrix3 >::solve_inverse(), moab::element_utility::Quadratic_hex_map< moab::Matrix3 >::solve_inverse(), moab::GeomUtil::VolMap::solve_inverse(), TargetCalculatorTest::TargetCalculatorTest(), Matrix3DTest::test_det(), SymMatrix3DTest::test_determinant(), MsqMatrixTest::test_determinant(), QualityMetricTest::test_diagonal_tau(), TargetCalculatorTest::test_factor_2D(), TargetCalculatorTest::test_factor_3D(), TargetCalculatorTest::test_factor_surface(), QualityMetricTest::test_gradient_tau(), QualityMetricTest::test_Hessian_tau(), MappingFunctionTest::test_ideal_2d(), MappingFunctionTest::test_ideal_3d(), QuadLagrangeShapeTest::test_ideal_jacobian(), TriLagrangeShapeTest::test_ideal_jacobian(), TetLagrangeShapeTest::test_ideal_jacobian(), HexLagrangeShapeTest::test_ideal_jacobian(), v_hex_relative_size_squared(), v_hex_shape(), v_hex_shear(), v_tet_condition(), and v_tet_quality().

{
    return ( A.v_[0] * ( A.v_[4] * A.v_[8] - A.v_[7] * A.v_[5] ) - A.v_[1] * ( A.v_[3] * A.v_[8] - A.v_[6] * A.v_[5] ) +
             A.v_[2] * ( A.v_[3] * A.v_[7] - A.v_[6] * A.v_[4] ) );
}
template<unsigned RC>
double MBMesquite::det ( const MsqMatrix< RC, RC > &  m) [inline]

Definition at line 973 of file MsqMatrix.hpp.

References RC.

{
    double result = 0.0;
    for( unsigned i = 0; i < RC; ++i )
        result += m( 0, i ) * cofactor< RC >( m, 0, i );
    return result;
}
double MBMesquite::det ( const MsqMatrix< 2, 2 > &  m) [inline]

Definition at line 985 of file MsqMatrix.hpp.

{
    return m( 0, 0 ) * m( 1, 1 ) - m( 0, 1 ) * m( 1, 0 );
}
double MBMesquite::det ( const MsqMatrix< 3, 3 > &  m) [inline]

Definition at line 990 of file MsqMatrix.hpp.

{
    return m( 0, 0 ) * ( m( 1, 1 ) * m( 2, 2 ) - m( 2, 1 ) * m( 1, 2 ) ) +
           m( 0, 1 ) * ( m( 2, 0 ) * m( 1, 2 ) - m( 1, 0 ) * m( 2, 2 ) ) +
           m( 0, 2 ) * ( m( 1, 0 ) * m( 2, 1 ) - m( 2, 0 ) * m( 1, 1 ) );
}
static void MBMesquite::dimension_sort_domains ( MeshDomain **  domains,
const int *  dims,
unsigned  count,
std::vector< DomainClassifier::DomainSet > &  results,
int  dim_indices[4],
MsqError &  err 
) [static]

Group MeshDomain objectects by topological dimension.

Given an array of MeshDomain pointers and and array of dimensions, where each dimension value is the topological dimension of the corresponding domain, construct a DomainSet vector containing the domains, grouped from lowest dimension to highest.

Parameters:
domainsArray of domains
dimsTopological dimension of each domain
countLength of 'domains' and 'dims' arrays
resultsOutput
dim_indicesOutput: index in output at which the first domain of the corresponding topological dimension occurs.

Definition at line 300 of file DomainClassifier.cpp.

References dim, MBMesquite::MsqError::INVALID_ARG, and MSQ_SETERR.

Referenced by MBMesquite::DomainClassifier::classify_geometrically(), and MBMesquite::DomainClassifier::classify_skin_geometrically().

{
    results.clear();
    results.resize( count );
    unsigned idx = 0;
    int dim;
    for( dim = 0; idx < count; ++dim )
    {
        if( dim > 3 )
        {
            MSQ_SETERR( err )( "Invalid domain dimension", MsqError::INVALID_ARG );
            return;
        }
        dim_indices[dim] = idx;
        for( unsigned j = 0; j < count; ++j )
        {
            if( dims[j] == dim )
            {
                results[idx].domain = domains[j];
                ++idx;
            }
        }
    }
    for( ; dim <= 3; ++dim )
        dim_indices[dim] = idx;
}
bool MBMesquite::divide ( double  num,
double  den,
double &  result 
) [inline]

Perform safe division (no overflow or div by zero).

Do result = num/den iff it would not result in an overflow or div by zero

Parameters:
numNumerator of division.
denDenominator of division
resultThe result of the division if valid, zero otherwise.
Returns:
false if the result of the division would be invalid (inf or nan), true otherwise.

Definition at line 225 of file Mesquite.hpp.

Referenced by MBMesquite::TShapeSize2DNB2::evaluate(), MBMesquite::TShapeSize2DNB2::evaluate_with_grad(), MBMesquite::TShapeSize2DNB2::evaluate_with_hess(), grad(), MBMesquite::MappingFunction2D::ideal(), MBMesquite::MappingFunction3D::ideal(), MBMesquite::ConjugateGradient::optimize_vertex_positions(), project_to_matrix_plane(), and project_to_perp_plane().

{
    const double fden = fabs( den );
    // NOTE: First comparison is necessary to avoid overflow in second.
    // NOTE: Comparison in second half of condition must be '<'
    //       rather than '<=' to correctly handle 0/0.
    if( fden >= 1 || fabs( num ) < fden * std::numeric_limits< double >::max() )
    {
        result = num / den;
        return true;
    }
    else
    {
        result = 0.0;
        return false;
    }
}
template<unsigned Dim>
static double MBMesquite::do_finite_difference ( int  r,
int  c,
AWMetric *  metric,
MsqMatrix< Dim, Dim >  A,
const MsqMatrix< Dim, Dim > &  W,
double  value,
MsqError &  err 
) [inline, static]

Definition at line 42 of file AWMetric.cpp.

References epsilon, MBMesquite::AWMetric::evaluate(), init(), MBMesquite::MsqError::INTERNAL_ERROR, MSQ_ERRZERO, and MSQ_SETERR.

Referenced by do_numerical_gradient().

{
    const double INITAL_STEP = std::max( 1e-6, fabs( 1e-14 * value ) );
    const double init        = A( r, c );
    bool valid;
    double diff_value;
    for( double step = INITAL_STEP; step > std::numeric_limits< double >::epsilon(); step *= 0.1 )
    {
        A( r, c ) = init + step;
        valid     = metric->evaluate( A, W, diff_value, err );
        MSQ_ERRZERO( err );
        if( valid ) return ( diff_value - value ) / step;
    }

    // If we couldn't find a valid step, try stepping in the other
    // direciton
    for( double step = INITAL_STEP; step > std::numeric_limits< double >::epsilon(); step *= 0.1 )
    {
        A( r, c ) = init - step;
        valid     = metric->evaluate( A, W, diff_value, err );
        MSQ_ERRZERO( err );
        if( valid ) return ( value - diff_value ) / step;
    }

    // If that didn't work either, then give up.
    MSQ_SETERR( err )
    ( "No valid step size for finite difference of 2D target metric.", MsqError::INTERNAL_ERROR );
    return 0.0;
}
template<unsigned Dim>
static double MBMesquite::do_finite_difference ( int  r,
int  c,
TMetric *  metric,
MsqMatrix< Dim, Dim >  A,
double  value,
MsqError &  err 
) [inline, static]

Definition at line 43 of file TMetric.cpp.

References epsilon, MBMesquite::TMetric::evaluate(), init(), MBMesquite::MsqError::INTERNAL_ERROR, MSQ_ERRZERO, and MSQ_SETERR.

{
    const double INITIAL_STEP = std::max( 1e-6, fabs( 1e-14 * value ) );
    const double init         = A( r, c );
    bool valid;
    double diff_value;
    for( double step = INITIAL_STEP; step > std::numeric_limits< double >::epsilon(); step *= 0.1 )
    {
        A( r, c ) = init + step;
        valid     = metric->evaluate( A, diff_value, err );
        MSQ_ERRZERO( err );
        if( valid ) return ( diff_value - value ) / step;
    }

    // If we couldn't find a valid step, try stepping in the other
    // direciton
    for( double step = INITIAL_STEP; step > std::numeric_limits< double >::epsilon(); step *= 0.1 )
    {
        A( r, c ) = init - step;
        valid     = metric->evaluate( A, diff_value, err );
        MSQ_ERRZERO( err );
        if( valid ) return ( value - diff_value ) / step;
    }
    // If that didn't work either, then give up.
    MSQ_SETERR( err )
    ( "No valid step size for finite difference of 2D target metric.", MsqError::INTERNAL_ERROR );
    return 0.0;
}
template<unsigned Dim>
static bool MBMesquite::do_numerical_gradient ( TMetric *  mu,
MsqMatrix< Dim, Dim >  A,
double &  result,
MsqMatrix< Dim, Dim > &  wrt_A,
MsqError &  err 
) [inline, static]

Definition at line 78 of file TMetric.cpp.

References do_finite_difference(), MBMesquite::TMetric::evaluate(), MSQ_CHKERR, and MSQ_ERRZERO.

{
    bool valid;
    valid = mu->evaluate( A, result, err );
    MSQ_ERRZERO( err );
    if( MSQ_CHKERR( err ) || !valid ) return valid;

    switch( Dim )
    {
        case 3:
            wrt_A( 0, 2 ) = do_finite_difference( 0, 2, mu, A, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 1, 2 ) = do_finite_difference( 1, 2, mu, A, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 2, 0 ) = do_finite_difference( 2, 0, mu, A, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 2, 1 ) = do_finite_difference( 2, 1, mu, A, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 2, 2 ) = do_finite_difference( 2, 2, mu, A, result, err );
            MSQ_ERRZERO( err );
        case 2:
            wrt_A( 0, 1 ) = do_finite_difference( 0, 1, mu, A, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 1, 0 ) = do_finite_difference( 1, 0, mu, A, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 1, 1 ) = do_finite_difference( 1, 1, mu, A, result, err );
            MSQ_ERRZERO( err );
        case 1:
            wrt_A( 0, 0 ) = do_finite_difference( 0, 0, mu, A, result, err );
            MSQ_ERRZERO( err );
            break;
        default:
            assert( false );
    }
    return true;
}
template<unsigned Dim>
static bool MBMesquite::do_numerical_gradient ( AWMetric *  mu,
MsqMatrix< Dim, Dim >  A,
const MsqMatrix< Dim, Dim > &  W,
double &  result,
MsqMatrix< Dim, Dim > &  wrt_A,
MsqError &  err 
) [inline, static]

Definition at line 79 of file AWMetric.cpp.

References do_finite_difference(), MBMesquite::AWMetric::evaluate(), MSQ_CHKERR, and MSQ_ERRZERO.

Referenced by MBMesquite::TMetric::evaluate_with_grad(), and MBMesquite::AWMetric::evaluate_with_grad().

{
    bool valid;
    valid = mu->evaluate( A, W, result, err );
    MSQ_ERRZERO( err );
    if( MSQ_CHKERR( err ) || !valid ) return valid;

    switch( Dim )
    {
        case 3:
            wrt_A( 0, 2 ) = do_finite_difference( 0, 2, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 1, 2 ) = do_finite_difference( 1, 2, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 2, 0 ) = do_finite_difference( 2, 0, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 2, 1 ) = do_finite_difference( 2, 1, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 2, 2 ) = do_finite_difference( 2, 2, mu, A, W, result, err );
            MSQ_ERRZERO( err );
        case 2:
            wrt_A( 0, 1 ) = do_finite_difference( 0, 1, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 1, 0 ) = do_finite_difference( 1, 0, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            wrt_A( 1, 1 ) = do_finite_difference( 1, 1, mu, A, W, result, err );
            MSQ_ERRZERO( err );
        case 1:
            wrt_A( 0, 0 ) = do_finite_difference( 0, 0, mu, A, W, result, err );
            MSQ_ERRZERO( err );
            break;
        default:
            assert( false );
    }
    return true;
}
template<unsigned Dim>
static bool MBMesquite::do_numerical_hessian ( TMetric *  metric,
MsqMatrix< Dim, Dim >  A,
double &  value,
MsqMatrix< Dim, Dim > &  grad,
MsqMatrix< Dim, Dim > *  Hess,
MsqError &  err 
) [inline, static]

Definition at line 120 of file TMetric.cpp.

References MBMesquite::MsqMatrix< R, C >::add_column(), MBMesquite::MsqMatrix< R, C >::add_row(), b, epsilon, MBMesquite::TMetric::evaluate_with_grad(), grad(), MBMesquite::MsqError::INTERNAL_ERROR, MSQ_CHKERR, MSQ_ERRZERO, MSQ_SETERR, MBMesquite::MsqMatrix< R, C >::row(), and transpose().

{
    // zero hessian data
    const int num_block = Dim * ( Dim + 1 ) / 2;
    for( int i = 0; i < num_block; ++i )
        Hess[i].zero();

    // evaluate gradient for input values
    bool valid;
    valid = metric->evaluate_with_grad( A, value, grad, err );
    if( MSQ_CHKERR( err ) || !valid ) return false;

    // do finite difference for each term of A
    const double INITAL_STEP = std::max( 1e-6, fabs( 1e-14 * value ) );
    double value2;
    MsqMatrix< Dim, Dim > grad2;
    for( unsigned r = 0; r < Dim; ++r )
    {  // for each row of A
        for( unsigned c = 0; c < Dim; ++c )
        {  // for each column of A
            const double in_val = A( r, c );
            double step;
            for( step = INITAL_STEP; step > std::numeric_limits< double >::epsilon(); step *= 0.1 )
            {
                A( r, c ) = in_val + step;
                valid     = metric->evaluate_with_grad( A, value2, grad2, err );
                MSQ_ERRZERO( err );
                if( valid ) break;
            }

            // if no valid step size, try step in other direction
            if( !valid )
            {
                for( step = -INITAL_STEP; step < -std::numeric_limits< double >::epsilon(); step *= 0.1 )
                {
                    A( r, c ) = in_val + step;
                    valid     = metric->evaluate_with_grad( A, value2, grad2, err );
                    MSQ_ERRZERO( err );
                    if( valid ) break;
                }

                // if still no valid step size, give up.
                if( !valid )
                {
                    MSQ_SETERR( err )
                    ( "No valid step size for finite difference of 2D target metric.", MsqError::INTERNAL_ERROR );
                    return false;
                }
            }

            // restore A.
            A( r, c ) = in_val;

            // add values into result matrix
            // values of grad2, in row-major order, are a single 9-value row of the Hessian
            grad2 -= grad;
            grad2 /= step;
            for( unsigned b = 0; b < r; ++b )
            {
                const int idx = Dim * b - b * ( b + 1 ) / 2 + r;
                Hess[idx].add_column( c, transpose( grad2.row( b ) ) );
            }
            for( unsigned b = r; b < Dim; ++b )
            {
                const int idx = Dim * r - r * ( r + 1 ) / 2 + b;
                Hess[idx].add_row( c, grad2.row( b ) );
            }
        }  // for (c)
    }      // for (r)

    // Values in non-diagonal blocks were added twice.
    for( unsigned r = 0, h = 1; r < Dim - 1; ++r, ++h )
        for( unsigned c = r + 1; c < Dim; ++c, ++h )
            Hess[h] *= 0.5;

    return true;
}
template<unsigned Dim>
static bool MBMesquite::do_numerical_hessian ( AWMetric *  metric,
MsqMatrix< Dim, Dim >  A,
const MsqMatrix< Dim, Dim > &  W,
double &  value,
MsqMatrix< Dim, Dim > &  grad,
MsqMatrix< Dim, Dim > *  Hess,
MsqError &  err 
) [inline, static]

Definition at line 122 of file AWMetric.cpp.

References MBMesquite::MsqMatrix< R, C >::add_column(), MBMesquite::MsqMatrix< R, C >::add_row(), b, epsilon, MBMesquite::AWMetric::evaluate_with_grad(), grad(), MBMesquite::MsqError::INTERNAL_ERROR, MSQ_CHKERR, MSQ_ERRZERO, MSQ_SETERR, MBMesquite::MsqMatrix< R, C >::row(), and transpose().

Referenced by MBMesquite::TMetric::evaluate_with_hess(), and MBMesquite::AWMetric::evaluate_with_hess().

{
    // zero hessian data
    const int num_block = Dim * ( Dim + 1 ) / 2;
    for( int i = 0; i < num_block; ++i )
        Hess[i].zero();

    // evaluate gradient for input values
    bool valid;
    valid = metric->evaluate_with_grad( A, W, value, grad, err );
    if( MSQ_CHKERR( err ) || !valid ) return false;

    // do finite difference for each term of A
    const double INITAL_STEP = std::max( 1e-6, fabs( 1e-14 * value ) );
    double value2;
    MsqMatrix< Dim, Dim > grad2;
    for( unsigned r = 0; r < Dim; ++r )
    {  // for each row of A
        for( unsigned c = 0; c < Dim; ++c )
        {  // for each column of A
            const double in_val = A( r, c );
            double step;
            for( step = INITAL_STEP; step > std::numeric_limits< double >::epsilon(); step *= 0.1 )
            {
                A( r, c ) = in_val + step;
                valid     = metric->evaluate_with_grad( A, W, value2, grad2, err );
                MSQ_ERRZERO( err );
                if( valid ) break;
            }

            // if no valid step size, try step in other direction
            if( !valid )
            {
                for( step = -INITAL_STEP; step < -std::numeric_limits< double >::epsilon(); step *= 0.1 )
                {
                    A( r, c ) = in_val + step;
                    valid     = metric->evaluate_with_grad( A, W, value2, grad2, err );
                    MSQ_ERRZERO( err );
                    if( valid ) break;
                }

                // if still no valid step size, give up.
                if( !valid )
                {
                    MSQ_SETERR( err )
                    ( "No valid step size for finite difference of 2D target metric.", MsqError::INTERNAL_ERROR );
                    return false;
                }
            }

            // restore A.
            A( r, c ) = in_val;

            // add values into result matrix
            // values of grad2, in row-major order, are a single 9-value row of the Hessian
            grad2 -= grad;
            grad2 /= step;
            for( unsigned b = 0; b < r; ++b )
            {
                const int idx = Dim * b - b * ( b + 1 ) / 2 + r;
                Hess[idx].add_column( c, transpose( grad2.row( b ) ) );
            }
            for( unsigned b = r; b < Dim; ++b )
            {
                const int idx = Dim * r - r * ( r + 1 ) / 2 + b;
                Hess[idx].add_row( c, grad2.row( b ) );
            }
        }  // for (c)
    }      // for (r)

    // Values in non-diagonal blocks were added twice.
    for( unsigned r = 0, h = 1; r < Dim - 1; ++r, ++h )
        for( unsigned c = r + 1; c < Dim; ++c, ++h )
            Hess[h] *= 0.5;

    return true;
}
void MBMesquite::eqAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
) [inline]

Definition at line 764 of file Matrix3D.hpp.

References MBMesquite::Vector3D::mCoords, and MBMesquite::Matrix3D::v_.

Referenced by axpy(), and operator*().

{
    v.mCoords[0] = A.v_[0] * x[0] + A.v_[1] * x.mCoords[1] + A.v_[2] * x.mCoords[2];
    v.mCoords[1] = A.v_[3] * x[0] + A.v_[4] * x.mCoords[1] + A.v_[5] * x.mCoords[2];
    v.mCoords[2] = A.v_[6] * x[0] + A.v_[7] * x.mCoords[1] + A.v_[8] * x.mCoords[2];
}
void MBMesquite::eqTransAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
) [inline]

Definition at line 778 of file Matrix3D.hpp.

References MBMesquite::Vector3D::mCoords, and MBMesquite::Matrix3D::v_.

Referenced by operator*().

{
    v.mCoords[0] = A.v_[0] * x.mCoords[0] + A.v_[3] * x.mCoords[1] + A.v_[6] * x.mCoords[2];
    v.mCoords[1] = A.v_[1] * x.mCoords[0] + A.v_[4] * x.mCoords[1] + A.v_[7] * x.mCoords[2];
    v.mCoords[2] = A.v_[2] * x.mCoords[0] + A.v_[5] * x.mCoords[1] + A.v_[8] * x.mCoords[2];
}
template<unsigned DIM>
static bool MBMesquite::eval ( const MsqMatrix< DIM, DIM > &  T,
double &  result 
) [inline, static]

Definition at line 49 of file TSquared.cpp.

References sqr_Frobenius().

Referenced by get_coeffs(), get_partial_wrt_eta(), and get_partial_wrt_xi().

{
    result = sqr_Frobenius( T );
    return true;
}
template<unsigned DIM>
static bool MBMesquite::eval ( const MsqMatrix< DIM, DIM > &  A,
const MsqMatrix< DIM, DIM > &  W,
double &  result 
) [inline, static]

Definition at line 49 of file AWShapeOrientNB1.cpp.

References sqr_Frobenius().

{
    result = std::sqrt( sqr_Frobenius( A ) * sqr_Frobenius( W ) );
    result -= A % W;
    result *= result;
    return true;
}
static void MBMesquite::find_skin ( Mesh *  mesh,
std::vector< Mesh::VertexHandle > &  skin_verts,
std::vector< Mesh::ElementHandle > &  skin_elems,
MsqError &  err 
) [static]

Skin mesh.

Find vertices and lower-dimension elements on the boundary of a mesh.

Definition at line 182 of file DomainClassifier.cpp.

References arrptr(), compare_sides(), corners, dim, edges, MBMesquite::Mesh::elements_get_attached_vertices(), MBMesquite::Mesh::elements_get_topologies(), MBMesquite::Mesh::get_all_elements(), je, MSQ_ERRRTN, and MBMesquite::Mesh::vertices_get_attached_elements().

Referenced by MBMesquite::DomainClassifier::classify_skin_geometrically().

{
    std::vector< Mesh::ElementHandle > elements, adj_elem, side_elem;
    std::vector< Mesh::VertexHandle > vertices, adj_vtx;
    std::vector< size_t > junk;
    mesh->get_all_elements( elements, err );MSQ_ERRRTN( err );
    if( elements.empty() ) return;
    const unsigned elem_idx[] = { 0, 1, 2, 3 };

    std::vector< unsigned > extra_side_vtx;
    for( size_t e = 0; e < elements.size(); ++e )
    {
        Mesh::ElementHandle elem = elements[e];
        vertices.clear();
        mesh->elements_get_attached_vertices( &elem, 1, vertices, junk, err );MSQ_ERRRTN( err );

        EntityTopology type;
        mesh->elements_get_topologies( &elem, &type, 1, err );MSQ_ERRRTN( err );
        const unsigned dim    = TopologyInfo::dimension( type );
        const unsigned nsides = TopologyInfo::sides( type );
        for( unsigned s = 0; s < nsides; ++s )
        {
            unsigned num_side_vtx;
            const unsigned* side_vtx = TopologyInfo::side_vertices( type, dim - 1, s, num_side_vtx );
            adj_elem.clear();
            side_elem.clear();
            mesh->vertices_get_attached_elements( &vertices[*side_vtx], 1, adj_elem, junk, err );MSQ_ERRRTN( err );

            bool found_adj = false;
            for( size_t a = 0; a < adj_elem.size(); ++a )
            {
                if( adj_elem[a] == elem ) continue;
                EntityTopology adj_type;
                mesh->elements_get_topologies( &adj_elem[a], &adj_type, 1, err );MSQ_ERRRTN( err );
                adj_vtx.clear();
                mesh->elements_get_attached_vertices( &adj_elem[a], 1, adj_vtx, junk, err );MSQ_ERRRTN( err );
                if( TopologyInfo::dimension( adj_type ) == dim )
                {
                    unsigned nsides2 = TopologyInfo::sides( adj_type );
                    for( unsigned s2 = 0; s2 < nsides2; ++s2 )
                    {
                        unsigned num_side_vtx2;
                        const unsigned* side_vtx2 = TopologyInfo::side_vertices( adj_type, dim - 1, s2, num_side_vtx2 );
                        if( num_side_vtx2 == num_side_vtx &&
                            compare_sides( num_side_vtx, side_vtx, arrptr( vertices ), side_vtx2, arrptr( adj_vtx ) ) )
                        {
                            found_adj = true;
                            break;
                        }
                    }
                }
                else
                {
                    if( TopologyInfo::corners( adj_type ) == num_side_vtx )
                        if( compare_sides( num_side_vtx, side_vtx, arrptr( vertices ), elem_idx, arrptr( adj_vtx ) ) )
                            side_elem.push_back( adj_elem[a] );
                }
            }

            if( !found_adj )
            {
                int ho = TopologyInfo::higher_order( type, vertices.size(), err );MSQ_ERRRTN( err );
                // mask mid-element node (because that cannot be on the skin)
                ho &= ~( 1 << dim );
                // if element has other higher-order nodes, we need to find the subset on the skin
                // side
                if( ho )
                {
                    extra_side_vtx.clear();
                    extra_side_vtx.insert( extra_side_vtx.end(), side_vtx, side_vtx + num_side_vtx );
                    // get mid-side node
                    if( ho & ( 1 << ( dim - 1 ) ) )
                    {
                        int idx = TopologyInfo::higher_order_from_side( type, vertices.size(), dim - 1, s, err );MSQ_ERRRTN( err );
                        extra_side_vtx.push_back( idx );
                    }
                    if( dim == 3 && ( ho & 2 ) )
                    {  // if volume element, need mid-edge nodes too
                        const unsigned nedges = TopologyInfo::edges( type );
                        for( unsigned je = 0; je < nedges; ++je )
                        {
                            unsigned tmp;
                            const unsigned* edge_vtx = TopologyInfo::side_vertices( type, 1, je, tmp );
                            assert( edge_vtx && 2 == tmp );
                            unsigned idx = std::find( side_vtx, side_vtx + num_side_vtx, edge_vtx[0] ) - side_vtx;
                            if( idx < num_side_vtx )
                            {
                                if( ( edge_vtx[1] == side_vtx[( idx + 1 ) % num_side_vtx] ) ||
                                    ( edge_vtx[1] == side_vtx[( idx + num_side_vtx - 1 ) % num_side_vtx] ) )
                                {
                                    idx = TopologyInfo::higher_order_from_side( type, vertices.size(), 1, je, err );MSQ_ERRRTN( err );
                                    extra_side_vtx.push_back( idx );
                                }
                            }
                        }
                    }

                    num_side_vtx = extra_side_vtx.size();
                    side_vtx     = arrptr( extra_side_vtx );
                }

                for( unsigned v = 0; v < num_side_vtx; ++v )
                    skin_verts.push_back( vertices[side_vtx[v]] );
                for( unsigned j = 0; j < side_elem.size(); ++j )
                    skin_elems.push_back( side_elem[j] );
            }
        }
    }

    std::sort( skin_verts.begin(), skin_verts.end() );
    skin_verts.erase( std::unique( skin_verts.begin(), skin_verts.end() ), skin_verts.end() );
    std::sort( skin_elems.begin(), skin_elems.end() );
    skin_elems.erase( std::unique( skin_elems.begin(), skin_elems.end() ), skin_elems.end() );
}
template<typename T >
static void MBMesquite::free_vector ( std::vector< T > &  v) [inline, static]

Definition at line 43 of file QuasiNewton.cpp.

Referenced by MBMesquite::QuasiNewton::cleanup(), and MBMesquite::TrustRegion::cleanup().

{
    std::vector< T > temp;
    temp.swap( v );
}
double MBMesquite::Frobenius ( const SymMatrix3D &  a) [inline]

Definition at line 254 of file SymMatrix3D.hpp.

References Frobenius_2().

{
    return std::sqrt( Frobenius_2( a ) );
}
double MBMesquite::Frobenius_2 ( const SymMatrix3D &  a) [inline]

Definition at line 249 of file SymMatrix3D.hpp.

{
    return a[0] * a[0] + 2 * a[1] * a[1] + 2 * a[2] * a[2] + a[3] * a[3] + 2 * a[4] * a[5] + a[5] * a[5];
}
double MBMesquite::Frobenius_2 ( const Matrix3D &  A) [inline]

Return the square of the Frobenius norm of A, i.e. sum (diag (A' * A))

Definition at line 485 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::v_.

Referenced by MBMesquite::CompareQM::check_hess(), CompareMetric::equal(), Frobenius(), MAT_EPS(), MBMesquite::MsqHessian::norm(), and Matrix3DTest::test_Frobenius_2().

{
    return A.v_[0] * A.v_[0] + A.v_[1] * A.v_[1] + A.v_[2] * A.v_[2] + A.v_[3] * A.v_[3] + A.v_[4] * A.v_[4] +
           A.v_[5] * A.v_[5] + A.v_[6] * A.v_[6] + A.v_[7] * A.v_[7] + A.v_[8] * A.v_[8];
}
bool MBMesquite::g_fcn_2e ( double &  obj,
Vector3D  g_obj[3],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 177 of file MeanRatioFunctions.hpp.

References isqrt3, MSQ_MIN, MBMesquite::Exponent::raise(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient().

{
    double matr[9], f;
    double adj_m[9], g;  // adj_m[2,5,8] not used
    double loc1, loc2, loc3;

    /* Calculate M = [A*inv(W) n] */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - x[1][0] - x[0][0] ) * isqrt3;
    matr[2] = n[0];

    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - x[1][1] - x[0][1] ) * isqrt3;
    matr[5] = n[1];

    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - x[1][2] - x[0][2] ) * isqrt3;
    matr[8] = n[2];

    /* Calculate det([n M]). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[2] * matr[7] - matr[1] * matr[8];
    loc3 = matr[1] * matr[5] - matr[2] * matr[4];
    g    = matr[0] * loc1 + matr[3] * loc2 + matr[6] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[3] * matr[3] + matr[4] * matr[4] + matr[6] * matr[6] +
        matr[7] * matr[7];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = matr[0] * f + loc1 * g;
    adj_m[3] = matr[3] * f + loc2 * g;
    adj_m[6] = matr[6] * f + loc3 * g;

    loc1 = matr[0] * g;
    loc2 = matr[3] * g;
    loc3 = matr[6] * g;

    adj_m[1] = matr[1] * f + loc3 * matr[5] - loc2 * matr[8];
    adj_m[4] = matr[4] * f + loc1 * matr[8] - loc3 * matr[2];
    adj_m[7] = matr[7] * f + loc2 * matr[2] - loc1 * matr[5];

    loc1        = isqrt3 * adj_m[1];
    g_obj[0][0] = -adj_m[0] - loc1;
    g_obj[1][0] = adj_m[0] - loc1;
    g_obj[2][0] = 2.0 * loc1;

    loc1        = isqrt3 * adj_m[4];
    g_obj[0][1] = -adj_m[3] - loc1;
    g_obj[1][1] = adj_m[3] - loc1;
    g_obj[2][1] = 2.0 * loc1;

    loc1        = isqrt3 * adj_m[7];
    g_obj[0][2] = -adj_m[6] - loc1;
    g_obj[1][2] = adj_m[6] - loc1;
    g_obj[2][2] = 2.0 * loc1;
    return true;
}
bool MBMesquite::g_fcn_2i ( double &  obj,
Vector3D  g_obj[3],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
) [inline]

Definition at line 612 of file MeanRatioFunctions.hpp.

References MSQ_MIN, MBMesquite::Exponent::raise(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient().

{
    double matr[9], f;
    double adj_m[9], g;  // adj_m[2,5,8] not used
    double loc1, loc2, loc3;

    /* Calculate M = [A*inv(W) n] */
    matr[0] = d[0] * ( x[1][0] - x[0][0] );
    matr[1] = d[1] * ( x[2][0] - x[0][0] );
    matr[2] = n[0];

    matr[3] = d[0] * ( x[1][1] - x[0][1] );
    matr[4] = d[1] * ( x[2][1] - x[0][1] );
    matr[5] = n[1];

    matr[6] = d[0] * ( x[1][2] - x[0][2] );
    matr[7] = d[1] * ( x[2][2] - x[0][2] );
    matr[8] = n[2];

    /* Calculate det([n M]). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[2] * matr[7] - matr[1] * matr[8];
    loc3 = matr[1] * matr[5] - matr[2] * matr[4];
    g    = matr[0] * loc1 + matr[3] * loc2 + matr[6] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[3] * matr[3] + matr[4] * matr[4] + matr[6] * matr[6] +
        matr[7] * matr[7];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = d[0] * ( matr[0] * f + loc1 * g );
    adj_m[3] = d[0] * ( matr[3] * f + loc2 * g );
    adj_m[6] = d[0] * ( matr[6] * f + loc3 * g );

    loc1 = matr[0] * g;
    loc2 = matr[3] * g;
    loc3 = matr[6] * g;

    adj_m[1] = d[1] * ( matr[1] * f + loc3 * matr[5] - loc2 * matr[8] );
    adj_m[4] = d[1] * ( matr[4] * f + loc1 * matr[8] - loc3 * matr[2] );
    adj_m[7] = d[1] * ( matr[7] * f + loc2 * matr[2] - loc1 * matr[5] );

    g_obj[0][0] = -adj_m[0] - adj_m[1];
    g_obj[1][0] = adj_m[0];
    g_obj[2][0] = adj_m[1];

    g_obj[0][1] = -adj_m[3] - adj_m[4];
    g_obj[1][1] = adj_m[3];
    g_obj[2][1] = adj_m[4];

    g_obj[0][2] = -adj_m[6] - adj_m[7];
    g_obj[1][2] = adj_m[6];
    g_obj[2][2] = adj_m[7];
    return true;
}
bool MBMesquite::g_fcn_3e ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1014 of file MeanRatioFunctions.hpp.

References isqrt3, isqrt6, MSQ_MIN, MBMesquite::Exponent::raise(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient().

{
    double matr[9], f;
    double adj_m[9], g;
    double loc1, loc2, loc3;

    /* Calculate M = A*inv(W). */
    f       = x[1][0] + x[0][0];
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - f ) * isqrt3;
    matr[2] = ( 3.0 * x[3][0] - x[2][0] - f ) * isqrt6;

    f       = x[1][1] + x[0][1];
    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - f ) * isqrt3;
    matr[5] = ( 3.0 * x[3][1] - x[2][1] - f ) * isqrt6;

    f       = x[1][2] + x[0][2];
    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - f ) * isqrt3;
    matr[8] = ( 3.0 * x[3][2] - x[2][2] - f ) * isqrt6;

    /* Calculate det(M). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[5] * matr[6] - matr[3] * matr[8];
    loc3 = matr[3] * matr[7] - matr[4] * matr[6];
    g    = matr[0] * loc1 + matr[1] * loc2 + matr[2] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = matr[0] * f + loc1 * g;
    adj_m[1] = matr[1] * f + loc2 * g;
    adj_m[2] = matr[2] * f + loc3 * g;

    loc1 = matr[0] * g;
    loc2 = matr[1] * g;
    loc3 = matr[2] * g;

    adj_m[3] = matr[3] * f + loc3 * matr[7] - loc2 * matr[8];
    adj_m[4] = matr[4] * f + loc1 * matr[8] - loc3 * matr[6];
    adj_m[5] = matr[5] * f + loc2 * matr[6] - loc1 * matr[7];

    adj_m[6] = matr[6] * f + loc2 * matr[5] - loc3 * matr[4];
    adj_m[7] = matr[7] * f + loc3 * matr[3] - loc1 * matr[5];
    adj_m[8] = matr[8] * f + loc1 * matr[4] - loc2 * matr[3];

    loc1        = isqrt3 * adj_m[1];
    loc2        = isqrt6 * adj_m[2];
    loc3        = loc1 + loc2;
    g_obj[0][0] = -adj_m[0] - loc3;
    g_obj[1][0] = adj_m[0] - loc3;
    g_obj[2][0] = 2.0 * loc1 - loc2;
    g_obj[3][0] = 3.0 * loc2;

    loc1        = isqrt3 * adj_m[4];
    loc2        = isqrt6 * adj_m[5];
    loc3        = loc1 + loc2;
    g_obj[0][1] = -adj_m[3] - loc3;
    g_obj[1][1] = adj_m[3] - loc3;
    g_obj[2][1] = 2.0 * loc1 - loc2;
    g_obj[3][1] = 3.0 * loc2;

    loc1        = isqrt3 * adj_m[7];
    loc2        = isqrt6 * adj_m[8];
    loc3        = loc1 + loc2;
    g_obj[0][2] = -adj_m[6] - loc3;
    g_obj[1][2] = adj_m[6] - loc3;
    g_obj[2][2] = 2.0 * loc1 - loc2;
    g_obj[3][2] = 3.0 * loc2;
    return true;
}
bool MBMesquite::g_fcn_3e_v0 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1740 of file MeanRatioFunctions.hpp.

References g_fcn_3e_v3().

{
    static Vector3D my_x[4];

    my_x[0] = x[1];
    my_x[1] = x[3];
    my_x[2] = x[2];
    my_x[3] = x[0];
    return g_fcn_3e_v3( obj, g_obj, my_x, a, b, c );
}
bool MBMesquite::g_fcn_3e_v1 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1756 of file MeanRatioFunctions.hpp.

References g_fcn_3e_v3().

{
    static Vector3D my_x[4];

    my_x[0] = x[0];
    my_x[1] = x[2];
    my_x[2] = x[3];
    my_x[3] = x[1];
    return g_fcn_3e_v3( obj, g_obj, my_x, a, b, c );
}
bool MBMesquite::g_fcn_3e_v2 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1772 of file MeanRatioFunctions.hpp.

References g_fcn_3e_v3().

{
    static Vector3D my_x[4];

    my_x[0] = x[1];
    my_x[1] = x[0];
    my_x[2] = x[3];
    my_x[3] = x[2];
    return g_fcn_3e_v3( obj, g_obj, my_x, a, b, c );
}
bool MBMesquite::g_fcn_3e_v3 ( double &  obj,
Vector3D &  g_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1681 of file MeanRatioFunctions.hpp.

References isqrt3, isqrt6, MSQ_MIN, MBMesquite::Exponent::raise(), tisqrt6, and MBMesquite::Exponent::value().

Referenced by g_fcn_3e_v0(), g_fcn_3e_v1(), and g_fcn_3e_v2().

{
    double matr[9], f, g;
    double loc1, loc2, loc3;

    /* Calculate M = A*inv(W). */
    f       = x[1][0] + x[0][0];
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - f ) * isqrt3;
    matr[2] = ( 3.0 * x[3][0] - x[2][0] - f ) * isqrt6;

    f       = x[1][1] + x[0][1];
    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - f ) * isqrt3;
    matr[5] = ( 3.0 * x[3][1] - x[2][1] - f ) * isqrt6;

    f       = x[1][2] + x[0][2];
    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - f ) * isqrt3;
    matr[8] = ( 3.0 * x[3][2] - x[2][2] - f ) * isqrt6;

    /* Calculate det(M). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[5] * matr[6] - matr[3] * matr[8];
    loc3 = matr[3] * matr[7] - matr[4] * matr[6];
    g    = matr[0] * loc1 + matr[1] * loc2 + matr[2] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    g_obj[0] = tisqrt6 * ( matr[2] * f + loc3 * g );

    loc1 = matr[0] * g;
    loc2 = matr[1] * g;

    g_obj[1] = tisqrt6 * ( matr[5] * f + loc2 * matr[6] - loc1 * matr[7] );
    g_obj[2] = tisqrt6 * ( matr[8] * f + loc1 * matr[4] - loc2 * matr[3] );
    return true;
}
bool MBMesquite::g_fcn_3i ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
) [inline]

Definition at line 1990 of file MeanRatioFunctions.hpp.

References MSQ_MIN, MBMesquite::Exponent::raise(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient().

{
    double matr[9], f;
    double adj_m[9], g;
    double loc1, loc2, loc3;

    /* Calculate M = A*inv(W). */
    matr[0] = d[0] * ( x[1][0] - x[0][0] );
    matr[1] = d[1] * ( x[2][0] - x[0][0] );
    matr[2] = d[2] * ( x[3][0] - x[0][0] );

    matr[3] = d[0] * ( x[1][1] - x[0][1] );
    matr[4] = d[1] * ( x[2][1] - x[0][1] );
    matr[5] = d[2] * ( x[3][1] - x[0][1] );

    matr[6] = d[0] * ( x[1][2] - x[0][2] );
    matr[7] = d[1] * ( x[2][2] - x[0][2] );
    matr[8] = d[2] * ( x[3][2] - x[0][2] );

    /* Calculate det(M). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[5] * matr[6] - matr[3] * matr[8];
    loc3 = matr[3] * matr[7] - matr[4] * matr[6];
    g    = matr[0] * loc1 + matr[1] * loc2 + matr[2] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = d[0] * ( matr[0] * f + loc1 * g );
    adj_m[1] = d[1] * ( matr[1] * f + loc2 * g );
    adj_m[2] = d[2] * ( matr[2] * f + loc3 * g );

    loc1 = matr[0] * g;
    loc2 = matr[1] * g;
    loc3 = matr[2] * g;

    adj_m[3] = d[0] * ( matr[3] * f + loc3 * matr[7] - loc2 * matr[8] );
    adj_m[4] = d[1] * ( matr[4] * f + loc1 * matr[8] - loc3 * matr[6] );
    adj_m[5] = d[2] * ( matr[5] * f + loc2 * matr[6] - loc1 * matr[7] );

    adj_m[6] = d[0] * ( matr[6] * f + loc2 * matr[5] - loc3 * matr[4] );
    adj_m[7] = d[1] * ( matr[7] * f + loc3 * matr[3] - loc1 * matr[5] );
    adj_m[8] = d[2] * ( matr[8] * f + loc1 * matr[4] - loc2 * matr[3] );

    g_obj[0][0] = -adj_m[0] - adj_m[1] - adj_m[2];
    g_obj[1][0] = adj_m[0];
    g_obj[2][0] = adj_m[1];
    g_obj[3][0] = adj_m[2];

    g_obj[0][1] = -adj_m[3] - adj_m[4] - adj_m[5];
    g_obj[1][1] = adj_m[3];
    g_obj[2][1] = adj_m[4];
    g_obj[3][1] = adj_m[5];

    g_obj[0][2] = -adj_m[6] - adj_m[7] - adj_m[8];
    g_obj[1][2] = adj_m[6];
    g_obj[2][2] = adj_m[7];
    g_obj[3][2] = adj_m[8];
    return true;
}
bool MBMesquite::g_fcn_3p ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 2530 of file MeanRatioFunctions.hpp.

References MSQ_MIN, MBMesquite::Exponent::raise(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient(), and h_fcn_3p().

{
    const double h  = 0.5; /* h = 1 / (2*height) */
    const double th = 1.0; /* h = 1 / (height)   */

    double matr[9], f;
    double adj_m[9], g;
    double loc1, loc2, loc3;

    /* Calculate M = A*inv(W). */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = x[2][0] - x[0][0];
    matr[2] = ( 2.0 * x[3][0] - x[1][0] - x[2][0] ) * h;

    matr[3] = x[1][1] - x[0][1];
    matr[4] = x[2][1] - x[0][1];
    matr[5] = ( 2.0 * x[3][1] - x[1][1] - x[2][1] ) * h;

    matr[6] = x[1][2] - x[0][2];
    matr[7] = x[2][2] - x[0][2];
    matr[8] = ( 2.0 * x[3][2] - x[1][2] - x[2][2] ) * h;

    /* Calculate det(M). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[5] * matr[6] - matr[3] * matr[8];
    loc3 = matr[3] * matr[7] - matr[4] * matr[6];
    g    = matr[0] * loc1 + matr[1] * loc2 + matr[2] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = matr[0] * f + loc1 * g;
    adj_m[1] = matr[1] * f + loc2 * g;
    adj_m[2] = matr[2] * f + loc3 * g;

    loc1 = matr[0] * g;
    loc2 = matr[1] * g;
    loc3 = matr[2] * g;

    adj_m[3] = matr[3] * f + loc3 * matr[7] - loc2 * matr[8];
    adj_m[4] = matr[4] * f + loc1 * matr[8] - loc3 * matr[6];
    adj_m[5] = matr[5] * f + loc2 * matr[6] - loc1 * matr[7];

    adj_m[6] = matr[6] * f + loc2 * matr[5] - loc3 * matr[4];
    adj_m[7] = matr[7] * f + loc3 * matr[3] - loc1 * matr[5];
    adj_m[8] = matr[8] * f + loc1 * matr[4] - loc2 * matr[3];

    g_obj[0][0] = -adj_m[0] - adj_m[1];
    g_obj[1][0] = adj_m[0] - h * adj_m[2];
    g_obj[2][0] = adj_m[1] - h * adj_m[2];
    g_obj[3][0] = th * adj_m[2];

    g_obj[0][1] = -adj_m[3] - adj_m[4];
    g_obj[1][1] = adj_m[3] - h * adj_m[5];
    g_obj[2][1] = adj_m[4] - h * adj_m[5];
    g_obj[3][1] = th * adj_m[5];

    g_obj[0][2] = -adj_m[6] - adj_m[7];
    g_obj[1][2] = adj_m[6] - h * adj_m[8];
    g_obj[2][2] = adj_m[7] - h * adj_m[8];
    g_obj[3][2] = th * adj_m[8];
    return true;
}
bool MBMesquite::g_fcn_3w ( double &  obj,
Vector3D  g_obj[4],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 3129 of file MeanRatioFunctions.hpp.

References isqrt3, MSQ_MIN, MBMesquite::Exponent::raise(), tisqrt3, and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient().

{
    double matr[9], f;
    double adj_m[9], g;
    double loc1, loc2, loc3;

    /* Calculate M = A*inv(W). */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = isqrt3 * ( 2 * x[2][0] - x[1][0] - x[0][0] );
    matr[2] = x[3][0] - x[0][0];

    matr[3] = x[1][1] - x[0][1];
    matr[4] = isqrt3 * ( 2 * x[2][1] - x[1][1] - x[0][1] );
    matr[5] = x[3][1] - x[0][1];

    matr[6] = x[1][2] - x[0][2];
    matr[7] = isqrt3 * ( 2 * x[2][2] - x[1][2] - x[0][2] );
    matr[8] = x[3][2] - x[0][2];

    /* Calculate det(M). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[5] * matr[6] - matr[3] * matr[8];
    loc3 = matr[3] * matr[7] - matr[4] * matr[6];
    g    = matr[0] * loc1 + matr[1] * loc2 + matr[2] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = matr[0] * f + loc1 * g;
    adj_m[1] = matr[1] * f + loc2 * g;
    adj_m[2] = matr[2] * f + loc3 * g;

    loc1 = matr[0] * g;
    loc2 = matr[1] * g;
    loc3 = matr[2] * g;

    adj_m[3] = matr[3] * f + loc3 * matr[7] - loc2 * matr[8];
    adj_m[4] = matr[4] * f + loc1 * matr[8] - loc3 * matr[6];
    adj_m[5] = matr[5] * f + loc2 * matr[6] - loc1 * matr[7];

    adj_m[6] = matr[6] * f + loc2 * matr[5] - loc3 * matr[4];
    adj_m[7] = matr[7] * f + loc3 * matr[3] - loc1 * matr[5];
    adj_m[8] = matr[8] * f + loc1 * matr[4] - loc2 * matr[3];

    g_obj[0][0] = -adj_m[0] - isqrt3 * adj_m[1] - adj_m[2];
    g_obj[1][0] = adj_m[0] - isqrt3 * adj_m[1];
    g_obj[2][0] = tisqrt3 * adj_m[1];
    g_obj[3][0] = adj_m[2];

    g_obj[0][1] = -adj_m[3] - isqrt3 * adj_m[4] - adj_m[5];
    g_obj[1][1] = adj_m[3] - isqrt3 * adj_m[4];
    g_obj[2][1] = tisqrt3 * adj_m[4];
    g_obj[3][1] = adj_m[5];

    g_obj[0][2] = -adj_m[6] - isqrt3 * adj_m[7] - adj_m[8];
    g_obj[1][2] = adj_m[6] - isqrt3 * adj_m[7];
    g_obj[2][2] = tisqrt3 * adj_m[7];
    g_obj[3][2] = adj_m[8];

    return true;
}
static double MBMesquite::generate_random_number ( int  generate_random_numbers,
int  proc_id,
size_t  glob_id 
) [static]

Definition at line 188 of file ParallelHelper.cpp.

References hash6432shift(), and hash64shift().

Referenced by MBMesquite::ParallelHelperImpl::smoothing_init().

{
    int gid;

    if( sizeof( size_t ) == sizeof( unsigned long long ) )
    {
        gid = hash6432shift( (unsigned long long)glob_id );
    }
    else
    {
        gid = (int)glob_id;
    }

    if( generate_random_numbers == 1 )
    {
        // count number of on bits
        int on            = 0;
        unsigned int mist = (unsigned int)gid;
        while( mist )
        {
            if( mist & 1 ) on++;
            mist = mist >> 1;
        }
        unsigned short xsubi[3];
        if( on & 1 )
            mist = (unsigned int)gid;
        else
            mist = (unsigned int)( -gid );
        if( on & 2 )
        {
            xsubi[0] = (unsigned short)( 65535 & mist );
            xsubi[1] = (unsigned short)( 65535 & ( mist >> 16 ) );
        }
        else
        {
            xsubi[1] = (unsigned short)( 65535 & mist );
            xsubi[0] = (unsigned short)( 65535 & ( mist >> 16 ) );
        }
        xsubi[2] = proc_id;

#if( defined WIN32 || defined WIN64 )
        time_t seed = ( gid + xsubi[1] ) / ( ( time( NULL ) % 10 ) + 1 );
        srand( (int)seed );
        return rand() / ( RAND_MAX + 1.0 );
#else
        return erand48( xsubi );
#endif
    }
    else if( generate_random_numbers == 2 )
    {
        // count number of on bits
        int on            = 0;
        unsigned int mist = (unsigned int)gid;
        while( mist )
        {
            if( mist & 1 ) on++;
            mist = mist >> 1;
        }
        unsigned short xsubi[3];
        if( on & 1 )
            mist = (unsigned int)gid;
        else
            mist = (unsigned int)( -gid );
        if( on & 2 )
        {
            xsubi[0] = (unsigned short)( 65535 & mist );
            xsubi[1] = (unsigned short)( 65535 & ( mist >> 16 ) );
        }
        else
        {
            xsubi[1] = (unsigned short)( 65535 & mist );
            xsubi[0] = (unsigned short)( 65535 & ( mist >> 16 ) );
        }
        xsubi[2] = proc_id ^ xsubi[1];

#if( defined WIN32 || defined WIN64 )
        time_t seed = ( gid + xsubi[1] ) / ( ( time( NULL ) % 10 ) + 1 );
        srand( (int)seed );
        return rand() / ( RAND_MAX + 1.0 );
#else
        return erand48( xsubi );
#endif
    }
    else if( generate_random_numbers == 3 )
    {
        unsigned long long key = (unsigned long long)gid;
        key                    = key << 32;
        key                    = key | proc_id;
        return (double)hash64shift( key );
    }
    else if( generate_random_numbers == 4 )
    {
        unsigned long long key = (unsigned long long)gid;
        key                    = key << 32;
        key                    = key | proc_id;
        key                    = hash64shift( key );
        unsigned short xsubi[3];
        xsubi[0] = (unsigned short)( key >> 48 );
        xsubi[1] = (unsigned short)( key >> 32 );
        xsubi[2] = (unsigned short)( key >> 16 );

#if( defined WIN32 || defined WIN64 )
        time_t seed = ( gid + xsubi[1] ) / ( ( time( NULL ) % 10 ) + 1 );
        srand( (int)seed );
        return rand() / ( RAND_MAX + 1.0 );
#else
        return erand48( xsubi );
#endif
    }
    else
    {
        return -1;
    }
}
static void MBMesquite::geom_classify_elements ( Mesh *  mesh,
DomainClassifier::DomainSet *  dim_sorted_domains,
unsigned  num_domain,
int  dim_indices[4],
const std::vector< Mesh::ElementHandle > &  elems,
std::vector< Mesh::ElementHandle > &  unknown_elems,
double  epsilon,
MsqError &  err 
) [static]

Classify mesh elements geometrically.

Definition at line 427 of file DomainClassifier.cpp.

References arrptr(), MBMesquite::DomainClassifier::DomainSet::domain, MBMesquite::DomainClassifier::DomainSet::elements, MBMesquite::Mesh::elements_get_attached_vertices(), epsilon, length_squared(), MSQ_ERRRTN, MBMesquite::MeshDomain::snap_to(), and MBMesquite::Mesh::vertices_get_coordinates().

Referenced by MBMesquite::DomainClassifier::classify_geometrically(), and MBMesquite::DomainClassifier::classify_skin_geometrically().

{
    if( elems.empty() ) return;

    const double epssqr = epsilon * epsilon;
    Vector3D pt;
    MsqVertex coord;
    std::vector< Mesh::ElementHandle >::const_iterator iter;
    std::vector< Mesh::VertexHandle > verts;
    std::vector< MsqVertex > coords;
    std::vector< size_t > junk;
    for( iter = elems.begin(); iter != elems.end(); ++iter )
    {
        verts.clear();
        mesh->elements_get_attached_vertices( &*iter, 1, verts, junk, err );MSQ_ERRRTN( err );
        coords.resize( verts.size() );
        mesh->vertices_get_coordinates( arrptr( verts ), arrptr( coords ), verts.size(), err );MSQ_ERRRTN( err );

        // get all 2D domains that contain first vertex
        std::vector< int > doms;
        for( int i = dim_indices[2]; i < dim_indices[3]; ++i )
        {
            pt = coords[0];
            dim_sorted_domains[i].domain->snap_to( verts[0], pt );
            if( ( pt - coords[0] ).length_squared() <= epssqr ) doms.push_back( i );
        }

        // of the 2D domains containing the first vertex,
        // remove any that do not contain all other corners of the element.
        for( unsigned i = 1; i < verts.size(); ++i )
        {
            for( unsigned j = 0; j < doms.size(); )
            {
                pt = coords[i];
                dim_sorted_domains[doms[j]].domain->snap_to( verts[j], pt );
                if( ( pt - coords[0] ).length_squared() <= epssqr )
                    ++j;
                else
                    doms.erase( doms.begin() + j );
            }
        }

        if( doms.size() == 1 )
            dim_sorted_domains[doms.front()].elements.push_back( *iter );
        else
            unknown_elems.push_back( *iter );
    }
}
static void MBMesquite::geom_classify_vertices ( Mesh *  mesh,
DomainClassifier::DomainSet *  dim_sorted_domains,
unsigned  num_domain,
const std::vector< Mesh::VertexHandle > &  vertices,
double  epsilon,
MsqError &  err 
) [static]

Classify mesh vertices using vertex position.

Classify vertices by distance from each geometric domain. A vertex is assigned to a domain if it lies within the domain. If a vertex lies in multiple domains, it is assigned to the domain with the lowest topological dimension.

Parameters:
meshThe MBMesquite::Mesh instance
dim_sorted_domainsThe list of MeshDomains, sorted from lowest to highest dimension.
num_domainLength of 'dim_sorted_domains' array.
verticesVertices to classify
epsilonMaximum distance a vertex may deviate from its domain.

Definition at line 332 of file DomainClassifier.cpp.

References MBMesquite::MsqError::clear(), dim, MBMesquite::DomainClassifier::DomainSet::domain, MBMesquite::MeshDomain::domain_DoF(), epsilon, length_squared(), MSQ_ERRRTN, MBMesquite::MeshDomain::snap_to(), MBMesquite::DomainClassifier::DomainSet::vertices, and MBMesquite::Mesh::vertices_get_coordinates().

Referenced by MBMesquite::DomainClassifier::classify_geometrically(), and MBMesquite::DomainClassifier::classify_skin_geometrically().

{
    Vector3D pt;
    MsqVertex coord;
    unsigned i;
    unsigned short dim;
    const double epssqr = epsilon * epsilon;
    std::vector< Mesh::VertexHandle >::const_iterator iter;
    for( iter = vertices.begin(); iter != vertices.end(); ++iter )
    {
        mesh->vertices_get_coordinates( &*iter, &coord, 1, err );MSQ_ERRRTN( err );
        for( i = 0; i < num_domain; ++i )
        {
            // Call DoF function first just to see if it fails
            // (e.g. if domain knows which vertices it is responsible for,
            //  it should fail if this vertex isn't one.)
            dim_sorted_domains[i].domain->domain_DoF( &*iter, &dim, 1, err );
            if( err || dim > 2 )
            {
                err.clear();
                continue;
            }
            pt = coord;
            dim_sorted_domains[i].domain->snap_to( *iter, pt );
            if( ( pt - coord ).length_squared() <= epssqr )
            {
                dim_sorted_domains[i].vertices.push_back( *iter );
                break;
            }
        }
    }
}
static double MBMesquite::get_delta_C ( const PatchData &  pd,
const std::vector< size_t > &  indices,
MsqError &  err 
) [inline, static]

Definition at line 56 of file QualityMetric.cpp.

References MBMesquite::PatchData::get_adjacent_vertex_indices(), MBMesquite::MsqError::INVALID_ARG, MSQ_ERRZERO, MSQ_SETERR, u, and MBMesquite::PatchData::vertex_by_index().

Referenced by MBMesquite::QualityMetric::evaluate_with_gradient(), and MBMesquite::QualityMetric::evaluate_with_Hessian().

{
    if( indices.empty() )
    {
        MSQ_SETERR( err )( MsqError::INVALID_ARG );
        return 0.0;
    }

    std::vector< size_t >::const_iterator beg, iter, iter2, end;

    std::vector< size_t > tmp_vect;
    if( indices.size() == 1u )
    {
        pd.get_adjacent_vertex_indices( indices.front(), tmp_vect, err );
        MSQ_ERRZERO( err );
        assert( !tmp_vect.empty() );
        tmp_vect.push_back( indices.front() );
        beg = tmp_vect.begin();
        end = tmp_vect.end();
    }
    else
    {
        beg = indices.begin();
        end = indices.end();
    }

    double min_dist_sqr = HUGE_VAL, sum_dist_sqr = 0.0;
    for( iter = beg; iter != end; ++iter )
    {
        for( iter2 = iter + 1; iter2 != end; ++iter2 )
        {
            Vector3D diff = pd.vertex_by_index( *iter );
            diff -= pd.vertex_by_index( *iter2 );
            double dist_sqr = diff % diff;
            if( dist_sqr < min_dist_sqr ) min_dist_sqr = dist_sqr;
            sum_dist_sqr += dist_sqr;
        }
    }

    return 3e-6 * sqrt( min_dist_sqr ) + 5e-7 * sqrt( sum_dist_sqr / ( end - beg ) );
}
void MBMesquite::get_elem_sample_points ( PatchData &  pd,
size_t  elem,
std::vector< size_t > &  handles,
MsqError &   
)
static void MBMesquite::get_field_names ( const TagDescription &  tag,
std::string &  field_out,
std::string &  member_out,
MsqError &  err 
) [static]

Definition at line 336 of file MeshImpl.cpp.

References MBMesquite::TagDescription::FIELD, MBMesquite::MsqError::FILE_FORMAT, MBMesquite::TagDescription::member, MESQUITE_FIELD_TAG, MSQ_SETERR, MBMesquite::TagDescription::name, and MBMesquite::TagDescription::vtkType.

Referenced by MBMesquite::MeshImpl::vtk_write_attrib_data(), and MBMesquite::MeshImpl::write_vtk().

{
    std::string::size_type idx;

    if( tag.vtkType != TagDescription::FIELD )
    {
        field_out  = tag.name;
        member_out = "";
    }
    else if( !tag.member.empty() )
    {
        field_out  = tag.name;
        member_out = tag.member;
    }
    // If field is a struct, then the Mesquite tag name is a contcatenation
    // of the field name and the struct member name.  Extract them.
    else
    {
        idx = tag.name.find( " " );
        if( idx == std::string::npos )
        {
            field_out  = tag.name;
            member_out = MESQUITE_FIELD_TAG;
        }
        else
        {
            field_out  = tag.name.substr( 0, idx );
            member_out = tag.name.substr( idx + 1 );
        }
    }

    idx = field_out.find( " " );
    if( idx != std::string::npos ) MSQ_SETERR( err )
    ( MsqError::FILE_FORMAT, "Cannot write tag name \"%s\" containing spaces to VTK file.", field_out.c_str() );

    idx = member_out.find( " " );
    if( idx != std::string::npos ) MSQ_SETERR( err )
    ( MsqError::FILE_FORMAT, "Cannot write field member name \"%s\" containing spaces to VTK file.",
      member_out.c_str() );
}
static void MBMesquite::get_linear_derivatives ( size_t *  vertices,
MsqVector< 2 > *  derivs 
) [inline, static]

Definition at line 133 of file TriLagrangeShape.cpp.

{
    vertices[0]  = 0;
    vertices[1]  = 1;
    vertices[2]  = 2;
    derivs[0][0] = -1.0;
    derivs[0][1] = -1.0;
    derivs[1][0] = 1.0;
    derivs[1][1] = 0.0;
    derivs[2][0] = 0.0;
    derivs[2][1] = 1.0;
}
static void MBMesquite::get_linear_derivatives ( size_t *  vertices,
MsqVector< 3 > *  derivs 
) [static]

Definition at line 312 of file TetLagrangeShape.cpp.

Referenced by MBMesquite::TriLagrangeShape::derivatives(), MBMesquite::TetLagrangeShape::derivatives(), derivatives_at_corner(), and derivatives_at_mid_face().

{
    vertices[0]  = 0;
    derivs[0][0] = -1.0;
    derivs[0][1] = -1.0;
    derivs[0][2] = -1.0;

    vertices[1]  = 1;
    derivs[1][0] = 1.0;
    derivs[1][1] = 0.0;
    derivs[1][2] = 0.0;

    vertices[2]  = 2;
    derivs[2][0] = 0.0;
    derivs[2][1] = 1.0;
    derivs[2][2] = 0.0;

    vertices[3]  = 3;
    derivs[3][0] = 0.0;
    derivs[3][1] = 0.0;
    derivs[3][2] = 1.0;
}
static NodeSet MBMesquite::get_nodeset ( EntityTopology  type,
int  num_nodes,
MsqError &  err 
) [static]

Definition at line 529 of file TargetCalculator.cpp.

References midedge, MSQ_CHKERR, MBMesquite::NodeSet::set_all_corner_nodes(), MBMesquite::NodeSet::set_all_mid_edge_nodes(), MBMesquite::NodeSet::set_all_mid_face_nodes(), and MBMesquite::NodeSet::set_mid_region_node().

Referenced by MBMesquite::TargetCalculator::jacobian_2D(), and MBMesquite::TargetCalculator::jacobian_3D().

{
    bool midedge, midface, midvol;
    TopologyInfo::higher_order( type, num_nodes, midedge, midface, midvol, err );
    if( MSQ_CHKERR( err ) ) return NodeSet();

    NodeSet bits;
    bits.set_all_corner_nodes( type );
    if( midedge ) bits.set_all_mid_edge_nodes( type );
    if( midface ) bits.set_all_mid_face_nodes( type );
    if( TopologyInfo::dimension( type ) == 3 && midvol ) bits.set_mid_region_node();

    return bits;
}

Definition at line 35 of file ParallelHelper.cpp.

References MPI_COMM_WORLD, and rank.

Referenced by MBMesquite::ConjugateGradient::initialize(), MBMesquite::VertexMover::loop_over_mesh(), MBMesquite::TerminationCriterion::par_string(), and MBMesquite::TerminationCriterion::terminate().

{
    int rank    = 0;
    int is_init = 0;
    int err     = MPI_Initialized( &is_init );
    if( MPI_SUCCESS != err ) return 0;
    if( is_init ) MPI_Comm_rank( MPI_COMM_WORLD, &rank );
    return rank;
}

Definition at line 45 of file ParallelHelper.cpp.

References MPI_COMM_WORLD.

Referenced by MBMesquite::ConjugateGradient::initialize(), and MBMesquite::TerminationCriterion::par_string().

{
    int nprocs  = 0;
    int is_init = 0;
    int err     = MPI_Initialized( &is_init );
    if( MPI_SUCCESS != err ) return 0;
    if( is_init ) MPI_Comm_size( MPI_COMM_WORLD, &nprocs );
    return nprocs;
}
void MBMesquite::get_sample_pt_evaluations ( PatchData &  pd,
std::vector< size_t > &  handles,
bool  free,
MsqError &  err 
)

Definition at line 132 of file TargetMetricUtil.cpp.

References append_elem_samples(), MBMesquite::ElementQM::get_element_evaluations(), and MSQ_ERRRTN.

Referenced by MBMesquite::AffineMapMetric::get_evaluations(), MBMesquite::TMPQualityMetric::get_evaluations(), and MBMesquite::TMPQualityMetric::get_patch_evaluations().

{
    handles.clear();
    std::vector< size_t > elems;
    ElementQM::get_element_evaluations( pd, elems, free, err );MSQ_ERRRTN( err );
    for( std::vector< size_t >::iterator i = elems.begin(); i != elems.end(); ++i )
        append_elem_samples( pd, *i, handles );
}
static TagHandle MBMesquite::get_tag ( Mesh *  mesh,
unsigned  num_doubles,
const std::string &  base_name,
MsqError &  err 
) [static]

Definition at line 42 of file WeightReader.cpp.

References MBMesquite::Mesh::DOUBLE, MSQ_ERRZERO, MSQ_SETERR, MBMesquite::MsqError::TAG_ALREADY_EXISTS, MBMesquite::Mesh::tag_get(), and MBMesquite::Mesh::tag_properties().

{
    std::ostringstream str;
    str << base_name << num_doubles;

    TagHandle handle = mesh->tag_get( str.str().c_str(), err );
    MSQ_ERRZERO( err );

    // double check tag type
    std::string temp_name;
    Mesh::TagType temp_type;
    unsigned temp_length;
    mesh->tag_properties( handle, temp_name, temp_type, temp_length, err );
    MSQ_ERRZERO( err );

    if( temp_type != Mesh::DOUBLE || temp_length != num_doubles )
    {
        MSQ_SETERR( err )
        ( MsqError::TAG_ALREADY_EXISTS, "Mismatched type or length for existing tag \"%s\"", str.str().c_str() );
    }

    return handle;
}
static TagHandle MBMesquite::get_tag ( Mesh *  mesh,
unsigned  num_matrices,
unsigned  dimension,
const char *  base_name,
bool  orient_surface,
MsqError &  err 
) [static]

Definition at line 43 of file TargetReader.cpp.

References MBMesquite::Mesh::DOUBLE, MSQ_ERRZERO, MSQ_SETERR, MBMesquite::MsqError::TAG_ALREADY_EXISTS, MBMesquite::Mesh::tag_get(), and MBMesquite::Mesh::tag_properties().

Referenced by MBMesquite::TargetReader::get_2D_target(), MBMesquite::TargetReader::get_3D_target(), MBMesquite::TargetReader::get_surface_target(), and MBMesquite::WeightReader::get_weight().

{
    unsigned matrix_size;
    if( dimension == 2 && !orient_surface )
        matrix_size = 4;
    else
        matrix_size = dimension * 3;
    unsigned num_doubles = num_matrices * matrix_size;
    std::ostringstream str;
    str << base_name << num_doubles;

    TagHandle handle = mesh->tag_get( str.str().c_str(), err );
    MSQ_ERRZERO( err );

    // check tag type
    std::string temp_name;
    Mesh::TagType temp_type;
    unsigned temp_length;
    mesh->tag_properties( handle, temp_name, temp_type, temp_length, err );
    MSQ_ERRZERO( err );

    if( temp_type != Mesh::DOUBLE || temp_length != num_doubles )
    {
        MSQ_SETERR( err )
        ( MsqError::TAG_ALREADY_EXISTS, "Mismatched type or length for existing tag \"%s\"", str.str().c_str() );
    }

    return handle;
}
static void MBMesquite::get_u_perp ( const MsqVector< 3 > &  u,
MsqVector< 3 > &  u_perp 
) [static]

Definition at line 123 of file TMPQualityMetric.cpp.

References b.

Referenced by project_to_matrix_plane().

{
    double a = sqrt( u[0] * u[0] + u[1] * u[1] );
    if( a < 1e-10 )
    {
        u_perp[0] = 1.0;
        u_perp[1] = u_perp[2] = 0.0;
    }
    else
    {
        double b  = -u[2] / a;
        u_perp[0] = u[0] * b;
        u_perp[1] = u[1] * b;
        u_perp[2] = a;
    }
}
template<unsigned DIM>
static bool MBMesquite::grad ( const MsqMatrix< DIM, DIM > &  T,
double &  result,
MsqMatrix< DIM, DIM > &  wrt_T 
) [inline, static]

Definition at line 56 of file TSquared.cpp.

References sqr_Frobenius(), and T.

Referenced by ObjectiveFunctionTests::compare_diagonal_gradient(), QualityMetricTester::compare_eval_with_indices_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_indices_and_eval_with_gradient(), QualityMetricTester::compare_eval_with_indices_and_eval_with_hessian(), ObjectiveFunctionTests::compare_hessian_gradient(), ObjectiveFunctionTests::compare_numerical_hessian(), do_numerical_hessian(), GradTestMetricRel::evaluate(), GradTestMetricAbs::evaluate(), ObjectiveFunctionTests::evaluate_internal(), MBMesquite::AWQualityMetric::evaluate_with_gradient(), MBMesquite::TQualityMetric::evaluate_with_gradient(), MBMesquite::AWQualityMetric::evaluate_with_Hessian(), MBMesquite::TQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::TQualityMetric::evaluate_with_Hessian_diagonal(), CompositeOFTest::get_hessians(), UnOptimizer::optimize_vertex_positions(), MBMesquite::FeasibleNewton::optimize_vertex_positions(), pmean_corner_diagonals(), pmean_corner_hessians(), sum_corner_diagonals(), sum_corner_hessians(), sum_sqr_corner_diagonals(), sum_sqr_corner_hessians(), PMeanPTemplateTest::test_diagonal(), QualityMetricTester::test_diagonal_with_fixed_vertex(), QualityMetricTester::test_domain_deviation_gradient(), PMeanPTemplateTest::test_gradient(), TerminationCriterionTest::test_gradient_common(), QualityMetricTester::test_gradient_reflects_quality(), QualityMetricTester::test_gradient_with_fixed_vertex(), ObjectiveFunctionTests::test_handles_invalid_qm(), ObjectiveFunctionTests::test_handles_qm_error(), PMeanPTemplateTest::test_Hessian(), StdDevTemplateTest::test_hessian_fails(), StdDevTemplateTest::test_hessian_fails_sqr(), QualityMetricTester::test_hessian_with_fixed_vertex(), QualityMetricTester::test_ideal_element_positive_definite_Hessian(), QualityMetricTester::test_ideal_element_zero_gradient(), QualityMetricTester::test_ideal_element_zero_vertex_gradient(), CompositeOFTest::test_multiply_hess_diagonal(), CompositeOFTest::test_multiply_hessian(), ObjectiveFunctionTests::test_negate_flag(), QualityMetricTester::test_symmetric_Hessian_diagonal_blocks(), QualityMetricTester::test_type_is_not_supported(), QualityMetricTester::test_type_is_supported(), and QualityMetricTester::test_vertex_gradient_reflects_quality().

{
    result = sqr_Frobenius( T );
    wrt_T  = 2 * T;
    return true;
}
template<unsigned DIM>
static bool MBMesquite::grad ( const MsqMatrix< DIM, DIM > &  A,
const MsqMatrix< DIM, DIM > &  W,
double &  result,
MsqMatrix< DIM, DIM > &  deriv 
) [inline, static]

Definition at line 58 of file AWShapeOrientNB1.cpp.

References divide(), moab::dot(), and sqr_Frobenius().

{
    const double nsW = sqr_Frobenius( W );
    const double nsA = sqr_Frobenius( A );
    const double nW  = std::sqrt( nsW );
    const double nA  = std::sqrt( nsA );
    const double dot = A % W;
    result           = nA * nW - dot;
    result *= result;

    deriv = nA * W;
    double tmp;
    if( divide( dot, nA, tmp ) ) deriv += tmp * A;
    deriv *= -nW;
    deriv += nsW * A;
    deriv += dot * W;
    deriv *= 2.0;
    return true;
}
bool MBMesquite::h_fcn_2e ( double &  obj,
Vector3D  g_obj[3],
Matrix3D  h_obj[6],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 258 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), isqrt3, MSQ_MIN, MBMesquite::Exponent::raise(), tisqrt3, and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal().

{
    double matr[9], f;
    double adj_m[9], g;  // adj_m[2,5,8] not used
    double dg[9];        // dg[2,5,8] not used
    double loc0, loc1, loc2, loc3, loc4;
    double A[12], J_A[6], J_B[9], J_C[9], cross;  // only 2x2 corners used

    /* Calculate M = [A*inv(W) n] */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - x[1][0] - x[0][0] ) * isqrt3;
    matr[2] = n[0];

    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - x[1][1] - x[0][1] ) * isqrt3;
    matr[5] = n[1];

    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - x[1][2] - x[0][2] ) * isqrt3;
    matr[8] = n[2];

    /* Calculate det([n M]). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[3] = matr[2] * matr[7] - matr[1] * matr[8];
    dg[6] = matr[1] * matr[5] - matr[2] * matr[4];
    g     = matr[0] * dg[0] + matr[3] * dg[3] + matr[6] * dg[6];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[3] * matr[3] + matr[4] * matr[4] + matr[6] * matr[6] +
        matr[7] * matr[7];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[4] = matr[0] * matr[8] - matr[2] * matr[6];
    dg[7] = matr[2] * matr[3] - matr[0] * matr[5];

    adj_m[0] = matr[0] * f + dg[0] * g;
    adj_m[1] = matr[1] * f + dg[1] * g;
    adj_m[3] = matr[3] * f + dg[3] * g;
    adj_m[4] = matr[4] * f + dg[4] * g;
    adj_m[6] = matr[6] * f + dg[6] * g;
    adj_m[7] = matr[7] * f + dg[7] * g;

    loc1        = isqrt3 * adj_m[1];
    g_obj[0][0] = -adj_m[0] - loc1;
    g_obj[1][0] = adj_m[0] - loc1;
    g_obj[2][0] = 2.0 * loc1;

    loc1        = isqrt3 * adj_m[4];
    g_obj[0][1] = -adj_m[3] - loc1;
    g_obj[1][1] = adj_m[3] - loc1;
    g_obj[2][1] = 2.0 * loc1;

    loc1        = isqrt3 * adj_m[7];
    g_obj[0][2] = -adj_m[6] - loc1;
    g_obj[1][2] = adj_m[6] - loc1;
    g_obj[2][2] = 2.0 * loc1;

    /* Calculate the hessian of the objective.                   */
    loc0  = f;                            /* Constant on nabla^2 f       */
    loc1  = g;                            /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[0] * f + dg[0] * cross;
    loc4 = dg[0] * g + matr[0] * cross;

    J_A[0] = loc0 + loc3 * matr[0] + loc4 * dg[0];
    J_A[1] = loc3 * matr[1] + loc4 * dg[1];
    J_B[0] = loc3 * matr[3] + loc4 * dg[3];
    J_B[1] = loc3 * matr[4] + loc4 * dg[4];
    J_C[0] = loc3 * matr[6] + loc4 * dg[6];
    J_C[1] = loc3 * matr[7] + loc4 * dg[7];

    loc3 = matr[1] * f + dg[1] * cross;
    loc4 = dg[1] * g + matr[1] * cross;

    J_A[3] = loc0 + loc3 * matr[1] + loc4 * dg[1];
    J_B[3] = loc3 * matr[3] + loc4 * dg[3];
    J_B[4] = loc3 * matr[4] + loc4 * dg[4];
    J_C[3] = loc3 * matr[6] + loc4 * dg[6];
    J_C[4] = loc3 * matr[7] + loc4 * dg[7];

    /* First diagonal block */
    loc2 = isqrt3 * J_A[1];
    A[0] = -J_A[0] - loc2;
    A[1] = J_A[0] - loc2;

    loc2 = isqrt3 * J_A[3];
    A[4] = -J_A[1] - loc2;
    A[5] = J_A[1] - loc2;
    A[6] = 2.0 * loc2;

    loc2           = isqrt3 * A[4];
    h_obj[0][0][0] = -A[0] - loc2;
    h_obj[1][0][0] = A[0] - loc2;
    h_obj[2][0][0] = 2.0 * loc2;

    loc2           = isqrt3 * A[5];
    h_obj[3][0][0] = A[1] - loc2;
    h_obj[4][0][0] = 2.0 * loc2;

    h_obj[5][0][0] = tisqrt3 * A[6];

    /* First off-diagonal block */
    loc2 = matr[8] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = isqrt3 * J_B[3];
    A[0] = -J_B[0] - loc2;
    A[1] = J_B[0] - loc2;
    A[2] = 2.0 * loc2;

    loc2 = isqrt3 * J_B[4];
    A[4] = -J_B[1] - loc2;
    A[5] = J_B[1] - loc2;
    A[6] = 2.0 * loc2;

    loc2           = isqrt3 * A[4];
    h_obj[0][0][1] = -A[0] - loc2;
    h_obj[1][0][1] = A[0] - loc2;
    h_obj[2][0][1] = 2.0 * loc2;

    loc2           = isqrt3 * A[5];
    h_obj[1][1][0] = -A[1] - loc2;
    h_obj[3][0][1] = A[1] - loc2;
    h_obj[4][0][1] = 2.0 * loc2;

    loc2           = isqrt3 * A[6];
    h_obj[2][1][0] = -A[2] - loc2;
    h_obj[4][1][0] = A[2] - loc2;
    h_obj[5][0][1] = 2.0 * loc2;

    /* Second off-diagonal block */
    loc2 = matr[5] * loc1;
    J_C[1] -= loc2;
    J_C[3] += loc2;

    loc2 = isqrt3 * J_C[3];
    A[0] = -J_C[0] - loc2;
    A[1] = J_C[0] - loc2;
    A[2] = 2.0 * loc2;

    loc2 = isqrt3 * J_C[4];
    A[4] = -J_C[1] - loc2;
    A[5] = J_C[1] - loc2;
    A[6] = 2.0 * loc2;

    loc2           = isqrt3 * A[4];
    h_obj[0][0][2] = -A[0] - loc2;
    h_obj[1][0][2] = A[0] - loc2;
    h_obj[2][0][2] = 2.0 * loc2;

    loc2           = isqrt3 * A[5];
    h_obj[1][2][0] = -A[1] - loc2;
    h_obj[3][0][2] = A[1] - loc2;
    h_obj[4][0][2] = 2.0 * loc2;

    loc2           = isqrt3 * A[6];
    h_obj[2][2][0] = -A[2] - loc2;
    h_obj[4][2][0] = A[2] - loc2;
    h_obj[5][0][2] = 2.0 * loc2;

    /* Second block of rows */
    loc3 = matr[3] * f + dg[3] * cross;
    loc4 = dg[3] * g + matr[3] * cross;

    J_A[0] = loc0 + loc3 * matr[3] + loc4 * dg[3];
    J_A[1] = loc3 * matr[4] + loc4 * dg[4];
    J_B[0] = loc3 * matr[6] + loc4 * dg[6];
    J_B[1] = loc3 * matr[7] + loc4 * dg[7];

    loc3 = matr[4] * f + dg[4] * cross;
    loc4 = dg[4] * g + matr[4] * cross;

    J_A[3] = loc0 + loc3 * matr[4] + loc4 * dg[4];
    J_B[3] = loc3 * matr[6] + loc4 * dg[6];
    J_B[4] = loc3 * matr[7] + loc4 * dg[7];

    /* Second diagonal block */
    loc2 = isqrt3 * J_A[1];
    A[0] = -J_A[0] - loc2;
    A[1] = J_A[0] - loc2;

    loc2 = isqrt3 * J_A[3];
    A[4] = -J_A[1] - loc2;
    A[5] = J_A[1] - loc2;
    A[6] = 2.0 * loc2;

    loc2           = isqrt3 * A[4];
    h_obj[0][1][1] = -A[0] - loc2;
    h_obj[1][1][1] = A[0] - loc2;
    h_obj[2][1][1] = 2.0 * loc2;

    loc2           = isqrt3 * A[5];
    h_obj[3][1][1] = A[1] - loc2;
    h_obj[4][1][1] = 2.0 * loc2;

    h_obj[5][1][1] = tisqrt3 * A[6];

    /* Third off-diagonal block */
    loc2 = matr[2] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = isqrt3 * J_B[3];
    A[0] = -J_B[0] - loc2;
    A[1] = J_B[0] - loc2;
    A[2] = 2.0 * loc2;

    loc2 = isqrt3 * J_B[4];
    A[4] = -J_B[1] - loc2;
    A[5] = J_B[1] - loc2;
    A[6] = 2.0 * loc2;

    loc2           = isqrt3 * A[4];
    h_obj[0][1][2] = -A[0] - loc2;
    h_obj[1][1][2] = A[0] - loc2;
    h_obj[2][1][2] = 2.0 * loc2;

    loc2           = isqrt3 * A[5];
    h_obj[1][2][1] = -A[1] - loc2;
    h_obj[3][1][2] = A[1] - loc2;
    h_obj[4][1][2] = 2.0 * loc2;

    loc2           = isqrt3 * A[6];
    h_obj[2][2][1] = -A[2] - loc2;
    h_obj[4][2][1] = A[2] - loc2;
    h_obj[5][1][2] = 2.0 * loc2;

    /* Third block of rows */
    loc3 = matr[6] * f + dg[6] * cross;
    loc4 = dg[6] * g + matr[6] * cross;

    J_A[0] = loc0 + loc3 * matr[6] + loc4 * dg[6];
    J_A[1] = loc3 * matr[7] + loc4 * dg[7];

    loc3 = matr[7] * f + dg[7] * cross;
    loc4 = dg[7] * g + matr[7] * cross;

    J_A[3] = loc0 + loc3 * matr[7] + loc4 * dg[7];

    /* Third diagonal block */
    loc2 = isqrt3 * J_A[1];
    A[0] = -J_A[0] - loc2;
    A[1] = J_A[0] - loc2;

    loc2 = isqrt3 * J_A[3];
    A[4] = -J_A[1] - loc2;
    A[5] = J_A[1] - loc2;
    A[6] = 2.0 * loc2;

    loc2           = isqrt3 * A[4];
    h_obj[0][2][2] = -A[0] - loc2;
    h_obj[1][2][2] = A[0] - loc2;
    h_obj[2][2][2] = 2.0 * loc2;

    loc2           = isqrt3 * A[5];
    h_obj[3][2][2] = A[1] - loc2;
    h_obj[4][2][2] = 2.0 * loc2;

    h_obj[5][2][2] = tisqrt3 * A[6];

    // completes diagonal blocks.
    h_obj[0].fill_lower_triangle();
    h_obj[3].fill_lower_triangle();
    h_obj[5].fill_lower_triangle();
    return true;
}
bool MBMesquite::h_fcn_2i ( double &  obj,
Vector3D  g_obj[3],
Matrix3D  h_obj[6],
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
) [inline]

Definition at line 691 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), MSQ_MIN, MBMesquite::Exponent::raise(), scale(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal().

{
    double matr[9], f;
    double adj_m[9], g;  // adj_m[2,5,8] not used
    double dg[9];        // dg[2,5,8] not used
    double loc0, loc1, loc2, loc3, loc4;
    double A[12], J_A[6], J_B[9], J_C[9], cross;  // only 2x2 corners used

    const double scale[3] = { d[0] * d[0], d[0] * d[1], d[1] * d[1] };

    /* Calculate M = [A*inv(W) n] */
    matr[0] = d[0] * ( x[1][0] - x[0][0] );
    matr[1] = d[1] * ( x[2][0] - x[0][0] );
    matr[2] = n[0];

    matr[3] = d[0] * ( x[1][1] - x[0][1] );
    matr[4] = d[1] * ( x[2][1] - x[0][1] );
    matr[5] = n[1];

    matr[6] = d[0] * ( x[1][2] - x[0][2] );
    matr[7] = d[1] * ( x[2][2] - x[0][2] );
    matr[8] = n[2];

    /* Calculate det([n M]). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[3] = matr[2] * matr[7] - matr[1] * matr[8];
    dg[6] = matr[1] * matr[5] - matr[2] * matr[4];
    g     = matr[0] * dg[0] + matr[3] * dg[3] + matr[6] * dg[6];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[3] * matr[3] + matr[4] * matr[4] + matr[6] * matr[6] +
        matr[7] * matr[7];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[4] = matr[0] * matr[8] - matr[2] * matr[6];
    dg[7] = matr[2] * matr[3] - matr[0] * matr[5];

    adj_m[0] = d[0] * ( matr[0] * f + dg[0] * g );
    adj_m[1] = d[1] * ( matr[1] * f + dg[1] * g );
    adj_m[3] = d[0] * ( matr[3] * f + dg[3] * g );
    adj_m[4] = d[1] * ( matr[4] * f + dg[4] * g );
    adj_m[6] = d[0] * ( matr[6] * f + dg[6] * g );
    adj_m[7] = d[1] * ( matr[7] * f + dg[7] * g );

    g_obj[0][0] = -adj_m[0] - adj_m[1];
    g_obj[1][0] = adj_m[0];
    g_obj[2][0] = adj_m[1];

    g_obj[0][1] = -adj_m[3] - adj_m[4];
    g_obj[1][1] = adj_m[3];
    g_obj[2][1] = adj_m[4];

    g_obj[0][2] = -adj_m[6] - adj_m[7];
    g_obj[1][2] = adj_m[6];
    g_obj[2][2] = adj_m[7];

    /* Calculate the hessian of the objective.                   */
    loc0  = f;                            /* Constant on nabla^2 f       */
    loc1  = g;                            /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[0] * f + dg[0] * cross;
    loc4 = dg[0] * g + matr[0] * cross;

    J_A[0] = loc0 + loc3 * matr[0] + loc4 * dg[0];
    J_A[1] = loc3 * matr[1] + loc4 * dg[1];
    J_B[0] = loc3 * matr[3] + loc4 * dg[3];
    J_B[1] = loc3 * matr[4] + loc4 * dg[4];
    J_C[0] = loc3 * matr[6] + loc4 * dg[6];
    J_C[1] = loc3 * matr[7] + loc4 * dg[7];

    loc3 = matr[1] * f + dg[1] * cross;
    loc4 = dg[1] * g + matr[1] * cross;

    J_A[3] = loc0 + loc3 * matr[1] + loc4 * dg[1];
    J_B[3] = loc3 * matr[3] + loc4 * dg[3];
    J_B[4] = loc3 * matr[4] + loc4 * dg[4];
    J_C[3] = loc3 * matr[6] + loc4 * dg[6];
    J_C[4] = loc3 * matr[7] + loc4 * dg[7];

    /* First diagonal block */
    J_A[0] *= scale[0];
    J_A[1] *= scale[1];
    J_A[3] *= scale[2];

    A[0] = -J_A[0] - J_A[1];
    A[4] = -J_A[1] - J_A[3];

    h_obj[0][0][0] = -A[0] - A[4];
    h_obj[1][0][0] = A[0];
    h_obj[2][0][0] = A[4];

    h_obj[3][0][0] = J_A[0];
    h_obj[4][0][0] = J_A[1];

    h_obj[5][0][0] = J_A[3];

    /* First off-diagonal block */
    loc2 = matr[8] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    J_B[0] *= scale[0];
    J_B[1] *= scale[1];
    J_B[3] *= scale[1];
    J_B[4] *= scale[2];

    A[0] = -J_B[0] - J_B[3];
    A[4] = -J_B[1] - J_B[4];

    h_obj[0][0][1] = -A[0] - A[4];
    h_obj[1][0][1] = A[0];
    h_obj[2][0][1] = A[4];

    h_obj[1][1][0] = -J_B[0] - J_B[1];
    h_obj[3][0][1] = J_B[0];
    h_obj[4][0][1] = J_B[1];

    h_obj[2][1][0] = -J_B[3] - J_B[4];
    h_obj[4][1][0] = J_B[3];
    h_obj[5][0][1] = J_B[4];

    /* Second off-diagonal block */
    loc2 = matr[5] * loc1;
    J_C[1] -= loc2;
    J_C[3] += loc2;

    J_C[0] *= scale[0];
    J_C[1] *= scale[1];
    J_C[3] *= scale[1];
    J_C[4] *= scale[2];

    A[0] = -J_C[0] - J_C[3];
    A[4] = -J_C[1] - J_C[4];

    h_obj[0][0][2] = -A[0] - A[4];
    h_obj[1][0][2] = A[0];
    h_obj[2][0][2] = A[4];

    h_obj[1][2][0] = -J_C[0] - J_C[1];
    h_obj[3][0][2] = J_C[0];
    h_obj[4][0][2] = J_C[1];

    h_obj[2][2][0] = -J_C[3] - J_C[4];
    h_obj[4][2][0] = J_C[3];
    h_obj[5][0][2] = J_C[4];

    /* Second block of rows */
    loc3 = matr[3] * f + dg[3] * cross;
    loc4 = dg[3] * g + matr[3] * cross;

    J_A[0] = loc0 + loc3 * matr[3] + loc4 * dg[3];
    J_A[1] = loc3 * matr[4] + loc4 * dg[4];
    J_B[0] = loc3 * matr[6] + loc4 * dg[6];
    J_B[1] = loc3 * matr[7] + loc4 * dg[7];

    loc3 = matr[4] * f + dg[4] * cross;
    loc4 = dg[4] * g + matr[4] * cross;

    J_A[3] = loc0 + loc3 * matr[4] + loc4 * dg[4];
    J_B[3] = loc3 * matr[6] + loc4 * dg[6];
    J_B[4] = loc3 * matr[7] + loc4 * dg[7];

    /* Second diagonal block */
    J_A[0] *= scale[0];
    J_A[1] *= scale[1];
    J_A[3] *= scale[2];

    A[0] = -J_A[0] - J_A[1];
    A[4] = -J_A[1] - J_A[3];

    h_obj[0][1][1] = -A[0] - A[4];
    h_obj[1][1][1] = A[0];
    h_obj[2][1][1] = A[4];

    h_obj[3][1][1] = J_A[0];
    h_obj[4][1][1] = J_A[1];

    h_obj[5][1][1] = J_A[3];

    /* Third off-diagonal block */
    loc2 = matr[2] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    J_B[0] *= scale[0];
    J_B[1] *= scale[1];
    J_B[3] *= scale[1];
    J_B[4] *= scale[2];

    A[0] = -J_B[0] - J_B[3];
    A[4] = -J_B[1] - J_B[4];

    h_obj[0][1][2] = -A[0] - A[4];
    h_obj[1][1][2] = A[0];
    h_obj[2][1][2] = A[4];

    h_obj[1][2][1] = -J_B[0] - J_B[1];
    h_obj[3][1][2] = J_B[0];
    h_obj[4][1][2] = J_B[1];

    h_obj[2][2][1] = -J_B[3] - J_B[4];
    h_obj[4][2][1] = J_B[3];
    h_obj[5][1][2] = J_B[4];

    /* Third block of rows */
    loc3 = matr[6] * f + dg[6] * cross;
    loc4 = dg[6] * g + matr[6] * cross;

    J_A[0] = loc0 + loc3 * matr[6] + loc4 * dg[6];
    J_A[1] = loc3 * matr[7] + loc4 * dg[7];

    loc3 = matr[7] * f + dg[7] * cross;
    loc4 = dg[7] * g + matr[7] * cross;

    J_A[3] = loc0 + loc3 * matr[7] + loc4 * dg[7];

    /* Third diagonal block */
    J_A[0] *= scale[0];
    J_A[1] *= scale[1];
    J_A[3] *= scale[2];

    A[0] = -J_A[0] - J_A[1];
    A[4] = -J_A[1] - J_A[3];

    h_obj[0][2][2] = -A[0] - A[4];
    h_obj[1][2][2] = A[0];
    h_obj[2][2][2] = A[4];

    h_obj[3][2][2] = J_A[0];
    h_obj[4][2][2] = J_A[1];

    h_obj[5][2][2] = J_A[3];

    // completes diagonal blocks.
    h_obj[0].fill_lower_triangle();
    h_obj[3].fill_lower_triangle();
    h_obj[5].fill_lower_triangle();
    return true;
}
bool MBMesquite::h_fcn_3e ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1110 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), isqrt3, isqrt6, MSQ_MIN, MBMesquite::Exponent::raise(), tisqrt3, tisqrt6, and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal().

{
    double matr[9], f;
    double adj_m[9], g;
    double dg[9], loc0, loc1, loc2, loc3, loc4;
    double A[12], J_A[6], J_B[9], J_C[9], cross;

    /* Calculate M = A*inv(W). */
    f       = x[1][0] + x[0][0];
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - f ) * isqrt3;
    matr[2] = ( 3.0 * x[3][0] - x[2][0] - f ) * isqrt6;

    f       = x[1][1] + x[0][1];
    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - f ) * isqrt3;
    matr[5] = ( 3.0 * x[3][1] - x[2][1] - f ) * isqrt6;

    f       = x[1][2] + x[0][2];
    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - f ) * isqrt3;
    matr[8] = ( 3.0 * x[3][2] - x[2][2] - f ) * isqrt6;

    /* Calculate det(M). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[2] = matr[3] * matr[7] - matr[4] * matr[6];
    g     = matr[0] * dg[0] + matr[1] * dg[1] + matr[2] * dg[2];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    dg[3] = matr[2] * matr[7] - matr[1] * matr[8];
    dg[4] = matr[0] * matr[8] - matr[2] * matr[6];
    dg[5] = matr[1] * matr[6] - matr[0] * matr[7];
    dg[6] = matr[1] * matr[5] - matr[2] * matr[4];
    dg[7] = matr[2] * matr[3] - matr[0] * matr[5];
    dg[8] = matr[0] * matr[4] - matr[1] * matr[3];

    adj_m[0] = matr[0] * f + dg[0] * g;
    adj_m[1] = matr[1] * f + dg[1] * g;
    adj_m[2] = matr[2] * f + dg[2] * g;
    adj_m[3] = matr[3] * f + dg[3] * g;
    adj_m[4] = matr[4] * f + dg[4] * g;
    adj_m[5] = matr[5] * f + dg[5] * g;
    adj_m[6] = matr[6] * f + dg[6] * g;
    adj_m[7] = matr[7] * f + dg[7] * g;
    adj_m[8] = matr[8] * f + dg[8] * g;

    loc0        = isqrt3 * adj_m[1];
    loc1        = isqrt6 * adj_m[2];
    loc2        = loc0 + loc1;
    g_obj[0][0] = -adj_m[0] - loc2;
    g_obj[1][0] = adj_m[0] - loc2;
    g_obj[2][0] = 2.0 * loc0 - loc1;
    g_obj[3][0] = 3.0 * loc1;

    loc0        = isqrt3 * adj_m[4];
    loc1        = isqrt6 * adj_m[5];
    loc2        = loc0 + loc1;
    g_obj[0][1] = -adj_m[3] - loc2;
    g_obj[1][1] = adj_m[3] - loc2;
    g_obj[2][1] = 2.0 * loc0 - loc1;
    g_obj[3][1] = 3.0 * loc1;

    loc0        = isqrt3 * adj_m[7];
    loc1        = isqrt6 * adj_m[8];
    loc2        = loc0 + loc1;
    g_obj[0][2] = -adj_m[6] - loc2;
    g_obj[1][2] = adj_m[6] - loc2;
    g_obj[2][2] = 2.0 * loc0 - loc1;
    g_obj[3][2] = 3.0 * loc1;

    /* Calculate the hessian of the objective.                   */
    loc0  = f;                            /* Constant on nabla^2 f       */
    loc1  = g;                            /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[0] * f + dg[0] * cross;
    loc4 = dg[0] * g + matr[0] * cross;

    J_A[0] = loc0 + loc3 * matr[0] + loc4 * dg[0];
    J_A[1] = loc3 * matr[1] + loc4 * dg[1];
    J_A[2] = loc3 * matr[2] + loc4 * dg[2];
    J_B[0] = loc3 * matr[3] + loc4 * dg[3];
    J_B[1] = loc3 * matr[4] + loc4 * dg[4];
    J_B[2] = loc3 * matr[5] + loc4 * dg[5];
    J_C[0] = loc3 * matr[6] + loc4 * dg[6];
    J_C[1] = loc3 * matr[7] + loc4 * dg[7];
    J_C[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[1] * f + dg[1] * cross;
    loc4 = dg[1] * g + matr[1] * cross;

    J_A[3] = loc0 + loc3 * matr[1] + loc4 * dg[1];
    J_A[4] = loc3 * matr[2] + loc4 * dg[2];
    J_B[3] = loc3 * matr[3] + loc4 * dg[3];
    J_B[4] = loc3 * matr[4] + loc4 * dg[4];
    J_B[5] = loc3 * matr[5] + loc4 * dg[5];
    J_C[3] = loc3 * matr[6] + loc4 * dg[6];
    J_C[4] = loc3 * matr[7] + loc4 * dg[7];
    J_C[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[2] * f + dg[2] * cross;
    loc4 = dg[2] * g + matr[2] * cross;

    J_A[5] = loc0 + loc3 * matr[2] + loc4 * dg[2];
    J_B[6] = loc3 * matr[3] + loc4 * dg[3];
    J_B[7] = loc3 * matr[4] + loc4 * dg[4];
    J_B[8] = loc3 * matr[5] + loc4 * dg[5];
    J_C[6] = loc3 * matr[6] + loc4 * dg[6];
    J_C[7] = loc3 * matr[7] + loc4 * dg[7];
    J_C[8] = loc3 * matr[8] + loc4 * dg[8];

    /* First diagonal block */
    loc2 = isqrt3 * J_A[1];
    loc3 = isqrt6 * J_A[2];
    loc4 = loc2 + loc3;

    A[0] = -J_A[0] - loc4;
    A[1] = J_A[0] - loc4;

    loc2 = isqrt3 * J_A[3];
    loc3 = isqrt6 * J_A[4];
    loc4 = loc2 + loc3;

    A[4] = -J_A[1] - loc4;
    A[5] = J_A[1] - loc4;
    A[6] = 2.0 * loc2 - loc3;

    loc2 = isqrt3 * J_A[4];
    loc3 = isqrt6 * J_A[5];
    loc4 = loc2 + loc3;

    A[8]  = -J_A[2] - loc4;
    A[9]  = J_A[2] - loc4;
    A[10] = 2.0 * loc2 - loc3;
    A[11] = 3.0 * loc3;

    loc2 = isqrt3 * A[4];
    loc3 = isqrt6 * A[8];
    loc4 = loc2 + loc3;

    h_obj[0][0][0] = -A[0] - loc4;
    h_obj[1][0][0] = A[0] - loc4;
    h_obj[2][0][0] = 2.0 * loc2 - loc3;
    h_obj[3][0][0] = 3.0 * loc3;

    loc2 = isqrt3 * A[5];
    loc3 = isqrt6 * A[9];

    h_obj[4][0][0] = A[1] - loc2 - loc3;
    h_obj[5][0][0] = 2.0 * loc2 - loc3;
    h_obj[6][0][0] = 3.0 * loc3;

    loc3           = isqrt6 * A[10];
    h_obj[7][0][0] = tisqrt3 * A[6] - loc3;
    h_obj[8][0][0] = 3.0 * loc3;

    h_obj[9][0][0] = tisqrt6 * A[11];

    /* First off-diagonal block */
    loc2 = matr[8] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[7] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[6] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    loc2 = isqrt3 * J_B[3];
    loc3 = isqrt6 * J_B[6];
    loc4 = loc2 + loc3;

    A[0] = -J_B[0] - loc4;
    A[1] = J_B[0] - loc4;
    A[2] = 2.0 * loc2 - loc3;
    A[3] = 3.0 * loc3;

    loc2 = isqrt3 * J_B[4];
    loc3 = isqrt6 * J_B[7];
    loc4 = loc2 + loc3;

    A[4] = -J_B[1] - loc4;
    A[5] = J_B[1] - loc4;
    A[6] = 2.0 * loc2 - loc3;
    A[7] = 3.0 * loc3;

    loc2 = isqrt3 * J_B[5];
    loc3 = isqrt6 * J_B[8];
    loc4 = loc2 + loc3;

    A[8]  = -J_B[2] - loc4;
    A[9]  = J_B[2] - loc4;
    A[10] = 2.0 * loc2 - loc3;
    A[11] = 3.0 * loc3;

    loc2 = isqrt3 * A[4];
    loc3 = isqrt6 * A[8];
    loc4 = loc2 + loc3;

    h_obj[0][0][1] = -A[0] - loc4;
    h_obj[1][0][1] = A[0] - loc4;
    h_obj[2][0][1] = 2.0 * loc2 - loc3;
    h_obj[3][0][1] = 3.0 * loc3;

    loc2 = isqrt3 * A[5];
    loc3 = isqrt6 * A[9];
    loc4 = loc2 + loc3;

    h_obj[1][1][0] = -A[1] - loc4;
    h_obj[4][0][1] = A[1] - loc4;
    h_obj[5][0][1] = 2.0 * loc2 - loc3;
    h_obj[6][0][1] = 3.0 * loc3;

    loc2 = isqrt3 * A[6];
    loc3 = isqrt6 * A[10];
    loc4 = loc2 + loc3;

    h_obj[2][1][0] = -A[2] - loc4;
    h_obj[5][1][0] = A[2] - loc4;
    h_obj[7][0][1] = 2.0 * loc2 - loc3;
    h_obj[8][0][1] = 3.0 * loc3;

    loc2 = isqrt3 * A[7];
    loc3 = isqrt6 * A[11];
    loc4 = loc2 + loc3;

    h_obj[3][1][0] = -A[3] - loc4;
    h_obj[6][1][0] = A[3] - loc4;
    h_obj[8][1][0] = 2.0 * loc2 - loc3;
    h_obj[9][0][1] = 3.0 * loc3;

    /* Second off-diagonal block */
    loc2 = matr[5] * loc1;
    J_C[1] -= loc2;
    J_C[3] += loc2;

    loc2 = matr[4] * loc1;
    J_C[2] += loc2;
    J_C[6] -= loc2;

    loc2 = matr[3] * loc1;
    J_C[5] -= loc2;
    J_C[7] += loc2;

    loc2 = isqrt3 * J_C[3];
    loc3 = isqrt6 * J_C[6];
    loc4 = loc2 + loc3;

    A[0] = -J_C[0] - loc4;
    A[1] = J_C[0] - loc4;
    A[2] = 2.0 * loc2 - loc3;
    A[3] = 3.0 * loc3;

    loc2 = isqrt3 * J_C[4];
    loc3 = isqrt6 * J_C[7];
    loc4 = loc2 + loc3;

    A[4] = -J_C[1] - loc4;
    A[5] = J_C[1] - loc4;
    A[6] = 2.0 * loc2 - loc3;
    A[7] = 3.0 * loc3;

    loc2 = isqrt3 * J_C[5];
    loc3 = isqrt6 * J_C[8];
    loc4 = loc2 + loc3;

    A[8]  = -J_C[2] - loc4;
    A[9]  = J_C[2] - loc4;
    A[10] = 2.0 * loc2 - loc3;
    A[11] = 3.0 * loc3;

    loc2 = isqrt3 * A[4];
    loc3 = isqrt6 * A[8];
    loc4 = loc2 + loc3;

    h_obj[0][0][2] = -A[0] - loc4;
    h_obj[1][0][2] = A[0] - loc4;
    h_obj[2][0][2] = 2.0 * loc2 - loc3;
    h_obj[3][0][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[5];
    loc3 = isqrt6 * A[9];
    loc4 = loc2 + loc3;

    h_obj[1][2][0] = -A[1] - loc4;
    h_obj[4][0][2] = A[1] - loc4;
    h_obj[5][0][2] = 2.0 * loc2 - loc3;
    h_obj[6][0][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[6];
    loc3 = isqrt6 * A[10];
    loc4 = loc2 + loc3;

    h_obj[2][2][0] = -A[2] - loc4;
    h_obj[5][2][0] = A[2] - loc4;
    h_obj[7][0][2] = 2.0 * loc2 - loc3;
    h_obj[8][0][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[7];
    loc3 = isqrt6 * A[11];
    loc4 = loc2 + loc3;

    h_obj[3][2][0] = -A[3] - loc4;
    h_obj[6][2][0] = A[3] - loc4;
    h_obj[8][2][0] = 2.0 * loc2 - loc3;
    h_obj[9][0][2] = 3.0 * loc3;

    /* Second block of rows */
    loc3 = matr[3] * f + dg[3] * cross;
    loc4 = dg[3] * g + matr[3] * cross;

    J_A[0] = loc0 + loc3 * matr[3] + loc4 * dg[3];
    J_A[1] = loc3 * matr[4] + loc4 * dg[4];
    J_A[2] = loc3 * matr[5] + loc4 * dg[5];
    J_B[0] = loc3 * matr[6] + loc4 * dg[6];
    J_B[1] = loc3 * matr[7] + loc4 * dg[7];
    J_B[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[4] * f + dg[4] * cross;
    loc4 = dg[4] * g + matr[4] * cross;

    J_A[3] = loc0 + loc3 * matr[4] + loc4 * dg[4];
    J_A[4] = loc3 * matr[5] + loc4 * dg[5];
    J_B[3] = loc3 * matr[6] + loc4 * dg[6];
    J_B[4] = loc3 * matr[7] + loc4 * dg[7];
    J_B[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[5] * f + dg[5] * cross;
    loc4 = dg[5] * g + matr[5] * cross;

    J_A[5] = loc0 + loc3 * matr[5] + loc4 * dg[5];
    J_B[6] = loc3 * matr[6] + loc4 * dg[6];
    J_B[7] = loc3 * matr[7] + loc4 * dg[7];
    J_B[8] = loc3 * matr[8] + loc4 * dg[8];

    /* Second diagonal block */
    loc2 = isqrt3 * J_A[1];
    loc3 = isqrt6 * J_A[2];
    loc4 = loc2 + loc3;

    A[0] = -J_A[0] - loc4;
    A[1] = J_A[0] - loc4;

    loc2 = isqrt3 * J_A[3];
    loc3 = isqrt6 * J_A[4];
    loc4 = loc2 + loc3;

    A[4] = -J_A[1] - loc4;
    A[5] = J_A[1] - loc4;
    A[6] = 2.0 * loc2 - loc3;

    loc2 = isqrt3 * J_A[4];
    loc3 = isqrt6 * J_A[5];
    loc4 = loc2 + loc3;

    A[8]  = -J_A[2] - loc4;
    A[9]  = J_A[2] - loc4;
    A[10] = 2.0 * loc2 - loc3;
    A[11] = 3.0 * loc3;

    loc2 = isqrt3 * A[4];
    loc3 = isqrt6 * A[8];
    loc4 = loc2 + loc3;

    h_obj[0][1][1] = -A[0] - loc4;
    h_obj[1][1][1] = A[0] - loc4;
    h_obj[2][1][1] = 2.0 * loc2 - loc3;
    h_obj[3][1][1] = 3.0 * loc3;

    loc2 = isqrt3 * A[5];
    loc3 = isqrt6 * A[9];

    h_obj[4][1][1] = A[1] - loc2 - loc3;
    h_obj[5][1][1] = 2.0 * loc2 - loc3;
    h_obj[6][1][1] = 3.0 * loc3;

    loc3           = isqrt6 * A[10];
    h_obj[7][1][1] = tisqrt3 * A[6] - loc3;
    h_obj[8][1][1] = 3.0 * loc3;

    h_obj[9][1][1] = tisqrt6 * A[11];

    /* Third off-diagonal block */
    loc2 = matr[2] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[1] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[0] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    loc2 = isqrt3 * J_B[3];
    loc3 = isqrt6 * J_B[6];
    loc4 = loc2 + loc3;

    A[0] = -J_B[0] - loc4;
    A[1] = J_B[0] - loc4;
    A[2] = 2.0 * loc2 - loc3;
    A[3] = 3.0 * loc3;

    loc2 = isqrt3 * J_B[4];
    loc3 = isqrt6 * J_B[7];
    loc4 = loc2 + loc3;

    A[4] = -J_B[1] - loc4;
    A[5] = J_B[1] - loc4;
    A[6] = 2.0 * loc2 - loc3;
    A[7] = 3.0 * loc3;

    loc2 = isqrt3 * J_B[5];
    loc3 = isqrt6 * J_B[8];
    loc4 = loc2 + loc3;

    A[8]  = -J_B[2] - loc4;
    A[9]  = J_B[2] - loc4;
    A[10] = 2.0 * loc2 - loc3;
    A[11] = 3.0 * loc3;

    loc2 = isqrt3 * A[4];
    loc3 = isqrt6 * A[8];
    loc4 = loc2 + loc3;

    h_obj[0][1][2] = -A[0] - loc4;
    h_obj[1][1][2] = A[0] - loc4;
    h_obj[2][1][2] = 2.0 * loc2 - loc3;
    h_obj[3][1][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[5];
    loc3 = isqrt6 * A[9];
    loc4 = loc2 + loc3;

    h_obj[1][2][1] = -A[1] - loc4;
    h_obj[4][1][2] = A[1] - loc4;
    h_obj[5][1][2] = 2.0 * loc2 - loc3;
    h_obj[6][1][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[6];
    loc3 = isqrt6 * A[10];
    loc4 = loc2 + loc3;

    h_obj[2][2][1] = -A[2] - loc4;
    h_obj[5][2][1] = A[2] - loc4;
    h_obj[7][1][2] = 2.0 * loc2 - loc3;
    h_obj[8][1][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[7];
    loc3 = isqrt6 * A[11];
    loc4 = loc2 + loc3;

    h_obj[3][2][1] = -A[3] - loc4;
    h_obj[6][2][1] = A[3] - loc4;
    h_obj[8][2][1] = 2.0 * loc2 - loc3;
    h_obj[9][1][2] = 3.0 * loc3;

    /* Third block of rows */
    loc3 = matr[6] * f + dg[6] * cross;
    loc4 = dg[6] * g + matr[6] * cross;

    J_A[0] = loc0 + loc3 * matr[6] + loc4 * dg[6];
    J_A[1] = loc3 * matr[7] + loc4 * dg[7];
    J_A[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[7] * f + dg[7] * cross;
    loc4 = dg[7] * g + matr[7] * cross;

    J_A[3] = loc0 + loc3 * matr[7] + loc4 * dg[7];
    J_A[4] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[8] * f + dg[8] * cross;
    loc4 = dg[8] * g + matr[8] * cross;

    J_A[5] = loc0 + loc3 * matr[8] + loc4 * dg[8];

    /* Third diagonal block */
    loc2 = isqrt3 * J_A[1];
    loc3 = isqrt6 * J_A[2];
    loc4 = loc2 + loc3;

    A[0] = -J_A[0] - loc4;
    A[1] = J_A[0] - loc4;

    loc2 = isqrt3 * J_A[3];
    loc3 = isqrt6 * J_A[4];
    loc4 = loc2 + loc3;

    A[4] = -J_A[1] - loc4;
    A[5] = J_A[1] - loc4;
    A[6] = 2.0 * loc2 - loc3;

    loc2 = isqrt3 * J_A[4];
    loc3 = isqrt6 * J_A[5];
    loc4 = loc2 + loc3;

    A[8]  = -J_A[2] - loc4;
    A[9]  = J_A[2] - loc4;
    A[10] = 2.0 * loc2 - loc3;
    A[11] = 3.0 * loc3;

    loc2 = isqrt3 * A[4];
    loc3 = isqrt6 * A[8];
    loc4 = loc2 + loc3;

    h_obj[0][2][2] = -A[0] - loc4;
    h_obj[1][2][2] = A[0] - loc4;
    h_obj[2][2][2] = 2.0 * loc2 - loc3;
    h_obj[3][2][2] = 3.0 * loc3;

    loc2 = isqrt3 * A[5];
    loc3 = isqrt6 * A[9];

    h_obj[4][2][2] = A[1] - loc2 - loc3;
    h_obj[5][2][2] = 2.0 * loc2 - loc3;
    h_obj[6][2][2] = 3.0 * loc3;

    loc3           = isqrt6 * A[10];
    h_obj[7][2][2] = tisqrt3 * A[6] - loc3;
    h_obj[8][2][2] = 3.0 * loc3;

    h_obj[9][2][2] = tisqrt6 * A[11];

    // completes diagonal blocks.
    h_obj[0].fill_lower_triangle();
    h_obj[4].fill_lower_triangle();
    h_obj[7].fill_lower_triangle();
    h_obj[9].fill_lower_triangle();
    return true;
}
bool MBMesquite::h_fcn_3e_v0 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1883 of file MeanRatioFunctions.hpp.

References h_fcn_3e_v3().

{
    static Vector3D my_x[4];

    my_x[0] = x[1];
    my_x[1] = x[3];
    my_x[2] = x[2];
    my_x[3] = x[0];
    return h_fcn_3e_v3( obj, g_obj, h_obj, my_x, a, b, c );
}
bool MBMesquite::h_fcn_3e_v1 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1900 of file MeanRatioFunctions.hpp.

References h_fcn_3e_v3().

{
    static Vector3D my_x[4];

    my_x[0] = x[0];
    my_x[1] = x[2];
    my_x[2] = x[3];
    my_x[3] = x[1];
    return h_fcn_3e_v3( obj, g_obj, h_obj, my_x, a, b, c );
}
bool MBMesquite::h_fcn_3e_v2 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1917 of file MeanRatioFunctions.hpp.

References h_fcn_3e_v3().

{
    static Vector3D my_x[4];

    my_x[0] = x[1];
    my_x[1] = x[0];
    my_x[2] = x[3];
    my_x[3] = x[2];
    return h_fcn_3e_v3( obj, g_obj, h_obj, my_x, a, b, c );
}
bool MBMesquite::h_fcn_3e_v3 ( double &  obj,
Vector3D &  g_obj,
Matrix3D &  h_obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 1788 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), isqrt3, isqrt6, MSQ_MIN, MBMesquite::Exponent::raise(), tisqrt6, and MBMesquite::Exponent::value().

Referenced by h_fcn_3e_v0(), h_fcn_3e_v1(), and h_fcn_3e_v2().

{
    double matr[9], f, g;
    double dg[9], loc0, /*loc1,*/ loc3, loc4;
    double cross;

    /* Calculate M = A*inv(W). */
    f       = x[1][0] + x[0][0];
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - f ) * isqrt3;
    matr[2] = ( 3.0 * x[3][0] - x[2][0] - f ) * isqrt6;

    f       = x[1][1] + x[0][1];
    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - f ) * isqrt3;
    matr[5] = ( 3.0 * x[3][1] - x[2][1] - f ) * isqrt6;

    f       = x[1][2] + x[0][2];
    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - f ) * isqrt3;
    matr[8] = ( 3.0 * x[3][2] - x[2][2] - f ) * isqrt6;

    /* Calculate det(M). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[2] = matr[3] * matr[7] - matr[4] * matr[6];
    g     = matr[0] * dg[0] + matr[1] * dg[1] + matr[2] * dg[2];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    dg[5] = matr[1] * matr[6] - matr[0] * matr[7];
    dg[8] = matr[0] * matr[4] - matr[1] * matr[3];

    g_obj[0] = tisqrt6 * ( matr[2] * f + dg[2] * g );
    g_obj[1] = tisqrt6 * ( matr[5] * f + dg[5] * g );
    g_obj[2] = tisqrt6 * ( matr[8] * f + dg[8] * g );

    /* Calculate the hessian of the objective.                   */
    loc0 = f; /* Constant on nabla^2 f       */
    //  loc1 = g;           /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[2] * f + dg[2] * cross;
    loc4 = dg[2] * g + matr[2] * cross;

    h_obj[0][0] = 1.5 * ( loc0 + loc3 * matr[2] + loc4 * dg[2] );
    h_obj[0][1] = 1.5 * ( loc3 * matr[5] + loc4 * dg[5] );
    h_obj[0][2] = 1.5 * ( loc3 * matr[8] + loc4 * dg[8] );

    /* Second block of rows */
    loc3 = matr[5] * f + dg[5] * cross;
    loc4 = dg[5] * g + matr[5] * cross;

    h_obj[1][1] = 1.5 * ( loc0 + loc3 * matr[5] + loc4 * dg[5] );
    h_obj[1][2] = 1.5 * ( loc3 * matr[8] + loc4 * dg[8] );

    /* Third block of rows */
    loc3 = matr[8] * f + dg[8] * cross;
    loc4 = dg[8] * g + matr[8] * cross;

    h_obj[2][2] = 1.5 * ( loc0 + loc3 * matr[8] + loc4 * dg[8] );

    // completes diagonal block.
    h_obj.fill_lower_triangle();
    return true;
}
int MBMesquite::h_fcn_3i ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
) [inline]

Definition at line 2075 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), MSQ_MIN, MBMesquite::Exponent::raise(), scale(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal().

{
    double matr[9], f;
    double adj_m[9], g;
    double dg[9], loc0, loc1, loc2, loc3, loc4;
    double A[3], J_A[6], J_B[9], J_C[9], cross;

    const double scale[6] = { d[0] * d[0], d[0] * d[1], d[0] * d[2], d[1] * d[1], d[1] * d[2], d[2] * d[2] };

    /* Calculate M = A*inv(W). */
    matr[0] = d[0] * ( x[1][0] - x[0][0] );
    matr[1] = d[1] * ( x[2][0] - x[0][0] );
    matr[2] = d[2] * ( x[3][0] - x[0][0] );

    matr[3] = d[0] * ( x[1][1] - x[0][1] );
    matr[4] = d[1] * ( x[2][1] - x[0][1] );
    matr[5] = d[2] * ( x[3][1] - x[0][1] );

    matr[6] = d[0] * ( x[1][2] - x[0][2] );
    matr[7] = d[1] * ( x[2][2] - x[0][2] );
    matr[8] = d[2] * ( x[3][2] - x[0][2] );

    /* Calculate det(M). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[2] = matr[3] * matr[7] - matr[4] * matr[6];
    g     = matr[0] * dg[0] + matr[1] * dg[1] + matr[2] * dg[2];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    dg[3] = matr[2] * matr[7] - matr[1] * matr[8];
    dg[4] = matr[0] * matr[8] - matr[2] * matr[6];
    dg[5] = matr[1] * matr[6] - matr[0] * matr[7];
    dg[6] = matr[1] * matr[5] - matr[2] * matr[4];
    dg[7] = matr[2] * matr[3] - matr[0] * matr[5];
    dg[8] = matr[0] * matr[4] - matr[1] * matr[3];

    adj_m[0] = d[0] * ( matr[0] * f + dg[0] * g );
    adj_m[1] = d[1] * ( matr[1] * f + dg[1] * g );
    adj_m[2] = d[2] * ( matr[2] * f + dg[2] * g );
    adj_m[3] = d[0] * ( matr[3] * f + dg[3] * g );
    adj_m[4] = d[1] * ( matr[4] * f + dg[4] * g );
    adj_m[5] = d[2] * ( matr[5] * f + dg[5] * g );
    adj_m[6] = d[0] * ( matr[6] * f + dg[6] * g );
    adj_m[7] = d[1] * ( matr[7] * f + dg[7] * g );
    adj_m[8] = d[2] * ( matr[8] * f + dg[8] * g );

    g_obj[0][0] = -adj_m[0] - adj_m[1] - adj_m[2];
    g_obj[1][0] = adj_m[0];
    g_obj[2][0] = adj_m[1];
    g_obj[3][0] = adj_m[2];

    g_obj[0][1] = -adj_m[3] - adj_m[4] - adj_m[5];
    g_obj[1][1] = adj_m[3];
    g_obj[2][1] = adj_m[4];
    g_obj[3][1] = adj_m[5];

    g_obj[0][2] = -adj_m[6] - adj_m[7] - adj_m[8];
    g_obj[1][2] = adj_m[6];
    g_obj[2][2] = adj_m[7];
    g_obj[3][2] = adj_m[8];

    /* Calculate the hessian of the objective.                   */
    loc0  = f;                            /* Constant on nabla^2 f       */
    loc1  = g;                            /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[0] * f + dg[0] * cross;
    loc4 = dg[0] * g + matr[0] * cross;

    J_A[0] = loc0 + loc3 * matr[0] + loc4 * dg[0];
    J_A[1] = loc3 * matr[1] + loc4 * dg[1];
    J_A[2] = loc3 * matr[2] + loc4 * dg[2];
    J_B[0] = loc3 * matr[3] + loc4 * dg[3];
    J_B[1] = loc3 * matr[4] + loc4 * dg[4];
    J_B[2] = loc3 * matr[5] + loc4 * dg[5];
    J_C[0] = loc3 * matr[6] + loc4 * dg[6];
    J_C[1] = loc3 * matr[7] + loc4 * dg[7];
    J_C[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[1] * f + dg[1] * cross;
    loc4 = dg[1] * g + matr[1] * cross;

    J_A[3] = loc0 + loc3 * matr[1] + loc4 * dg[1];
    J_A[4] = loc3 * matr[2] + loc4 * dg[2];
    J_B[3] = loc3 * matr[3] + loc4 * dg[3];
    J_B[4] = loc3 * matr[4] + loc4 * dg[4];
    J_B[5] = loc3 * matr[5] + loc4 * dg[5];
    J_C[3] = loc3 * matr[6] + loc4 * dg[6];
    J_C[4] = loc3 * matr[7] + loc4 * dg[7];
    J_C[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[2] * f + dg[2] * cross;
    loc4 = dg[2] * g + matr[2] * cross;

    J_A[5] = loc0 + loc3 * matr[2] + loc4 * dg[2];
    J_B[6] = loc3 * matr[3] + loc4 * dg[3];
    J_B[7] = loc3 * matr[4] + loc4 * dg[4];
    J_B[8] = loc3 * matr[5] + loc4 * dg[5];
    J_C[6] = loc3 * matr[6] + loc4 * dg[6];
    J_C[7] = loc3 * matr[7] + loc4 * dg[7];
    J_C[8] = loc3 * matr[8] + loc4 * dg[8];

    /* First diagonal block */
    J_A[0] *= scale[0];
    J_A[1] *= scale[1];
    J_A[2] *= scale[2];
    J_A[3] *= scale[3];
    J_A[4] *= scale[4];
    J_A[5] *= scale[5];

    A[0] = -J_A[0] - J_A[1] - J_A[2];
    A[1] = -J_A[1] - J_A[3] - J_A[4];
    A[2] = -J_A[2] - J_A[4] - J_A[5];

    h_obj[0][0][0] = -A[0] - A[1] - A[2];
    h_obj[1][0][0] = A[0];
    h_obj[2][0][0] = A[1];
    h_obj[3][0][0] = A[2];

    h_obj[4][0][0] = J_A[0];
    h_obj[5][0][0] = J_A[1];
    h_obj[6][0][0] = J_A[2];

    h_obj[7][0][0] = J_A[3];
    h_obj[8][0][0] = J_A[4];

    h_obj[9][0][0] = J_A[5];

    /* First off-diagonal block */
    loc2 = matr[8] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[7] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[6] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    J_B[0] *= scale[0];
    J_B[1] *= scale[1];
    J_B[2] *= scale[2];
    J_B[3] *= scale[1];
    J_B[4] *= scale[3];
    J_B[5] *= scale[4];
    J_B[6] *= scale[2];
    J_B[7] *= scale[4];
    J_B[8] *= scale[5];

    A[0] = -J_B[0] - J_B[3] - J_B[6];
    A[1] = -J_B[1] - J_B[4] - J_B[7];
    A[2] = -J_B[2] - J_B[5] - J_B[8];

    h_obj[0][0][1] = -A[0] - A[1] - A[2];
    h_obj[1][0][1] = A[0];
    h_obj[2][0][1] = A[1];
    h_obj[3][0][1] = A[2];

    h_obj[1][1][0] = -J_B[0] - J_B[1] - J_B[2];
    h_obj[4][0][1] = J_B[0];
    h_obj[5][0][1] = J_B[1];
    h_obj[6][0][1] = J_B[2];

    h_obj[2][1][0] = -J_B[3] - J_B[4] - J_B[5];
    h_obj[5][1][0] = J_B[3];
    h_obj[7][0][1] = J_B[4];
    h_obj[8][0][1] = J_B[5];

    h_obj[3][1][0] = -J_B[6] - J_B[7] - J_B[8];
    h_obj[6][1][0] = J_B[6];
    h_obj[8][1][0] = J_B[7];
    h_obj[9][0][1] = J_B[8];

    /* Second off-diagonal block */
    loc2 = matr[5] * loc1;
    J_C[1] -= loc2;
    J_C[3] += loc2;

    loc2 = matr[4] * loc1;
    J_C[2] += loc2;
    J_C[6] -= loc2;

    loc2 = matr[3] * loc1;
    J_C[5] -= loc2;
    J_C[7] += loc2;

    J_C[0] *= scale[0];
    J_C[1] *= scale[1];
    J_C[2] *= scale[2];
    J_C[3] *= scale[1];
    J_C[4] *= scale[3];
    J_C[5] *= scale[4];
    J_C[6] *= scale[2];
    J_C[7] *= scale[4];
    J_C[8] *= scale[5];

    A[0] = -J_C[0] - J_C[3] - J_C[6];
    A[1] = -J_C[1] - J_C[4] - J_C[7];
    A[2] = -J_C[2] - J_C[5] - J_C[8];

    h_obj[0][0][2] = -A[0] - A[1] - A[2];
    h_obj[1][0][2] = A[0];
    h_obj[2][0][2] = A[1];
    h_obj[3][0][2] = A[2];

    h_obj[1][2][0] = -J_C[0] - J_C[1] - J_C[2];
    h_obj[4][0][2] = J_C[0];
    h_obj[5][0][2] = J_C[1];
    h_obj[6][0][2] = J_C[2];

    h_obj[2][2][0] = -J_C[3] - J_C[4] - J_C[5];
    h_obj[5][2][0] = J_C[3];
    h_obj[7][0][2] = J_C[4];
    h_obj[8][0][2] = J_C[5];

    h_obj[3][2][0] = -J_C[6] - J_C[7] - J_C[8];
    h_obj[6][2][0] = J_C[6];
    h_obj[8][2][0] = J_C[7];
    h_obj[9][0][2] = J_C[8];

    /* Second block of rows */
    loc3 = matr[3] * f + dg[3] * cross;
    loc4 = dg[3] * g + matr[3] * cross;

    J_A[0] = loc0 + loc3 * matr[3] + loc4 * dg[3];
    J_A[1] = loc3 * matr[4] + loc4 * dg[4];
    J_A[2] = loc3 * matr[5] + loc4 * dg[5];
    J_B[0] = loc3 * matr[6] + loc4 * dg[6];
    J_B[1] = loc3 * matr[7] + loc4 * dg[7];
    J_B[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[4] * f + dg[4] * cross;
    loc4 = dg[4] * g + matr[4] * cross;

    J_A[3] = loc0 + loc3 * matr[4] + loc4 * dg[4];
    J_A[4] = loc3 * matr[5] + loc4 * dg[5];
    J_B[3] = loc3 * matr[6] + loc4 * dg[6];
    J_B[4] = loc3 * matr[7] + loc4 * dg[7];
    J_B[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[5] * f + dg[5] * cross;
    loc4 = dg[5] * g + matr[5] * cross;

    J_A[5] = loc0 + loc3 * matr[5] + loc4 * dg[5];
    J_B[6] = loc3 * matr[6] + loc4 * dg[6];
    J_B[7] = loc3 * matr[7] + loc4 * dg[7];
    J_B[8] = loc3 * matr[8] + loc4 * dg[8];

    /* Second diagonal block */
    J_A[0] *= scale[0];
    J_A[1] *= scale[1];
    J_A[2] *= scale[2];
    J_A[3] *= scale[3];
    J_A[4] *= scale[4];
    J_A[5] *= scale[5];

    A[0] = -J_A[0] - J_A[1] - J_A[2];
    A[1] = -J_A[1] - J_A[3] - J_A[4];
    A[2] = -J_A[2] - J_A[4] - J_A[5];

    h_obj[0][1][1] = -A[0] - A[1] - A[2];
    h_obj[1][1][1] = A[0];
    h_obj[2][1][1] = A[1];
    h_obj[3][1][1] = A[2];

    h_obj[4][1][1] = J_A[0];
    h_obj[5][1][1] = J_A[1];
    h_obj[6][1][1] = J_A[2];

    h_obj[7][1][1] = J_A[3];
    h_obj[8][1][1] = J_A[4];

    h_obj[9][1][1] = J_A[5];

    /* Third off-diagonal block */
    loc2 = matr[2] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[1] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[0] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    J_B[0] *= scale[0];
    J_B[1] *= scale[1];
    J_B[2] *= scale[2];
    J_B[3] *= scale[1];
    J_B[4] *= scale[3];
    J_B[5] *= scale[4];
    J_B[6] *= scale[2];
    J_B[7] *= scale[4];
    J_B[8] *= scale[5];

    A[0] = -J_B[0] - J_B[3] - J_B[6];
    A[1] = -J_B[1] - J_B[4] - J_B[7];
    A[2] = -J_B[2] - J_B[5] - J_B[8];

    h_obj[0][1][2] = -A[0] - A[1] - A[2];
    h_obj[1][1][2] = A[0];
    h_obj[2][1][2] = A[1];
    h_obj[3][1][2] = A[2];

    h_obj[1][2][1] = -J_B[0] - J_B[1] - J_B[2];
    h_obj[4][1][2] = J_B[0];
    h_obj[5][1][2] = J_B[1];
    h_obj[6][1][2] = J_B[2];

    h_obj[2][2][1] = -J_B[3] - J_B[4] - J_B[5];
    h_obj[5][2][1] = J_B[3];
    h_obj[7][1][2] = J_B[4];
    h_obj[8][1][2] = J_B[5];

    h_obj[3][2][1] = -J_B[6] - J_B[7] - J_B[8];
    h_obj[6][2][1] = J_B[6];
    h_obj[8][2][1] = J_B[7];
    h_obj[9][1][2] = J_B[8];

    /* Third block of rows */
    loc3 = matr[6] * f + dg[6] * cross;
    loc4 = dg[6] * g + matr[6] * cross;

    J_A[0] = loc0 + loc3 * matr[6] + loc4 * dg[6];
    J_A[1] = loc3 * matr[7] + loc4 * dg[7];
    J_A[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[7] * f + dg[7] * cross;
    loc4 = dg[7] * g + matr[7] * cross;

    J_A[3] = loc0 + loc3 * matr[7] + loc4 * dg[7];
    J_A[4] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[8] * f + dg[8] * cross;
    loc4 = dg[8] * g + matr[8] * cross;

    J_A[5] = loc0 + loc3 * matr[8] + loc4 * dg[8];

    /* Third diagonal block */
    J_A[0] *= scale[0];
    J_A[1] *= scale[1];
    J_A[2] *= scale[2];
    J_A[3] *= scale[3];
    J_A[4] *= scale[4];
    J_A[5] *= scale[5];

    A[0] = -J_A[0] - J_A[1] - J_A[2];
    A[1] = -J_A[1] - J_A[3] - J_A[4];
    A[2] = -J_A[2] - J_A[4] - J_A[5];

    h_obj[0][2][2] = -A[0] - A[1] - A[2];
    h_obj[1][2][2] = A[0];
    h_obj[2][2][2] = A[1];
    h_obj[3][2][2] = A[2];

    h_obj[4][2][2] = J_A[0];
    h_obj[5][2][2] = J_A[1];
    h_obj[6][2][2] = J_A[2];

    h_obj[7][2][2] = J_A[3];
    h_obj[8][2][2] = J_A[4];

    h_obj[9][2][2] = J_A[5];

    // completes diagonal blocks.
    h_obj[0].fill_lower_triangle();
    h_obj[4].fill_lower_triangle();
    h_obj[7].fill_lower_triangle();
    h_obj[9].fill_lower_triangle();
    return true;
}
bool MBMesquite::h_fcn_3p ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 2613 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), g_fcn_3p(), l, m_fcn_3p(), MSQ_MIN, MBMesquite::Exponent::raise(), and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal().

{
    const double h  = 0.5; /* h = 1 / (2*height) */
    const double th = 1.0; /* h = 1 / (height)   */

    double matr[9], f;
    double adj_m[9], g;
    double dg[9], loc0, loc1, loc2, loc3, loc4;
    double A[12], J_A[6], J_B[9], J_C[9], cross;

    /* Calculate M = A*inv(W). */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = x[2][0] - x[0][0];
    matr[2] = ( 2.0 * x[3][0] - x[1][0] - x[2][0] ) * h;

    matr[3] = x[1][1] - x[0][1];
    matr[4] = x[2][1] - x[0][1];
    matr[5] = ( 2.0 * x[3][1] - x[1][1] - x[2][1] ) * h;

    matr[6] = x[1][2] - x[0][2];
    matr[7] = x[2][2] - x[0][2];
    matr[8] = ( 2.0 * x[3][2] - x[1][2] - x[2][2] ) * h;

    /* Calculate det(M). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[2] = matr[3] * matr[7] - matr[4] * matr[6];
    g     = matr[0] * dg[0] + matr[1] * dg[1] + matr[2] * dg[2];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    dg[3] = matr[2] * matr[7] - matr[1] * matr[8];
    dg[4] = matr[0] * matr[8] - matr[2] * matr[6];
    dg[5] = matr[1] * matr[6] - matr[0] * matr[7];
    dg[6] = matr[1] * matr[5] - matr[2] * matr[4];
    dg[7] = matr[2] * matr[3] - matr[0] * matr[5];
    dg[8] = matr[0] * matr[4] - matr[1] * matr[3];

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = matr[0] * f + dg[0] * g;
    adj_m[1] = matr[1] * f + dg[1] * g;
    adj_m[2] = matr[2] * f + dg[2] * g;
    adj_m[3] = matr[3] * f + dg[3] * g;
    adj_m[4] = matr[4] * f + dg[4] * g;
    adj_m[5] = matr[5] * f + dg[5] * g;
    adj_m[6] = matr[6] * f + dg[6] * g;
    adj_m[7] = matr[7] * f + dg[7] * g;
    adj_m[8] = matr[8] * f + dg[8] * g;

    g_obj[0][0] = -adj_m[0] - adj_m[1];
    g_obj[1][0] = adj_m[0] - h * adj_m[2];
    g_obj[2][0] = adj_m[1] - h * adj_m[2];
    g_obj[3][0] = th * adj_m[2];

    g_obj[0][1] = -adj_m[3] - adj_m[4];
    g_obj[1][1] = adj_m[3] - h * adj_m[5];
    g_obj[2][1] = adj_m[4] - h * adj_m[5];
    g_obj[3][1] = th * adj_m[5];

    g_obj[0][2] = -adj_m[6] - adj_m[7];
    g_obj[1][2] = adj_m[6] - h * adj_m[8];
    g_obj[2][2] = adj_m[7] - h * adj_m[8];
    g_obj[3][2] = th * adj_m[8];

    /* Calculate the hessian of the objective.                   */
    loc0  = f;                            /* Constant on nabla^2 f       */
    loc1  = g;                            /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[0] * f + dg[0] * cross;
    loc4 = dg[0] * g + matr[0] * cross;

    J_A[0] = loc0 + loc3 * matr[0] + loc4 * dg[0];
    J_A[1] = loc3 * matr[1] + loc4 * dg[1];
    J_A[2] = loc3 * matr[2] + loc4 * dg[2];
    J_B[0] = loc3 * matr[3] + loc4 * dg[3];
    J_B[1] = loc3 * matr[4] + loc4 * dg[4];
    J_B[2] = loc3 * matr[5] + loc4 * dg[5];
    J_C[0] = loc3 * matr[6] + loc4 * dg[6];
    J_C[1] = loc3 * matr[7] + loc4 * dg[7];
    J_C[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[1] * f + dg[1] * cross;
    loc4 = dg[1] * g + matr[1] * cross;

    J_A[3] = loc0 + loc3 * matr[1] + loc4 * dg[1];
    J_A[4] = loc3 * matr[2] + loc4 * dg[2];
    J_B[3] = loc3 * matr[3] + loc4 * dg[3];
    J_B[4] = loc3 * matr[4] + loc4 * dg[4];
    J_B[5] = loc3 * matr[5] + loc4 * dg[5];
    J_C[3] = loc3 * matr[6] + loc4 * dg[6];
    J_C[4] = loc3 * matr[7] + loc4 * dg[7];
    J_C[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[2] * f + dg[2] * cross;
    loc4 = dg[2] * g + matr[2] * cross;

    J_A[5] = loc0 + loc3 * matr[2] + loc4 * dg[2];
    J_B[6] = loc3 * matr[3] + loc4 * dg[3];
    J_B[7] = loc3 * matr[4] + loc4 * dg[4];
    J_B[8] = loc3 * matr[5] + loc4 * dg[5];
    J_C[6] = loc3 * matr[6] + loc4 * dg[6];
    J_C[7] = loc3 * matr[7] + loc4 * dg[7];
    J_C[8] = loc3 * matr[8] + loc4 * dg[8];

    /* First diagonal block */
    A[0] = -J_A[0] - J_A[1];
    A[1] = J_A[0] - h * J_A[2];
    A[2] = J_A[1] - h * J_A[2];
    A[3] = th * J_A[2];

    A[4] = -J_A[1] - J_A[3];
    A[5] = J_A[1] - h * J_A[4];
    A[6] = J_A[3] - h * J_A[4];
    A[7] = th * J_A[4];

    A[8]  = -J_A[2] - J_A[4];
    A[9]  = J_A[2] - h * J_A[5];
    A[10] = J_A[4] - h * J_A[5];
    A[11] = th * J_A[5];

    h_obj[0][0][0] = -A[0] - A[4];
    h_obj[1][0][0] = A[0] - h * A[8];
    h_obj[2][0][0] = A[4] - h * A[8];
    h_obj[3][0][0] = th * A[8];

    h_obj[4][0][0] = A[1] - h * A[9];
    h_obj[5][0][0] = A[5] - h * A[9];
    h_obj[6][0][0] = th * A[9];

    h_obj[7][0][0] = A[6] - h * A[10];
    h_obj[8][0][0] = th * A[10];

    h_obj[9][0][0] = th * A[11];

    /* First off-diagonal block */
    loc2 = matr[8] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[7] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[6] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    A[0] = -J_B[0] - J_B[1];
    A[1] = J_B[0] - h * J_B[2];
    A[2] = J_B[1] - h * J_B[2];
    A[3] = th * J_B[2];

    A[4] = -J_B[3] - J_B[4];
    A[5] = J_B[3] - h * J_B[5];
    A[6] = J_B[4] - h * J_B[5];
    A[7] = th * J_B[5];

    A[8]  = -J_B[6] - J_B[7];
    A[9]  = J_B[6] - h * J_B[8];
    A[10] = J_B[7] - h * J_B[8];
    A[11] = th * J_B[8];

    h_obj[0][0][1] = -A[0] - A[4];
    h_obj[1][1][0] = A[0] - h * A[8];
    h_obj[2][1][0] = A[4] - h * A[8];
    h_obj[3][1][0] = th * A[8];

    h_obj[1][0][1] = -A[1] - A[5];
    h_obj[4][0][1] = A[1] - h * A[9];
    h_obj[5][1][0] = A[5] - h * A[9];
    h_obj[6][1][0] = th * A[9];

    h_obj[2][0][1] = -A[2] - A[6];
    h_obj[5][0][1] = A[2] - h * A[10];
    h_obj[7][0][1] = A[6] - h * A[10];
    h_obj[8][1][0] = th * A[10];

    h_obj[3][0][1] = -A[3] - A[7];
    h_obj[6][0][1] = A[3] - h * A[11];
    h_obj[8][0][1] = A[7] - h * A[11];
    h_obj[9][0][1] = th * A[11];

    /* Second off-diagonal block */
    loc2 = matr[5] * loc1;
    J_C[1] -= loc2;
    J_C[3] += loc2;

    loc2 = matr[4] * loc1;
    J_C[2] += loc2;
    J_C[6] -= loc2;

    loc2 = matr[3] * loc1;
    J_C[5] -= loc2;
    J_C[7] += loc2;

    A[0] = -J_C[0] - J_C[1];
    A[1] = J_C[0] - h * J_C[2];
    A[2] = J_C[1] - h * J_C[2];
    A[3] = th * J_C[2];

    A[4] = -J_C[3] - J_C[4];
    A[5] = J_C[3] - h * J_C[5];
    A[6] = J_C[4] - h * J_C[5];
    A[7] = th * J_C[5];

    A[8]  = -J_C[6] - J_C[7];
    A[9]  = J_C[6] - h * J_C[8];
    A[10] = J_C[7] - h * J_C[8];
    A[11] = th * J_C[8];

    h_obj[0][0][2] = -A[0] - A[4];
    h_obj[1][2][0] = A[0] - h * A[8];
    h_obj[2][2][0] = A[4] - h * A[8];
    h_obj[3][2][0] = th * A[8];

    h_obj[1][0][2] = -A[1] - A[5];
    h_obj[4][0][2] = A[1] - h * A[9];
    h_obj[5][2][0] = A[5] - h * A[9];
    h_obj[6][2][0] = th * A[9];

    h_obj[2][0][2] = -A[2] - A[6];
    h_obj[5][0][2] = A[2] - h * A[10];
    h_obj[7][0][2] = A[6] - h * A[10];
    h_obj[8][2][0] = th * A[10];

    h_obj[3][0][2] = -A[3] - A[7];
    h_obj[6][0][2] = A[3] - h * A[11];
    h_obj[8][0][2] = A[7] - h * A[11];
    h_obj[9][0][2] = th * A[11];

    /* Second block of rows */
    loc3 = matr[3] * f + dg[3] * cross;
    loc4 = dg[3] * g + matr[3] * cross;

    J_A[0] = loc0 + loc3 * matr[3] + loc4 * dg[3];
    J_A[1] = loc3 * matr[4] + loc4 * dg[4];
    J_A[2] = loc3 * matr[5] + loc4 * dg[5];
    J_B[0] = loc3 * matr[6] + loc4 * dg[6];
    J_B[1] = loc3 * matr[7] + loc4 * dg[7];
    J_B[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[4] * f + dg[4] * cross;
    loc4 = dg[4] * g + matr[4] * cross;

    J_A[3] = loc0 + loc3 * matr[4] + loc4 * dg[4];
    J_A[4] = loc3 * matr[5] + loc4 * dg[5];
    J_B[3] = loc3 * matr[6] + loc4 * dg[6];
    J_B[4] = loc3 * matr[7] + loc4 * dg[7];
    J_B[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[5] * f + dg[5] * cross;
    loc4 = dg[5] * g + matr[5] * cross;

    J_A[5] = loc0 + loc3 * matr[5] + loc4 * dg[5];
    J_B[6] = loc3 * matr[6] + loc4 * dg[6];
    J_B[7] = loc3 * matr[7] + loc4 * dg[7];
    J_B[8] = loc3 * matr[8] + loc4 * dg[8];

    /* Second diagonal block */
    A[0] = -J_A[0] - J_A[1];
    A[1] = J_A[0] - h * J_A[2];
    A[2] = J_A[1] - h * J_A[2];
    A[3] = th * J_A[2];

    A[4] = -J_A[1] - J_A[3];
    A[5] = J_A[1] - h * J_A[4];
    A[6] = J_A[3] - h * J_A[4];
    A[7] = th * J_A[4];

    A[8]  = -J_A[2] - J_A[4];
    A[9]  = J_A[2] - h * J_A[5];
    A[10] = J_A[4] - h * J_A[5];
    A[11] = th * J_A[5];

    h_obj[0][1][1] = -A[0] - A[4];
    h_obj[1][1][1] = A[0] - h * A[8];
    h_obj[2][1][1] = A[4] - h * A[8];
    h_obj[3][1][1] = th * A[8];

    h_obj[4][1][1] = A[1] - h * A[9];
    h_obj[5][1][1] = A[5] - h * A[9];
    h_obj[6][1][1] = th * A[9];

    h_obj[7][1][1] = A[6] - h * A[10];
    h_obj[8][1][1] = th * A[10];

    h_obj[9][1][1] = th * A[11];

    /* Third off-diagonal block */
    loc2 = matr[2] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[1] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[0] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    A[0] = -J_B[0] - J_B[1];
    A[1] = J_B[0] - h * J_B[2];
    A[2] = J_B[1] - h * J_B[2];
    A[3] = th * J_B[2];

    A[4] = -J_B[3] - J_B[4];
    A[5] = J_B[3] - h * J_B[5];
    A[6] = J_B[4] - h * J_B[5];
    A[7] = th * J_B[5];

    A[8]  = -J_B[6] - J_B[7];
    A[9]  = J_B[6] - h * J_B[8];
    A[10] = J_B[7] - h * J_B[8];
    A[11] = th * J_B[8];

    h_obj[0][1][2] = -A[0] - A[4];
    h_obj[1][2][1] = A[0] - h * A[8];
    h_obj[2][2][1] = A[4] - h * A[8];
    h_obj[3][2][1] = th * A[8];

    h_obj[1][1][2] = -A[1] - A[5];
    h_obj[4][1][2] = A[1] - h * A[9];
    h_obj[5][2][1] = A[5] - h * A[9];
    h_obj[6][2][1] = th * A[9];

    h_obj[2][1][2] = -A[2] - A[6];
    h_obj[5][1][2] = A[2] - h * A[10];
    h_obj[7][1][2] = A[6] - h * A[10];
    h_obj[8][2][1] = th * A[10];

    h_obj[3][1][2] = -A[3] - A[7];
    h_obj[6][1][2] = A[3] - h * A[11];
    h_obj[8][1][2] = A[7] - h * A[11];
    h_obj[9][1][2] = th * A[11];

    /* Third block of rows */
    loc3 = matr[6] * f + dg[6] * cross;
    loc4 = dg[6] * g + matr[6] * cross;

    J_A[0] = loc0 + loc3 * matr[6] + loc4 * dg[6];
    J_A[1] = loc3 * matr[7] + loc4 * dg[7];
    J_A[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[7] * f + dg[7] * cross;
    loc4 = dg[7] * g + matr[7] * cross;

    J_A[3] = loc0 + loc3 * matr[7] + loc4 * dg[7];
    J_A[4] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[8] * f + dg[8] * cross;
    loc4 = dg[8] * g + matr[8] * cross;

    J_A[5] = loc0 + loc3 * matr[8] + loc4 * dg[8];

    /* Third diagonal block */
    A[0] = -J_A[0] - J_A[1];
    A[1] = J_A[0] - h * J_A[2];
    A[2] = J_A[1] - h * J_A[2];
    A[3] = th * J_A[2];

    A[4] = -J_A[1] - J_A[3];
    A[5] = J_A[1] - h * J_A[4];
    A[6] = J_A[3] - h * J_A[4];
    A[7] = th * J_A[4];

    A[8]  = -J_A[2] - J_A[4];
    A[9]  = J_A[2] - h * J_A[5];
    A[10] = J_A[4] - h * J_A[5];
    A[11] = th * J_A[5];

    h_obj[0][2][2] = -A[0] - A[4];
    h_obj[1][2][2] = A[0] - h * A[8];
    h_obj[2][2][2] = A[4] - h * A[8];
    h_obj[3][2][2] = th * A[8];

    h_obj[4][2][2] = A[1] - h * A[9];
    h_obj[5][2][2] = A[5] - h * A[9];
    h_obj[6][2][2] = th * A[9];

    h_obj[7][2][2] = A[6] - h * A[10];
    h_obj[8][2][2] = th * A[10];

    h_obj[9][2][2] = th * A[11];

#if 0
  int i, j, k, l;
  double   nobj;
  Vector3D nx[4];
  Vector3D ng_obj[4];

  for (i = 0; i < 4; ++i) {
    nx[i] = x[i];
    ng_obj[i] = 0.0;
  }

  m_fcn_3p(obj, x, a, b, c);
  for (i = 0; i < 4; ++i) {
    for (j = 0; j < 3; ++j) {
      nx[i][j] += 1e-6;
      m_fcn_3p(nobj, nx, a, b, c);
      nx[i][j] = x[i][j];

      ng_obj[i][j] = (nobj - obj) / 1e-6;
      std::cout << i << " " << j << " " << g_obj[i][j] << " " << ng_obj[i][j] << std::endl;
    }
  }
  std::cout << std::endl;

  for (i = 0; i < 4; ++i) {
    for (j = 0; j < 3; ++j) {
      nx[i][j] += 1e-6;
      g_fcn_3p(nobj, ng_obj, nx, a, b, c);
      nx[i][j] = x[i][j];

      printf("%d %d", i, j);
      for (k = 0; k < 4; ++k) {
    for (l = 0; l < 3; ++l) {
      printf(" % 5.4e", (ng_obj[k][l] - g_obj[k][l]) / 1e-6);
    }
      }
      printf("\n");
    }
  }

  for (i = 0; i < 10; ++i) {
    std::cout << i << std::endl << h_obj[i] << std::endl << std::endl;
  }
#endif

    // completes diagonal blocks.
    h_obj[0].fill_lower_triangle();
    h_obj[4].fill_lower_triangle();
    h_obj[7].fill_lower_triangle();
    h_obj[9].fill_lower_triangle();
    return true;
}
bool MBMesquite::h_fcn_3w ( double &  obj,
Vector3D  g_obj[4],
Matrix3D  h_obj[10],
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 3210 of file MeanRatioFunctions.hpp.

References moab::cross(), MBMesquite::Matrix3D::fill_lower_triangle(), isqrt3, MSQ_MIN, MBMesquite::Exponent::raise(), tisqrt3, and MBMesquite::Exponent::value().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal().

{
    double matr[9], f;
    double adj_m[9], g;
    double dg[9], loc0, loc1, loc2, loc3, loc4;
    double A[12], J_A[6], J_B[9], J_C[9], cross;

    /* Calculate M = A*inv(W). */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = isqrt3 * ( 2 * x[2][0] - x[1][0] - x[0][0] );
    matr[2] = x[3][0] - x[0][0];

    matr[3] = x[1][1] - x[0][1];
    matr[4] = isqrt3 * ( 2 * x[2][1] - x[1][1] - x[0][1] );
    matr[5] = x[3][1] - x[0][1];

    matr[6] = x[1][2] - x[0][2];
    matr[7] = isqrt3 * ( 2 * x[2][2] - x[1][2] - x[0][2] );
    matr[8] = x[3][2] - x[0][2];

    /* Calculate det(M). */
    dg[0] = matr[4] * matr[8] - matr[5] * matr[7];
    dg[1] = matr[5] * matr[6] - matr[3] * matr[8];
    dg[2] = matr[3] * matr[7] - matr[4] * matr[6];
    g     = matr[0] * dg[0] + matr[1] * dg[1] + matr[2] * dg[2];
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    dg[3] = matr[2] * matr[7] - matr[1] * matr[8];
    dg[4] = matr[0] * matr[8] - matr[2] * matr[6];
    dg[5] = matr[1] * matr[6] - matr[0] * matr[7];
    dg[6] = matr[1] * matr[5] - matr[2] * matr[4];
    dg[7] = matr[2] * matr[3] - matr[0] * matr[5];
    dg[8] = matr[0] * matr[4] - matr[1] * matr[3];

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    loc3 = f;
    loc4 = g;

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );

    /* Calculate the derivative of the objective function.    */
    f = b.value() * obj / f; /* Constant on nabla f      */
    g = c.value() * obj / g; /* Constant on nable g      */
    f *= 2.0;                /* Modification for nabla f */

    adj_m[0] = matr[0] * f + dg[0] * g;
    adj_m[1] = matr[1] * f + dg[1] * g;
    adj_m[2] = matr[2] * f + dg[2] * g;
    adj_m[3] = matr[3] * f + dg[3] * g;
    adj_m[4] = matr[4] * f + dg[4] * g;
    adj_m[5] = matr[5] * f + dg[5] * g;
    adj_m[6] = matr[6] * f + dg[6] * g;
    adj_m[7] = matr[7] * f + dg[7] * g;
    adj_m[8] = matr[8] * f + dg[8] * g;

    g_obj[0][0] = -adj_m[0] - isqrt3 * adj_m[1] - adj_m[2];
    g_obj[1][0] = adj_m[0] - isqrt3 * adj_m[1];
    g_obj[2][0] = tisqrt3 * adj_m[1];
    g_obj[3][0] = adj_m[2];

    g_obj[0][1] = -adj_m[3] - isqrt3 * adj_m[4] - adj_m[5];
    g_obj[1][1] = adj_m[3] - isqrt3 * adj_m[4];
    g_obj[2][1] = tisqrt3 * adj_m[4];
    g_obj[3][1] = adj_m[5];

    g_obj[0][2] = -adj_m[6] - isqrt3 * adj_m[7] - adj_m[8];
    g_obj[1][2] = adj_m[6] - isqrt3 * adj_m[7];
    g_obj[2][2] = tisqrt3 * adj_m[7];
    g_obj[3][2] = adj_m[8];

    /* Calculate the hessian of the objective.                   */
    loc0  = f;                            /* Constant on nabla^2 f       */
    loc1  = g;                            /* Constant on nabla^2 g       */
    cross = f * c.value() / loc4;         /* Constant on nabla g nabla f */
    f     = f * ( b.value() - 1 ) / loc3; /* Constant on nabla f nabla f */
    g     = g * ( c.value() - 1 ) / loc4; /* Constant on nabla g nabla g */
    f *= 2.0;                             /* Modification for nabla f    */

    /* First block of rows */
    loc3 = matr[0] * f + dg[0] * cross;
    loc4 = dg[0] * g + matr[0] * cross;

    J_A[0] = loc0 + loc3 * matr[0] + loc4 * dg[0];
    J_A[1] = loc3 * matr[1] + loc4 * dg[1];
    J_A[2] = loc3 * matr[2] + loc4 * dg[2];
    J_B[0] = loc3 * matr[3] + loc4 * dg[3];
    J_B[1] = loc3 * matr[4] + loc4 * dg[4];
    J_B[2] = loc3 * matr[5] + loc4 * dg[5];
    J_C[0] = loc3 * matr[6] + loc4 * dg[6];
    J_C[1] = loc3 * matr[7] + loc4 * dg[7];
    J_C[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[1] * f + dg[1] * cross;
    loc4 = dg[1] * g + matr[1] * cross;

    J_A[3] = loc0 + loc3 * matr[1] + loc4 * dg[1];
    J_A[4] = loc3 * matr[2] + loc4 * dg[2];
    J_B[3] = loc3 * matr[3] + loc4 * dg[3];
    J_B[4] = loc3 * matr[4] + loc4 * dg[4];
    J_B[5] = loc3 * matr[5] + loc4 * dg[5];
    J_C[3] = loc3 * matr[6] + loc4 * dg[6];
    J_C[4] = loc3 * matr[7] + loc4 * dg[7];
    J_C[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[2] * f + dg[2] * cross;
    loc4 = dg[2] * g + matr[2] * cross;

    J_A[5] = loc0 + loc3 * matr[2] + loc4 * dg[2];
    J_B[6] = loc3 * matr[3] + loc4 * dg[3];
    J_B[7] = loc3 * matr[4] + loc4 * dg[4];
    J_B[8] = loc3 * matr[5] + loc4 * dg[5];
    J_C[6] = loc3 * matr[6] + loc4 * dg[6];
    J_C[7] = loc3 * matr[7] + loc4 * dg[7];
    J_C[8] = loc3 * matr[8] + loc4 * dg[8];

    /* First diagonal block */
    A[0] = -J_A[0] - isqrt3 * J_A[1] - J_A[2];
    A[1] = J_A[0] - isqrt3 * J_A[1];
    // A[2]  =          tisqrt3*J_A[1];
    // A[3]  =                           J_A[2];

    A[4] = -J_A[1] - isqrt3 * J_A[3] - J_A[4];
    A[5] = J_A[1] - isqrt3 * J_A[3];
    A[6] = tisqrt3 * J_A[3];
    // A[7]  =                           J_A[4];

    A[8]  = -J_A[2] - isqrt3 * J_A[4] - J_A[5];
    A[9]  = J_A[2] - isqrt3 * J_A[4];
    A[10] = tisqrt3 * J_A[4];
    A[11] = J_A[5];

    h_obj[0][0][0] = -A[0] - isqrt3 * A[4] - A[8];
    h_obj[1][0][0] = A[0] - isqrt3 * A[4];
    h_obj[2][0][0] = tisqrt3 * A[4];
    h_obj[3][0][0] = A[8];

    h_obj[4][0][0] = A[1] - isqrt3 * A[5];
    h_obj[5][0][0] = tisqrt3 * A[5];
    h_obj[6][0][0] = A[9];

    h_obj[7][0][0] = tisqrt3 * A[6];
    h_obj[8][0][0] = A[10];

    h_obj[9][0][0] = A[11];

    /* First off-diagonal block */
    loc2 = matr[8] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[7] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[6] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    A[0] = -J_B[0] - isqrt3 * J_B[1] - J_B[2];
    A[1] = J_B[0] - isqrt3 * J_B[1];
    A[2] = tisqrt3 * J_B[1];
    A[3] = J_B[2];

    A[4] = -J_B[3] - isqrt3 * J_B[4] - J_B[5];
    A[5] = J_B[3] - isqrt3 * J_B[4];
    A[6] = tisqrt3 * J_B[4];
    A[7] = J_B[5];

    A[8]  = -J_B[6] - isqrt3 * J_B[7] - J_B[8];
    A[9]  = J_B[6] - isqrt3 * J_B[7];
    A[10] = tisqrt3 * J_B[7];
    A[11] = J_B[8];

    h_obj[0][0][1] = -A[0] - isqrt3 * A[4] - A[8];
    h_obj[1][1][0] = A[0] - isqrt3 * A[4];
    h_obj[2][1][0] = tisqrt3 * A[4];
    h_obj[3][1][0] = A[8];

    h_obj[1][0][1] = -A[1] - isqrt3 * A[5] - A[9];
    h_obj[4][0][1] = A[1] - isqrt3 * A[5];
    h_obj[5][1][0] = tisqrt3 * A[5];
    h_obj[6][1][0] = A[9];

    h_obj[2][0][1] = -A[2] - isqrt3 * A[6] - A[10];
    h_obj[5][0][1] = A[2] - isqrt3 * A[6];
    h_obj[7][0][1] = tisqrt3 * A[6];
    h_obj[8][1][0] = A[10];

    h_obj[3][0][1] = -A[3] - isqrt3 * A[7] - A[11];
    h_obj[6][0][1] = A[3] - isqrt3 * A[7];
    h_obj[8][0][1] = tisqrt3 * A[7];
    h_obj[9][0][1] = A[11];

    /* Second off-diagonal block */
    loc2 = matr[5] * loc1;
    J_C[1] -= loc2;
    J_C[3] += loc2;

    loc2 = matr[4] * loc1;
    J_C[2] += loc2;
    J_C[6] -= loc2;

    loc2 = matr[3] * loc1;
    J_C[5] -= loc2;
    J_C[7] += loc2;

    A[0] = -J_C[0] - isqrt3 * J_C[1] - J_C[2];
    A[1] = J_C[0] - isqrt3 * J_C[1];
    A[2] = tisqrt3 * J_C[1];
    A[3] = J_C[2];

    A[4] = -J_C[3] - isqrt3 * J_C[4] - J_C[5];
    A[5] = J_C[3] - isqrt3 * J_C[4];
    A[6] = tisqrt3 * J_C[4];
    A[7] = J_C[5];

    A[8]  = -J_C[6] - isqrt3 * J_C[7] - J_C[8];
    A[9]  = J_C[6] - isqrt3 * J_C[7];
    A[10] = tisqrt3 * J_C[7];
    A[11] = J_C[8];

    h_obj[0][0][2] = -A[0] - isqrt3 * A[4] - A[8];
    h_obj[1][2][0] = A[0] - isqrt3 * A[4];
    h_obj[2][2][0] = tisqrt3 * A[4];
    h_obj[3][2][0] = A[8];

    h_obj[1][0][2] = -A[1] - isqrt3 * A[5] - A[9];
    h_obj[4][0][2] = A[1] - isqrt3 * A[5];
    h_obj[5][2][0] = tisqrt3 * A[5];
    h_obj[6][2][0] = A[9];

    h_obj[2][0][2] = -A[2] - isqrt3 * A[6] - A[10];
    h_obj[5][0][2] = A[2] - isqrt3 * A[6];
    h_obj[7][0][2] = tisqrt3 * A[6];
    h_obj[8][2][0] = A[10];

    h_obj[3][0][2] = -A[3] - isqrt3 * A[7] - A[11];
    h_obj[6][0][2] = A[3] - isqrt3 * A[7];
    h_obj[8][0][2] = tisqrt3 * A[7];
    h_obj[9][0][2] = A[11];

    /* Second block of rows */
    loc3 = matr[3] * f + dg[3] * cross;
    loc4 = dg[3] * g + matr[3] * cross;

    J_A[0] = loc0 + loc3 * matr[3] + loc4 * dg[3];
    J_A[1] = loc3 * matr[4] + loc4 * dg[4];
    J_A[2] = loc3 * matr[5] + loc4 * dg[5];
    J_B[0] = loc3 * matr[6] + loc4 * dg[6];
    J_B[1] = loc3 * matr[7] + loc4 * dg[7];
    J_B[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[4] * f + dg[4] * cross;
    loc4 = dg[4] * g + matr[4] * cross;

    J_A[3] = loc0 + loc3 * matr[4] + loc4 * dg[4];
    J_A[4] = loc3 * matr[5] + loc4 * dg[5];
    J_B[3] = loc3 * matr[6] + loc4 * dg[6];
    J_B[4] = loc3 * matr[7] + loc4 * dg[7];
    J_B[5] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[5] * f + dg[5] * cross;
    loc4 = dg[5] * g + matr[5] * cross;

    J_A[5] = loc0 + loc3 * matr[5] + loc4 * dg[5];
    J_B[6] = loc3 * matr[6] + loc4 * dg[6];
    J_B[7] = loc3 * matr[7] + loc4 * dg[7];
    J_B[8] = loc3 * matr[8] + loc4 * dg[8];

    /* Second diagonal block */
    A[0] = -J_A[0] - isqrt3 * J_A[1] - J_A[2];
    A[1] = J_A[0] - isqrt3 * J_A[1];
    // A[2]  =          tisqrt3*J_A[1];
    // A[3]  =                           J_A[2];

    A[4] = -J_A[1] - isqrt3 * J_A[3] - J_A[4];
    A[5] = J_A[1] - isqrt3 * J_A[3];
    A[6] = tisqrt3 * J_A[3];
    // A[7]  =                           J_A[4];

    A[8]  = -J_A[2] - isqrt3 * J_A[4] - J_A[5];
    A[9]  = J_A[2] - isqrt3 * J_A[4];
    A[10] = tisqrt3 * J_A[4];
    A[11] = J_A[5];

    h_obj[0][1][1] = -A[0] - isqrt3 * A[4] - A[8];
    h_obj[1][1][1] = A[0] - isqrt3 * A[4];
    h_obj[2][1][1] = tisqrt3 * A[4];
    h_obj[3][1][1] = A[8];

    h_obj[4][1][1] = A[1] - isqrt3 * A[5];
    h_obj[5][1][1] = tisqrt3 * A[5];
    h_obj[6][1][1] = A[9];

    h_obj[7][1][1] = tisqrt3 * A[6];
    h_obj[8][1][1] = A[10];

    h_obj[9][1][1] = A[11];

    /* Third off-diagonal block */
    loc2 = matr[2] * loc1;
    J_B[1] += loc2;
    J_B[3] -= loc2;

    loc2 = matr[1] * loc1;
    J_B[2] -= loc2;
    J_B[6] += loc2;

    loc2 = matr[0] * loc1;
    J_B[5] += loc2;
    J_B[7] -= loc2;

    A[0] = -J_B[0] - isqrt3 * J_B[1] - J_B[2];
    A[1] = J_B[0] - isqrt3 * J_B[1];
    A[2] = tisqrt3 * J_B[1];
    A[3] = J_B[2];

    A[4] = -J_B[3] - isqrt3 * J_B[4] - J_B[5];
    A[5] = J_B[3] - isqrt3 * J_B[4];
    A[6] = tisqrt3 * J_B[4];
    A[7] = J_B[5];

    A[8]  = -J_B[6] - isqrt3 * J_B[7] - J_B[8];
    A[9]  = J_B[6] - isqrt3 * J_B[7];
    A[10] = tisqrt3 * J_B[7];
    A[11] = J_B[8];

    h_obj[0][1][2] = -A[0] - isqrt3 * A[4] - A[8];
    h_obj[1][2][1] = A[0] - isqrt3 * A[4];
    h_obj[2][2][1] = tisqrt3 * A[4];
    h_obj[3][2][1] = A[8];

    h_obj[1][1][2] = -A[1] - isqrt3 * A[5] - A[9];
    h_obj[4][1][2] = A[1] - isqrt3 * A[5];
    h_obj[5][2][1] = tisqrt3 * A[5];
    h_obj[6][2][1] = A[9];

    h_obj[2][1][2] = -A[2] - isqrt3 * A[6] - A[10];
    h_obj[5][1][2] = A[2] - isqrt3 * A[6];
    h_obj[7][1][2] = tisqrt3 * A[6];
    h_obj[8][2][1] = A[10];

    h_obj[3][1][2] = -A[3] - isqrt3 * A[7] - A[11];
    h_obj[6][1][2] = A[3] - isqrt3 * A[7];
    h_obj[8][1][2] = tisqrt3 * A[7];
    h_obj[9][1][2] = A[11];

    /* Third block of rows */
    loc3 = matr[6] * f + dg[6] * cross;
    loc4 = dg[6] * g + matr[6] * cross;

    J_A[0] = loc0 + loc3 * matr[6] + loc4 * dg[6];
    J_A[1] = loc3 * matr[7] + loc4 * dg[7];
    J_A[2] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[7] * f + dg[7] * cross;
    loc4 = dg[7] * g + matr[7] * cross;

    J_A[3] = loc0 + loc3 * matr[7] + loc4 * dg[7];
    J_A[4] = loc3 * matr[8] + loc4 * dg[8];

    loc3 = matr[8] * f + dg[8] * cross;
    loc4 = dg[8] * g + matr[8] * cross;

    J_A[5] = loc0 + loc3 * matr[8] + loc4 * dg[8];

    /* Third diagonal block */
    A[0] = -J_A[0] - isqrt3 * J_A[1] - J_A[2];
    A[1] = J_A[0] - isqrt3 * J_A[1];
    // A[2]  =          tisqrt3*J_A[1];
    // A[3]  =                           J_A[2];

    A[4] = -J_A[1] - isqrt3 * J_A[3] - J_A[4];
    A[5] = J_A[1] - isqrt3 * J_A[3];
    A[6] = tisqrt3 * J_A[3];
    // A[7]  =                           J_A[4];

    A[8]  = -J_A[2] - isqrt3 * J_A[4] - J_A[5];
    A[9]  = J_A[2] - isqrt3 * J_A[4];
    A[10] = tisqrt3 * J_A[4];
    A[11] = J_A[5];

    h_obj[0][2][2] = -A[0] - isqrt3 * A[4] - A[8];
    h_obj[1][2][2] = A[0] - isqrt3 * A[4];
    h_obj[2][2][2] = tisqrt3 * A[4];
    h_obj[3][2][2] = A[8];

    h_obj[4][2][2] = A[1] - isqrt3 * A[5];
    h_obj[5][2][2] = tisqrt3 * A[5];
    h_obj[6][2][2] = A[9];

    h_obj[7][2][2] = tisqrt3 * A[6];
    h_obj[8][2][2] = A[10];

    h_obj[9][2][2] = A[11];

    // completes diagonal blocks.
    h_obj[0].fill_lower_triangle();
    h_obj[4].fill_lower_triangle();
    h_obj[7].fill_lower_triangle();
    h_obj[9].fill_lower_triangle();

    return true;
}
static int MBMesquite::hash6432shift ( unsigned long long  key) [static]

Definition at line 165 of file ParallelHelper.cpp.

Referenced by generate_random_number().

{
    key = ( ~key ) + ( key << 18 );  // key = (key << 18) - key - 1;
    key = key ^ ( key >> 31 );
    key = key * 21;  // key = (key + (key << 2)) + (key << 4);
    key = key ^ ( key >> 11 );
    key = key + ( key << 6 );
    key = key ^ ( key >> 22 );
    return (int)key;
}
static unsigned long long MBMesquite::hash64shift ( unsigned long long  key) [static]

Definition at line 176 of file ParallelHelper.cpp.

Referenced by generate_random_number().

{
    key = ( ~key ) + ( key << 21 );  // key = (key << 21) - key - 1;
    key = key ^ ( key >> 24 );
    key = ( key + ( key << 3 ) ) + ( key << 8 );  // key * 265
    key = key ^ ( key >> 14 );
    key = ( key + ( key << 2 ) ) + ( key << 4 );  // key * 21
    key = key ^ ( key >> 28 );
    key = key + ( key << 31 );
    return key;
}
template<unsigned DIM>
static bool MBMesquite::hess ( const MsqMatrix< DIM, DIM > &  T,
double &  result,
MsqMatrix< DIM, DIM > &  deriv_wrt_T,
MsqMatrix< DIM, DIM > *  second_wrt_T 
) [inline, static]
template<unsigned DIM>
static bool MBMesquite::hess ( const MsqMatrix< DIM, DIM > &  A,
const MsqMatrix< DIM, DIM > &  W,
double &  result,
MsqMatrix< DIM, DIM > &  deriv,
MsqMatrix< DIM, DIM > *  second 
) [inline, static]

Definition at line 68 of file AWShapeSizeOrientNB1.cpp.

References set_scaled_I(), and sqr_Frobenius().

{
    deriv  = A - W;
    result = sqr_Frobenius( deriv );
    deriv *= 2.0;
    set_scaled_I( second, 2.0 );
    return true;
}
void MBMesquite::hess_scale ( MsqMatrix< 3, 3 >  R[6],
double  alpha 
) [inline]

Definition at line 50 of file TMPDerivs.hpp.

References moab::R.

Referenced by MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TPower2::hess(), and MBMesquite::TUntangleMu::hess().

{
    hess_scale_t< 3 >( R, alpha );
}
void MBMesquite::hess_scale ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

Definition at line 55 of file TMPDerivs.hpp.

References moab::R.

{
    hess_scale_t< 2 >( R, alpha );
}
template<unsigned D>
void MBMesquite::hess_scale_t ( MsqMatrix< D, D >  R[D *(D+1)/2],
double  alpha 
) [inline]

\( R *= s \)

template<int DIM, typename MAT >
void MBMesquite::hessian ( size_t  num_free_verts,
const MsqVector< DIM > *  dNdxi,
const MsqMatrix< DIM, DIM > *  d2mdA2,
MAT *  hess 
) [inline]

Calculate Hessian from derivatives of mapping function terms and derivatives of target metric.

Definition at line 95 of file TargetMetricUtil.hpp.

References transpose().

{
    MsqMatrix< 1, DIM > tmp[DIM][DIM];
    size_t h = 0;  // index of current Hessian block

    for( size_t i = 0; i < num_free_verts; ++i )
    {

        // Populate TMP with vector-matrix procucts common
        // to terms of this Hessian row.
        const MsqMatrix< 1, DIM >& gi = transpose( dNdxi[i] );
        switch( DIM )
        {
            case 3:
                tmp[0][2] = gi * d2mdA2[2];
                tmp[1][2] = gi * d2mdA2[4];
                tmp[2][0] = gi * transpose( d2mdA2[2] );
                tmp[2][1] = gi * transpose( d2mdA2[4] );
                tmp[2][2] = gi * d2mdA2[5];
            case 2:
                tmp[0][1] = gi * d2mdA2[1];
                tmp[1][0] = gi * transpose( d2mdA2[1] );
                tmp[1][1] = gi * d2mdA2[DIM];
            case 1:
                tmp[0][0] = gi * d2mdA2[0];
            case 0:
                break;
            default:
                assert( false );
        }

        // Calculate Hessian diagonal block
        MAT& H = hess[h++];
        switch( DIM )
        {
            case 3:
                H( 0, 2 ) = H( 2, 0 ) = tmp[0][2] * transpose( gi );
                H( 1, 2 ) = H( 2, 1 ) = tmp[1][2] * transpose( gi );
                H( 2, 2 )             = tmp[2][2] * transpose( gi );
            case 2:
                H( 0, 1 ) = H( 1, 0 ) = tmp[0][1] * transpose( gi );
                H( 1, 1 )             = tmp[1][1] * transpose( gi );
            case 1:
                H( 0, 0 ) = tmp[0][0] * transpose( gi );
            case 0:
                break;
            default:
                assert( false );
        }

        // Calculate remainder of Hessian row
        for( size_t j = i + 1; j < num_free_verts; ++j )
        {
            MAT& HH                       = hess[h++];
            const MsqMatrix< DIM, 1 >& gj = dNdxi[j];
            switch( DIM )
            {
                case 3:
                    HH( 0, 2 ) = tmp[0][2] * gj;
                    HH( 1, 2 ) = tmp[1][2] * gj;
                    HH( 2, 0 ) = tmp[2][0] * gj;
                    HH( 2, 1 ) = tmp[2][1] * gj;
                    HH( 2, 2 ) = tmp[2][2] * gj;
                case 2:
                    HH( 0, 1 ) = tmp[0][1] * gj;
                    HH( 1, 0 ) = tmp[1][0] * gj;
                    HH( 1, 1 ) = tmp[1][1] * gj;
                case 1:
                    HH( 0, 0 ) = tmp[0][0] * gj;
                case 0:
                    break;
                default:
                    assert( false );
            }
        }
    }
}
template<int DIM>
void MBMesquite::hessian_diagonal ( size_t  num_free_verts,
const MsqVector< DIM > *  dNdxi,
const MsqMatrix< DIM, DIM > *  d2mdA2,
SymMatrix3D *  diagonal 
) [inline]

Calculate Hessian from derivatives of mapping function terms and derivatives of target metric.

Definition at line 179 of file TargetMetricUtil.hpp.

References transpose().

{
    for( size_t i = 0; i < num_free_verts; ++i )
    {
        SymMatrix3D& H = diagonal[i];
        for( unsigned j = 0; j < ( ( DIM ) * ( DIM + 1 ) / 2 ); ++j )
            H[j] = transpose( dNdxi[i] ) * d2mdA2[j] * dNdxi[i];
    }
}
static bool MBMesquite::ideal_constant_skew_I_2D ( EntityTopology  element_type,
MsqMatrix< 2, 2 > &  q 
) [inline, static]

If, for the specified element type, the skew is constant for an ideal element and the aspect is identity everywhere within the element, pass back the constant skew/shape term and return true. Otherwise return false.

Definition at line 410 of file TargetCalculator.cpp.

References QUADRILATERAL, and TRIANGLE.

Referenced by MBMesquite::TargetCalculator::ideal_shape_2D(), and MBMesquite::TargetCalculator::ideal_skew_2D().

{
    switch( element_type )
    {
        case QUADRILATERAL:
            q = MsqMatrix< 2, 2 >( 1.0 );  // Identity
            return true;
        case TRIANGLE:
            // [ x, x/2 ]  x = pow(4/3, 0.25)
            // [ 0, y   ]  y = 1/x
            q( 0, 0 ) = 1.074569931823542;
            q( 0, 1 ) = 0.537284965911771;
            q( 1, 0 ) = 0.0;
            q( 1, 1 ) = 0.93060485910209956;
            return true;
        default:
            return false;
    }
}
static bool MBMesquite::ideal_constant_skew_I_3D ( EntityTopology  element_type,
MsqMatrix< 3, 3 > &  q 
) [inline, static]

If, for the specified element type, the skew is constant for an ideal element and the aspect is identity everywhere within the element, pass back the constant skew/shape term and return true. Otherwise return false.

Definition at line 369 of file TargetCalculator.cpp.

References HEXAHEDRON, PRISM, and TETRAHEDRON.

Referenced by MBMesquite::TargetCalculator::ideal_shape_3D(), and MBMesquite::TargetCalculator::ideal_skew_3D().

{
    switch( element_type )
    {
        case HEXAHEDRON:
            q = MsqMatrix< 3, 3 >( 1.0 );  // Identity
            return false;
        case TETRAHEDRON:
            // [ x,   x/2, x/2 ] x^6 = 2
            // [ 0,   y,   y/3 ] y^2 = 3/4 x^2
            // [ 0,   0,   z   ] z^2 = 2/3 x^2
            q( 0, 0 ) = 1.122462048309373;
            q( 0, 1 ) = q( 0, 2 ) = 0.56123102415468651;
            q( 1, 0 ) = q( 2, 0 ) = q( 2, 1 ) = 0.0;
            q( 1, 1 )                         = 0.97208064861983279;
            q( 1, 2 )                         = 0.32402688287327758;
            q( 2, 2 )                         = 0.91648642466573493;
            return true;
        case PRISM:
            //            [ 1   0   0 ]
            //  a^(-1/3)  [ 0   1  1/2]
            //            [ 0   0   a ]
            //
            // a = sqrt(3)/2
            //
            q( 0, 0 ) = q( 1, 1 ) = 1.0491150634216482;
            q( 0, 1 ) = q( 0, 2 ) = q( 1, 0 ) = 0.0;
            q( 1, 2 )                         = 0.52455753171082409;
            q( 2, 0 ) = q( 2, 1 ) = 0.0;
            q( 2, 2 )             = 0.90856029641606972;
            return true;
        default:
            return false;
    }
}
static void MBMesquite::init_hex_pyr ( Vector3D *  coords,
double  height 
) [static]

Definition at line 162 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

{
    coords[0] = Vector3D( 0.5 * side, -0.5 * side, -0.25 * side );
    coords[1] = Vector3D( 0.5 * side, 0.5 * side, -0.25 * side );
    coords[2] = Vector3D( -0.5 * side, 0.5 * side, -0.25 * side );
    coords[3] = Vector3D( -0.5 * side, -0.5 * side, -0.25 * side );
    coords[4] = Vector3D( 0.0, 0.0, 0.75 * side );
}
static void MBMesquite::init_pyr ( Vector3D *  coords,
double  side 
) [static]

Definition at line 141 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

{
    const double height = side * sqrt( 2.0 ) * 0.5;
    coords[0]           = Vector3D( 0.5 * side, -0.5 * side, -0.25 * height );
    coords[1]           = Vector3D( 0.5 * side, 0.5 * side, -0.25 * height );
    coords[2]           = Vector3D( -0.5 * side, 0.5 * side, -0.25 * height );
    coords[3]           = Vector3D( -0.5 * side, -0.5 * side, -0.25 * height );
    coords[4]           = Vector3D( 0.0, 0.0, 0.75 * height );
}
static void MBMesquite::init_tet ( Vector3D *  coords,
double  side 
) [static]

Definition at line 131 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

{
    const double height     = side * sqrt( 2.0 / 3.0 );
    const double third_base = side * sqrt( 3.0 ) / 6.0;
    coords[0]               = Vector3D( -0.5 * side, -third_base, -0.25 * height );
    coords[1]               = Vector3D( 0.5 * side, -third_base, -0.25 * height );
    coords[2]               = Vector3D( 0.0, 2 * third_base, -0.25 * height );
    coords[3]               = Vector3D( 0.0, 0.0, 0.75 * height );
}
static void MBMesquite::init_tri ( Vector3D *  coords,
double  side 
) [static]

Definition at line 123 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

{
    const double third_height = side * sqrt( 3.0 ) / 6.0;
    coords[1]                 = Vector3D( -0.5 * side, -third_height, 0.0 );
    coords[2]                 = Vector3D( 0.5 * side, -third_height, 0.0 );
    coords[0]                 = Vector3D( 0.0, 2 * third_height, 0.0 );
}
static const Vector3D *const * MBMesquite::init_unit_elem ( Vector3D **  ptr) [static]

Definition at line 102 of file IdealElements.cpp.

References cbrt(), HEXAHEDRON, init_hex_pyr(), init_pyr(), init_tet(), init_tri(), init_wdg(), MIXED, PRISM, PYRAMID, QUADRILATERAL, TETRAHEDRON, TRIANGLE, unit_hex, unit_hex_pyr, unit_pyr, unit_quad, unit_tet, unit_tri, and unit_wdg.

Referenced by unit_element().

{
    for( unsigned i = 0; i < MIXED; ++i )
        ptr[i] = 0;

    init_tri( unit_tri, 2.0 * pow( 3.0, -0.25 ) );
    init_tet( unit_tet, MBMesquite::cbrt( 3.0 ) * sqrt( 2.0 ) );
    init_pyr( unit_pyr, pow( 18.0, 1.0 / 6.0 ) );
    init_wdg( unit_wdg, MBMesquite::cbrt( 4.0 ) * pow( 3.0, -1.0 / 6.0 ) );
    init_hex_pyr( unit_hex_pyr, MBMesquite::cbrt( 3.0 ) );

    ptr[TRIANGLE]      = unit_tri;
    ptr[QUADRILATERAL] = unit_quad;
    ptr[TETRAHEDRON]   = unit_tet;
    ptr[PYRAMID]       = unit_pyr;
    ptr[PRISM]         = unit_wdg;
    ptr[HEXAHEDRON]    = unit_hex;
    ptr[MIXED]         = unit_hex_pyr;
    return ptr;
}
static void MBMesquite::init_wdg ( Vector3D *  coords,
double  side 
) [static]

Definition at line 151 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

{
    const double third_height = side * sqrt( 3.0 ) / 6.0;
    coords[0]                 = Vector3D( -0.5 * side, -third_height, -0.5 * side );
    coords[1]                 = Vector3D( 0.5 * side, -third_height, -0.5 * side );
    coords[2]                 = Vector3D( 0.0, 2 * third_height, -0.5 * side );
    coords[3]                 = Vector3D( -0.5 * side, -third_height, 0.5 * side );
    coords[4]                 = Vector3D( 0.5 * side, -third_height, 0.5 * side );
    coords[5]                 = Vector3D( 0.0, 2 * third_height, 0.5 * side );
}
double MBMesquite::inner ( const Vector3D  lhs[],
const Vector3D  rhs[],
int  n 
) [inline]

Dot product for arrays of Vector3Ds. see also operator% .

Definition at line 344 of file Vector3D.hpp.

References moab::dot(), and n.

Referenced by MBMesquite::MsqHessian::cg_solver(), do_smoother(), main(), MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::FeasibleNewton::optimize_vertex_positions(), run(), run_quality_optimizer(), MBMesquite::LaplaceWrapper::run_wrapper(), MBMesquite::UntangleWrapper::run_wrapper(), MBMesquite::DeformingDomainWrapper::run_wrapper(), and TerminationCriterionTest::test_abs_vtx_movement_culling().

{
    int i;
    double dot = 0;
    for( i = 0; i < n; ++i )
        dot += lhs[i].mCoords[0] * rhs[i].mCoords[0] + lhs[i].mCoords[1] * rhs[i].mCoords[1] +
               lhs[i].mCoords[2] * rhs[i].mCoords[2];
    return dot;
}
double MBMesquite::inner ( const std::vector< Vector3D > &  lhs,
const std::vector< Vector3D > &  rhs 
) [inline]

Dot product for arrays of Vector3Ds. see also operator% .

Definition at line 354 of file Vector3D.hpp.

References moab::dot().

{
    double dot = 0;
    assert( lhs.size() == rhs.size() );
    for( size_t i = 0; i < lhs.size(); ++i )
        dot = lhs[i] % rhs[i];
    return dot;
}
double MBMesquite::inner_product ( const Vector3D *  v1,
const Vector3D *  v2,
size_t  n 
) [inline]

Definition at line 406 of file Vector3D.hpp.

References n.

{
    double result             = 0.0;
    const Vector3D* const end = v1 + n;
    while( v1 < end )
    {
        result += *v1 % *v2;
        ++v1;
        ++v2;
    }
    return result;
}
template<unsigned R, unsigned C>
double MBMesquite::inner_product ( const MsqMatrix< R, C > &  m1,
const MsqMatrix< R, C > &  m2 
) [inline]

Definition at line 1159 of file MsqMatrix.hpp.

References C, and moab::R.

Referenced by operator%().

{
    double result = 0.0;
    for( unsigned r = 0; r < R; ++r )
        for( unsigned c = 0; c < C; ++c )
            result += m1( r, c ) * m2( r, c );
    return result;
}
void MBMesquite::inv ( Matrix3D &  Ainv,
const Matrix3D &  A 
) [inline]

Definition at line 811 of file Matrix3D.hpp.

References det(), and MBMesquite::Matrix3D::v_.

Referenced by average_corner_diagonals(), MBMesquite::AveragingQM::average_corner_hessians(), main(), obbox_calc_2(), obbox_calc_3(), moab::HomCoord::operator/=(), pmean_corner_diagonals(), pmean_corner_hessians(), test_inversion(), timesInvA(), tinyla_solve_2(), and tinyla_solve_3().

{
    double inv_detA = 1.0 / ( det( A ) );
    // First row of Ainv
    Ainv.v_[0] = inv_detA * ( A.v_[4] * A.v_[8] - A.v_[5] * A.v_[7] );
    Ainv.v_[1] = inv_detA * ( A.v_[2] * A.v_[7] - A.v_[8] * A.v_[1] );
    Ainv.v_[2] = inv_detA * ( A.v_[1] * A.v_[5] - A.v_[4] * A.v_[2] );
    // Second row of Ainv
    Ainv.v_[3] = inv_detA * ( A.v_[5] * A.v_[6] - A.v_[8] * A.v_[3] );
    Ainv.v_[4] = inv_detA * ( A.v_[0] * A.v_[8] - A.v_[6] * A.v_[2] );
    Ainv.v_[5] = inv_detA * ( A.v_[2] * A.v_[3] - A.v_[5] * A.v_[0] );
    // Third row of Ainv
    Ainv.v_[6] = inv_detA * ( A.v_[3] * A.v_[7] - A.v_[6] * A.v_[4] );
    Ainv.v_[7] = inv_detA * ( A.v_[1] * A.v_[6] - A.v_[7] * A.v_[0] );
    Ainv.v_[8] = inv_detA * ( A.v_[0] * A.v_[4] - A.v_[3] * A.v_[1] );
}
SymMatrix3D MBMesquite::inverse ( const SymMatrix3D &  a) [inline]

Definition at line 241 of file SymMatrix3D.hpp.

References det().

{
    SymMatrix3D result( a[3] * a[5] - a[4] * a[4], a[2] * a[4] - a[1] * a[5], a[1] * a[4] - a[2] * a[3],
                        a[0] * a[5] - a[2] * a[2], a[1] * a[2] - a[0] * a[4], a[0] * a[3] - a[1] * a[1] );
    result /= det( a );
    return result;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::inverse ( const MsqMatrix< R, C > &  m) [inline]
static bool MBMesquite::is_side_boundary ( MeshImplData *  myMesh,
size_t  elem,
unsigned  side_dim,
unsigned  side_num,
MsqError &  err 
) [static]

Helper function for MeshImpl::mark_skin_fixed.

Definition at line 212 of file MeshImpl.cpp.

References arrptr(), compare_sides(), conn, MBMesquite::MeshImplData::element_connectivity(), MBMesquite::MeshImplData::element_topology(), MSQ_ERRZERO, n, and MBMesquite::MeshImplData::vertex_adjacencies().

Referenced by MBMesquite::MeshImpl::set_skin_flags().

{
    // Get the vertices of the side as indices into the above 'verts' list.
    const EntityTopology type = myMesh->element_topology( elem, err );
    MSQ_ERRZERO( err );
    unsigned n;  // number of vertices
    const unsigned* conn = TopologyInfo::side_vertices( type, side_dim, side_num, n, err );
    MSQ_ERRZERO( err );

    // start with the assumption that the side is on the bounary
    bool boundary = true;

    // get vertices in element connectivity
    const std::vector< size_t >& verts = myMesh->element_connectivity( elem, err );
    MSQ_ERRZERO( err );

    // Choose one vertex in face, and get adjacent elements to that vertex
    const std::vector< size_t >& elems = myMesh->vertex_adjacencies( verts[conn[0]], err );
    MSQ_ERRZERO( err );

    // For each adjacent element
    for( unsigned i = 0; i < elems.size(); ++i )
    {
        // we want *other* adjacent elements
        if( elems[i] == elem ) continue;

        // skip elements of smaller dimension
        EntityTopology type2 = myMesh->element_topology( elems[i], err );
        if( TopologyInfo::dimension( type2 ) <= side_dim ) continue;

        // get number of 'sides' of the appropriate dimension.
        const std::vector< size_t >& verts2 = myMesh->element_connectivity( elems[i], err );
        MSQ_ERRZERO( err );
        int sides2 = TopologyInfo::adjacent( type2, side_dim );
        for( int j = 0; j < sides2; ++j )
        {
            if( TopologyInfo::compare_sides( (const size_t*)arrptr( verts ), type, side_num,
                                             (const size_t*)arrptr( verts2 ), type2, j, side_dim, err ) )
                boundary = false;
            MSQ_ERRZERO( err );
        }
    }

    return boundary;
}
double MBMesquite::length ( const Vector3D *  v,
int  n 
) [inline]

Definition at line 434 of file Vector3D.hpp.

References length_squared().

{
    return std::sqrt( length_squared( v, n ) );
}
double MBMesquite::length ( const std::vector< Vector3D > &  v) [inline]

Definition at line 438 of file Vector3D.hpp.

References length_squared().

{
    return std::sqrt( length_squared( v ) );
}
template<unsigned R>
double MBMesquite::length ( const MsqMatrix< R, 1 > &  v) [inline]

Definition at line 1147 of file MsqMatrix.hpp.

References Frobenius().

Referenced by MBMesquite::TargetCalculator::aspect(), MBMesquite::RefSizeTargetCalculator::average_edge_length(), MBMesquite::MsqHessian::cg_solver(), MBMesquite::NonSmoothDescent::check_equilibrium(), MBMesquite::CompareQM::check_grad(), check_no_zeros(), check_results(), TargetCalculatorTest::check_valid_Q(), MBMesquite::MsqCircle::closest(), compare_nodes(), MBMesquite::MsqMeshEntity::compute_corner_normals(), MBMesquite::MsqMeshEntity::compute_unsigned_area(), MBMesquite::BoundedCylinderDomain::create_curve(), MBMesquite::MsqSphere::distance(), elem_areas(), MBMesquite::CylinderDomain::evaluate(), MBMesquite::TargetCalculator::factor_2D(), MBMesquite::TargetCalculator::factor_3D(), MBMesquite::TargetCalculator::factor_surface(), get_edge_lengths(), MBMesquite::TagVertexMesh::initialize(), lenfunc(), main(), MBMesquite::TargetCalculator::new_orientation_2D(), MBMesquite::TargetCalculator::new_orientation_3D(), MBMesquite::Vector3D::operator~(), MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::FeasibleNewton::optimize_vertex_positions(), project_to_matrix_plane(), project_to_perp_plane(), randomize_vertex(), MBMesquite::TargetCalculator::shape(), MBMesquite::TargetCalculator::size(), MBMesquite::TargetCalculator::skew(), MBMesquite::DeformingCurveSmoother::store_initial_mesh(), surface_to_2d(), MBMesquite::MsqIMesh::tag_create(), MBMesquite::MsqMOAB::tag_create(), SphericalDomainTest::test_fit_vertices(), MeshUtilTest::test_lambda_distribution(), IdealElementTest::test_side_height_pyr(), MBMesquite::CircleDomainTest::test_snap_to(), MBMesquite::LineDomainTest::test_snap_to(), GeomPrimTest::test_sphere_intersect_sphere(), QualityAssessorTest::test_tag_element(), QualityAssessorTest::test_tag_inverted(), QualityAssessorTest::test_tag_vertex(), HigherOrderTest::test_tri_slac(), IdealElementTest::test_unit_height_pyr(), IdealElementTest::test_unit_pyr(), IdealElementTest::test_unit_quad(), IdealElementTest::test_unit_tri(), test_value(), MsqMatrixTest::test_vec_length(), CylinderDomainTest::test_x_snap_to(), CylinderDomainTest::test_z_snap_to(), iMeshTest::testDoubleTag(), iMeshTest::testIntTag(), MBMesquite::MsqCircle::three_point(), MBMesquite::MsqCircle::two_point(), and MBMesquite::SphericalDomain::vertex_normal_at().

{
    return Frobenius( v );
}
template<unsigned C>
double MBMesquite::length ( const MsqMatrix< 1, C > &  v) [inline]

Definition at line 1153 of file MsqMatrix.hpp.

References Frobenius().

{
    return Frobenius( v );
}
double MBMesquite::length_squared ( const std::vector< Vector3D > &  v) [inline]

Definition at line 426 of file Vector3D.hpp.

References length_squared(), and moab::sum().

{
    double sum = 0.0;
    for( size_t i = 0; i < v.size(); ++i )
        sum += v[i].length_squared();
    return sum;
}
double MBMesquite::Linf ( const Vector3D *  v,
int  n 
) [inline]

Definition at line 443 of file Vector3D.hpp.

References n.

Referenced by MBMesquite::TerminationCriterion::accumulate_inner(), maxfunc(), MBMesquite::ConjugateGradient::optimize_vertex_positions(), and MBMesquite::TerminationCriterion::reset_inner().

{
    double max = 0;
    // loop over the length of the array
    for( int i = 0; i < n; ++i )
    {
        if( max < std::fabs( v[i][0] ) ) max = std::fabs( v[i][0] );
        if( max < std::fabs( v[i][1] ) ) max = std::fabs( v[i][1] );
        if( max < std::fabs( v[i][2] ) ) max = std::fabs( v[i][2] );
    }
    // return the value of the largest entry in the array
    return max;
}
double MBMesquite::Linf ( const std::vector< Vector3D > &  v) [inline]

Definition at line 457 of file Vector3D.hpp.

{
    double max = 0;
    // loop over the length of the array
    for( size_t i = 0; i < v.size(); ++i )
    {
        if( max < std::fabs( v[i][0] ) ) max = std::fabs( v[i][0] );
        if( max < std::fabs( v[i][1] ) ) max = std::fabs( v[i][1] );
        if( max < std::fabs( v[i][2] ) ) max = std::fabs( v[i][2] );
    }
    // return the value of the largest entry in the array
    return max;
}
bool MBMesquite::m_fcn_2e ( double &  obj,
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 132 of file MeanRatioFunctions.hpp.

References isqrt3, MSQ_MIN, and MBMesquite::Exponent::raise().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate().

{
    double matr[9], f;
    double g;

    /* Calculate M = [A*inv(W) n] */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - x[1][0] - x[0][0] ) * isqrt3;
    matr[2] = n[0];

    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - x[1][1] - x[0][1] ) * isqrt3;
    matr[5] = n[1];

    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - x[1][2] - x[0][2] ) * isqrt3;
    matr[8] = n[2];

    /* Calculate det(M). */
    g = matr[0] * ( matr[4] * matr[8] - matr[5] * matr[7] ) + matr[3] * ( matr[2] * matr[7] - matr[1] * matr[8] ) +
        matr[6] * ( matr[1] * matr[5] - matr[2] * matr[4] );
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[3] * matr[3] + matr[4] * matr[4] + matr[6] * matr[6] +
        matr[7] * matr[7];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );
    return true;
}
bool MBMesquite::m_fcn_2i ( double &  obj,
const Vector3D  x[3],
const Vector3D &  n,
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
) [inline]

Definition at line 565 of file MeanRatioFunctions.hpp.

References MSQ_MIN, and MBMesquite::Exponent::raise().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate().

{
    double matr[9];
    double f;
    double g;

    /* Calculate M = A*inv(W). */
    matr[0] = d[0] * ( x[1][0] - x[0][0] );
    matr[1] = d[1] * ( x[2][0] - x[0][0] );
    matr[2] = n[0];

    matr[3] = d[0] * ( x[1][1] - x[0][1] );
    matr[4] = d[1] * ( x[2][1] - x[0][1] );
    matr[5] = n[1];

    matr[6] = d[0] * ( x[1][2] - x[0][2] );
    matr[7] = d[1] * ( x[2][2] - x[0][2] );
    matr[8] = n[2];

    /* Calculate det(M). */
    g = matr[0] * ( matr[4] * matr[8] - matr[5] * matr[7] ) + matr[3] * ( matr[2] * matr[7] - matr[1] * matr[8] ) +
        matr[6] * ( matr[1] * matr[5] - matr[2] * matr[4] );
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[3] * matr[3] + matr[4] * matr[4] + matr[6] * matr[6] +
        matr[7] * matr[7];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );
    return true;
}
bool MBMesquite::m_fcn_3e ( double &  obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 971 of file MeanRatioFunctions.hpp.

References isqrt3, isqrt6, MSQ_MIN, and MBMesquite::Exponent::raise().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate().

{
    double matr[9], f;
    double g;

    /* Calculate M = A*inv(W). */
    f       = x[1][0] + x[0][0];
    matr[0] = x[1][0] - x[0][0];
    matr[1] = ( 2.0 * x[2][0] - f ) * isqrt3;
    matr[2] = ( 3.0 * x[3][0] - x[2][0] - f ) * isqrt6;

    f       = x[1][1] + x[0][1];
    matr[3] = x[1][1] - x[0][1];
    matr[4] = ( 2.0 * x[2][1] - f ) * isqrt3;
    matr[5] = ( 3.0 * x[3][1] - x[2][1] - f ) * isqrt6;

    f       = x[1][2] + x[0][2];
    matr[6] = x[1][2] - x[0][2];
    matr[7] = ( 2.0 * x[2][2] - f ) * isqrt3;
    matr[8] = ( 3.0 * x[3][2] - x[2][2] - f ) * isqrt6;

    /* Calculate det(M). */
    g = matr[0] * ( matr[4] * matr[8] - matr[5] * matr[7] ) + matr[1] * ( matr[5] * matr[6] - matr[3] * matr[8] ) +
        matr[2] * ( matr[3] * matr[7] - matr[4] * matr[6] );
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );
    return true;
}
bool MBMesquite::m_fcn_3i ( double &  obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c,
const Vector3D &  d 
) [inline]

Definition at line 1945 of file MeanRatioFunctions.hpp.

References MSQ_MIN, and MBMesquite::Exponent::raise().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate().

{
    double matr[9], f;
    double g;

    /* Calculate M = A*inv(W). */
    matr[0] = d[0] * ( x[1][0] - x[0][0] );
    matr[1] = d[1] * ( x[2][0] - x[0][0] );
    matr[2] = d[2] * ( x[3][0] - x[0][0] );

    matr[3] = d[0] * ( x[1][1] - x[0][1] );
    matr[4] = d[1] * ( x[2][1] - x[0][1] );
    matr[5] = d[2] * ( x[3][1] - x[0][1] );

    matr[6] = d[0] * ( x[1][2] - x[0][2] );
    matr[7] = d[1] * ( x[2][2] - x[0][2] );
    matr[8] = d[2] * ( x[3][2] - x[0][2] );

    /* Calculate det(M). */
    g = matr[0] * ( matr[4] * matr[8] - matr[5] * matr[7] ) + matr[1] * ( matr[5] * matr[6] - matr[3] * matr[8] ) +
        matr[2] * ( matr[3] * matr[7] - matr[4] * matr[6] );
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );
    return true;
}
bool MBMesquite::m_fcn_3p ( double &  obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 2492 of file MeanRatioFunctions.hpp.

References MSQ_MIN, and MBMesquite::Exponent::raise().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate(), MBMesquite::IdealWeightInverseMeanRatio::evaluate(), and h_fcn_3p().

{
    const double h = 0.5; /* h = 1 / (2*height) */

    double matr[9], f;
    double g;

    /* Calculate M = A*inv(W). */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = x[2][0] - x[0][0];
    matr[2] = ( 2.0 * x[3][0] - x[1][0] - x[2][0] ) * h;

    matr[3] = x[1][1] - x[0][1];
    matr[4] = x[2][1] - x[0][1];
    matr[5] = ( 2.0 * x[3][1] - x[1][1] - x[2][1] ) * h;

    matr[6] = x[1][2] - x[0][2];
    matr[7] = x[2][2] - x[0][2];
    matr[8] = ( 2.0 * x[3][2] - x[1][2] - x[2][2] ) * h;

    /* Calculate det(M). */
    g = matr[0] * ( matr[4] * matr[8] - matr[5] * matr[7] ) + matr[1] * ( matr[5] * matr[6] - matr[3] * matr[8] ) +
        matr[2] * ( matr[3] * matr[7] - matr[4] * matr[6] );
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );
    return true;
}
bool MBMesquite::m_fcn_3w ( double &  obj,
const Vector3D  x[4],
const double  a,
const Exponent &  b,
const Exponent &  c 
) [inline]

Definition at line 3091 of file MeanRatioFunctions.hpp.

References isqrt3, MSQ_MIN, and MBMesquite::Exponent::raise().

Referenced by MBMesquite::IdealWeightMeanRatio::evaluate(), and MBMesquite::IdealWeightInverseMeanRatio::evaluate().

{
    double matr[9], f, g;
    double loc1, loc2, loc3;

    /* Calculate M = A*inv(W). */
    matr[0] = x[1][0] - x[0][0];
    matr[1] = isqrt3 * ( 2 * x[2][0] - x[1][0] - x[0][0] );
    matr[2] = x[3][0] - x[0][0];

    matr[3] = x[1][1] - x[0][1];
    matr[4] = isqrt3 * ( 2 * x[2][1] - x[1][1] - x[0][1] );
    matr[5] = x[3][1] - x[0][1];

    matr[6] = x[1][2] - x[0][2];
    matr[7] = isqrt3 * ( 2 * x[2][2] - x[1][2] - x[0][2] );
    matr[8] = x[3][2] - x[0][2];

    /* Calculate det(M). */
    loc1 = matr[4] * matr[8] - matr[5] * matr[7];
    loc2 = matr[5] * matr[6] - matr[3] * matr[8];
    loc3 = matr[3] * matr[7] - matr[4] * matr[6];
    g    = matr[0] * loc1 + matr[1] * loc2 + matr[2] * loc3;
    if( g < MSQ_MIN )
    {
        obj = g;
        return false;
    }

    /* Calculate norm(M). */
    f = matr[0] * matr[0] + matr[1] * matr[1] + matr[2] * matr[2] + matr[3] * matr[3] + matr[4] * matr[4] +
        matr[5] * matr[5] + matr[6] * matr[6] + matr[7] * matr[7] + matr[8] * matr[8];

    /* Calculate objective function. */
    obj = a * b.raise( f ) * c.raise( g );
    return true;
}
void MBMesquite::matmult ( Matrix3D &  C,
const Matrix3D &  A,
const Matrix3D &  B 
) [inline]

\( C = A \times B \)

Definition at line 739 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::assign_product().

{
    C.assign_product( A, B );
}
void MBMesquite::move_vertex ( PatchData &  pd,
const Vector3D &  position,
const Vector3D &  delta,
MsqError &  err 
) [inline]

Definition at line 78 of file PatchDataInstances.hpp.

References CPPUNIT_ASSERT_EQUAL, MBMesquite::PatchData::get_vertex_array(), MBMesquite::PatchData::move_vertex(), and MBMesquite::PatchData::num_nodes().

Referenced by create_twelve_hex_patch_inverted().

{
    const MsqVertex* array = pd.get_vertex_array( err );
    if( err ) return;

    int idx = 0, cnt = 0;
    for( size_t i = 0; i < pd.num_nodes(); ++i )
        if( ( array[i] - position ).length_squared() < DBL_EPSILON )
        {
            idx = i;
            ++cnt;
        }

    CPPUNIT_ASSERT_EQUAL( cnt, 1 );

    pd.move_vertex( delta, idx, err );
}
static const char* MBMesquite::mpi_err_string ( int  error_code) [static]

Definition at line 71 of file ParallelHelper.cpp.

References buffer.

{
    static char buffer[128];
    int len = sizeof( buffer );
    int e   = MPI_Error_string( error_code, buffer, &len );
    if( MPI_SUCCESS != e ) len = 0;

    if( len >= (int)sizeof( buffer ) ) len = sizeof( buffer ) - 1;
    buffer[len] = '\0';
    return buffer;
}
template<class T >
T MBMesquite::MSQ_MAX_2 ( T  a,
T  b 
) [inline]

Definition at line 192 of file Mesquite.hpp.

References b.

{
    return a > b ? a : b;
}
template<class T >
T MBMesquite::MSQ_MIN_2 ( T  a,
T  b 
) [inline]

Definition at line 187 of file Mesquite.hpp.

References b.

{
    return a < b ? a : b;
}

Definition at line 40 of file MsqInterrupt.cpp.

References oldHandler, MBMesquite::MsqInterrupt::set_handler(), and MBMesquite::MsqInterrupt::set_interrupt().

Referenced by MBMesquite::MsqInterrupt::set_handler().

{
    MsqInterrupt::set_interrupt();
    if( oldHandler != SIG_DFL && oldHandler != SIG_IGN ) oldHandler( SIGINT );
    MsqInterrupt::set_handler();
}
const Matrix3D MBMesquite::mult_element ( const Matrix3D &  A,
const Matrix3D &  B 
) [inline]

Multiplies entry by entry. This is NOT a matrix multiplication.

Definition at line 477 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::equal_mult_elem().

Referenced by Matrix3DTest::test_mult_element().

{
    Matrix3D tmp( A );
    tmp.equal_mult_elem( B );
    return tmp;
}
template<unsigned R, unsigned RC, unsigned C>
double MBMesquite::multiply_helper_result_val ( unsigned  r,
unsigned  c,
const MsqMatrix< R, RC > &  A,
const MsqMatrix< RC, C > &  B 
) [inline]

Definition at line 914 of file MsqMatrix.hpp.

References RC.

Referenced by operator*().

{
    double tmp = A( r, 0 ) * B( 0, c );
    switch( RC )
    {
        default:
            for( unsigned k = 6; k < RC; ++k )
                tmp += A( r, k ) * B( k, c );
        case 6:
            tmp += A( r, 5 ) * B( 5, c );
        case 5:
            tmp += A( r, 4 ) * B( 4, c );
        case 4:
            tmp += A( r, 3 ) * B( 3, c );
        case 3:
            tmp += A( r, 2 ) * B( 2, c );
        case 2:
            tmp += A( r, 1 ) * B( 1, c );
        case 1:;
    }
    return tmp;
}
static void MBMesquite::my_quicksort ( int *  a,
size_t *  b,
MBMesquite::Mesh::VertexHandle c,
int  i,
int  j 
) [static]

Definition at line 129 of file ParallelHelper.cpp.

Referenced by MBMesquite::ParallelHelperImpl::smoothing_init().

{
    int in_i = i;
    int in_j = j;
    int wa;
    size_t wb;
    MBMesquite::Mesh::VertexHandle w1;
    int key = a[( i + j ) / 2];
    do
    {
        while( a[i] < key )
            i++;
        while( a[j] > key )
            j--;
        if( i < j )
        {
            wa   = a[i];
            a[i] = a[j];
            a[j] = wa;
            wb   = b[i];
            b[i] = b[j];
            b[j] = wb;
            w1   = c[i];
            c[i] = c[j];
            c[j] = w1;
        }
    } while( ++i <= --j );
    if( i == j + 3 )
    {
        i--;
        j++;
    }
    if( j > in_i ) my_quicksort( a, b, c, in_i, j );
    if( i < in_j ) my_quicksort( a, b, c, i, in_j );
}
static void MBMesquite::negate ( Vector3D *  out,
const Vector3D *  in,
size_t  nn 
) [inline, static]

Definition at line 97 of file TrustRegion.cpp.

Referenced by MBMesquite::LInfTemplate::evaluate(), and MBMesquite::TrustRegion::optimize_vertex_positions().

{
    for( size_t i = 0; i < nn; ++i )
        out[i] = -in[i];
}
static bool MBMesquite::next_vertex ( Mesh *  mesh,
Mesh::VertexHandle &  vtx,
std::set< Mesh::VertexHandle > &  unseen,
MsqError &  err 
) [static]

Definition at line 743 of file DomainClassifier.cpp.

References arrptr(), corners, edges, elem_types, MBMesquite::Mesh::elements_get_attached_vertices(), MBMesquite::Mesh::elements_get_topologies(), MSQ_ERRZERO, MBMesquite::Mesh::vertices_get_attached_elements(), and vtx().

Referenced by moab::ReadOBJ::create_new_vertex(), and MBMesquite::DomainClassifier::test_valid_classification().

{
    std::vector< Mesh::ElementHandle > vtx_elems;
    std::vector< size_t > junk;

    mesh->vertices_get_attached_elements( &vtx, 1, vtx_elems, junk, err );
    MSQ_ERRZERO( err );

    std::vector< EntityTopology > elem_types( vtx_elems.size() );
    if( !vtx_elems.empty() )
    {
        mesh->elements_get_topologies( arrptr( vtx_elems ), arrptr( elem_types ), vtx_elems.size(), err );
        MSQ_ERRZERO( err );
    }

    std::vector< Mesh::VertexHandle > corners;
    for( size_t j = 0; j < vtx_elems.size(); ++j )
    {
        corners.clear();
        mesh->elements_get_attached_vertices( &vtx_elems[j], 1, corners, junk, err );
        MSQ_ERRZERO( err );

        unsigned nedges = TopologyInfo::edges( elem_types[j] );
        unsigned vidx   = std::find( corners.begin(), corners.end(), vtx ) - corners.begin();

        // Check mid-edge nodes first, if present
        int ho = TopologyInfo::higher_order( elem_types[j], corners.size(), err );
        MSQ_ERRZERO( err );
        // If element has mid-edge nodes *and* current vertex is a corner vertex
        if( ( ho & 2 ) && ( vidx < TopologyInfo::corners( elem_types[j] ) ) )
        {
            for( unsigned e = 0; e < nedges; ++e )
            {
                const unsigned* edge_verts = TopologyInfo::edge_vertices( elem_types[j], e, err );
                MSQ_ERRZERO( err );
                if( edge_verts[0] == vidx || edge_verts[1] == vidx )
                {
                    int idx = TopologyInfo::higher_order_from_side( elem_types[j], corners.size(), 1, e, err );
                    MSQ_ERRZERO( err );
                    std::set< Mesh::VertexHandle >::iterator f = unseen.find( corners[idx] );
                    if( f != unseen.end() )
                    {
                        vtx = *f;
                        unseen.erase( f );
                        return true;
                    }
                }
            }
        }

        // if current vertx is a mid-edge node
        else if( ho & 2 )
        {
            unsigned d, e;
            TopologyInfo::side_from_higher_order( elem_types[j], corners.size(), vidx, d, e, err );
            MSQ_ERRZERO( err );
            if( d != 1 ) continue;
            const unsigned* edge_verts = TopologyInfo::edge_vertices( elem_types[j], e, err );
            MSQ_ERRZERO( err );
            for( int v = 0; v < 2; ++v )
            {
                std::set< Mesh::VertexHandle >::iterator f = unseen.find( corners[edge_verts[v]] );
                if( f != unseen.end() )
                {
                    vtx = *f;
                    unseen.erase( f );
                    return true;
                }
            }
        }

        else
        {
            for( unsigned e = 0; e < nedges; ++e )
            {
                const unsigned* edge_verts = TopologyInfo::edge_vertices( elem_types[j], e, err );
                MSQ_ERRZERO( err );
                int idx;
                if( edge_verts[0] == vidx )
                    idx = edge_verts[1];
                else if( edge_verts[1] == vidx )
                    idx = edge_verts[0];
                else
                    continue;

                std::set< Mesh::VertexHandle >::iterator f = unseen.find( corners[idx] );
                if( f != unseen.end() )
                {
                    vtx = *f;
                    unseen.erase( f );
                    return true;
                }
            }
        }
    }

    return false;
}
bool MBMesquite::operator!= ( const Matrix3D &  lhs,
const Matrix3D &  rhs 
) [inline]

Definition at line 409 of file Matrix3D.hpp.

{
    return !( lhs == rhs );
}
bool MBMesquite::operator!= ( const Vector3D &  v1,
const Vector3D &  v2 
) [inline]

Definition at line 492 of file Vector3D.hpp.

References MBMesquite::Vector3D::mCoords.

{
    return v1.mCoords[0] != v2.mCoords[0] || v1.mCoords[1] != v2.mCoords[1] || v1.mCoords[2] != v2.mCoords[2];
}
template<unsigned R, unsigned C>
bool MBMesquite::operator!= ( const MsqMatrix< R, C > &  A,
const MsqMatrix< R, C > &  B 
) [inline]

Definition at line 1112 of file MsqMatrix.hpp.

{
    return !( A == B );
}
double MBMesquite::operator% ( const Vector3D &  lhs,
const Vector3D &  rhs 
) [inline]

Definition at line 337 of file Vector3D.hpp.

References MBMesquite::Vector3D::mCoords.

{
    return ( lhs.mCoords[0] * rhs.mCoords[0] + lhs.mCoords[1] * rhs.mCoords[1] + lhs.mCoords[2] * rhs.mCoords[2] );
}
double MBMesquite::operator% ( const double  scalar,
const Vector3D &  rhs 
) [inline]

Definition at line 363 of file Vector3D.hpp.

References MBMesquite::Vector3D::mCoords.

{
    return ( scalar * ( rhs.mCoords[0] + rhs.mCoords[1] + rhs.mCoords[2] ) );
}
double MBMesquite::operator% ( const Vector3D &  lhs,
const double  scalar 
) [inline]

Definition at line 368 of file Vector3D.hpp.

References MBMesquite::Vector3D::mCoords.

{
    return ( scalar * ( lhs.mCoords[0] + lhs.mCoords[1] + lhs.mCoords[2] ) );
}
template<unsigned R, unsigned C>
double MBMesquite::operator% ( const MsqMatrix< R, C > &  v1,
const MsqMatrix< R, C > &  v2 
) [inline]

Definition at line 1217 of file MsqMatrix.hpp.

References inner_product().

{
    return inner_product( v1, v2 );
}
SymMatrix3D MBMesquite::operator* ( const SymMatrix3D &  a,
double  s 
) [inline]

Definition at line 180 of file SymMatrix3D.hpp.

{
    SymMatrix3D r( a );
    r *= s;
    return r;
}
SymMatrix3D MBMesquite::operator* ( double  s,
const SymMatrix3D &  a 
) [inline]

Definition at line 186 of file SymMatrix3D.hpp.

{
    SymMatrix3D r( a );
    r *= s;
    return r;
}
Vector3D MBMesquite::operator* ( const Vector3D &  v,
const SymMatrix3D &  m 
) [inline]

Definition at line 205 of file SymMatrix3D.hpp.

{
    return Vector3D( v[0] * m[0] + v[1] * m[1] + v[2] * m[2], v[0] * m[1] + v[1] * m[3] + v[2] * m[4],
                     v[0] * m[2] + v[1] * m[4] + v[2] * m[5] );
}
Vector3D MBMesquite::operator* ( const SymMatrix3D &  m,
const Vector3D &  v 
) [inline]

Definition at line 210 of file SymMatrix3D.hpp.

{
    return v * m;
}
const Vector3D MBMesquite::operator* ( const Vector3D &  lhs,
const double  scalar 
) [inline]

Definition at line 324 of file Vector3D.hpp.

References MBMesquite::Vector3D::x(), MBMesquite::Vector3D::y(), and MBMesquite::Vector3D::z().

{
    return Vector3D( lhs.x() * scalar, lhs.y() * scalar, lhs.z() * scalar );
}
const Vector3D MBMesquite::operator* ( const double  scalar,
const Vector3D &  rhs 
) [inline]

Definition at line 328 of file Vector3D.hpp.

References MBMesquite::Vector3D::x(), MBMesquite::Vector3D::y(), and MBMesquite::Vector3D::z().

{
    return Vector3D( rhs.x() * scalar, rhs.y() * scalar, rhs.z() * scalar );
}
const Vector3D MBMesquite::operator* ( const Vector3D &  lhs,
const Vector3D &  rhs 
) [inline]

Definition at line 373 of file Vector3D.hpp.

References MBMesquite::Vector3D::mCoords.

{
    return Vector3D( lhs.mCoords[1] * rhs.mCoords[2] - lhs.mCoords[2] * rhs.mCoords[1],
                     lhs.mCoords[2] * rhs.mCoords[0] - lhs.mCoords[0] * rhs.mCoords[2],
                     lhs.mCoords[0] * rhs.mCoords[1] - lhs.mCoords[1] * rhs.mCoords[0] );
}
const Matrix3D MBMesquite::operator* ( const Matrix3D &  A,
const Matrix3D &  B 
) [inline]
Returns:
A*B

Definition at line 665 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::assign_product().

{
    Matrix3D tmp;
    tmp.assign_product( A, B );
    return tmp;
}
const Matrix3D MBMesquite::operator* ( const Matrix3D &  A,
const SymMatrix3D &  B 
) [inline]

Definition at line 672 of file Matrix3D.hpp.

{
    return Matrix3D(
        A( 0, 0 ) * B[0] + A( 0, 1 ) * B[1] + A( 0, 2 ) * B[2], A( 0, 0 ) * B[1] + A( 0, 1 ) * B[3] + A( 0, 2 ) * B[4],
        A( 0, 0 ) * B[2] + A( 0, 1 ) * B[4] + A( 0, 2 ) * B[5],

        A( 1, 0 ) * B[0] + A( 1, 1 ) * B[1] + A( 1, 2 ) * B[2], A( 1, 0 ) * B[1] + A( 1, 1 ) * B[3] + A( 1, 2 ) * B[4],
        A( 1, 0 ) * B[2] + A( 1, 1 ) * B[4] + A( 1, 2 ) * B[5],

        A( 2, 0 ) * B[0] + A( 2, 1 ) * B[1] + A( 2, 2 ) * B[2], A( 2, 0 ) * B[1] + A( 2, 1 ) * B[3] + A( 2, 2 ) * B[4],
        A( 2, 0 ) * B[2] + A( 2, 1 ) * B[4] + A( 2, 2 ) * B[5] );
}
const Matrix3D MBMesquite::operator* ( const SymMatrix3D &  B,
const Matrix3D &  A 
) [inline]

Definition at line 685 of file Matrix3D.hpp.

{
    return Matrix3D(
        A( 0, 0 ) * B[0] + A( 1, 0 ) * B[1] + A( 2, 0 ) * B[2], A( 0, 1 ) * B[0] + A( 1, 1 ) * B[1] + A( 2, 1 ) * B[2],
        A( 0, 2 ) * B[0] + A( 1, 2 ) * B[1] + A( 2, 2 ) * B[2],

        A( 0, 0 ) * B[1] + A( 1, 0 ) * B[3] + A( 2, 0 ) * B[4], A( 0, 1 ) * B[1] + A( 1, 1 ) * B[3] + A( 2, 1 ) * B[4],
        A( 0, 2 ) * B[1] + A( 1, 2 ) * B[3] + A( 2, 2 ) * B[4],

        A( 0, 0 ) * B[2] + A( 1, 0 ) * B[4] + A( 2, 0 ) * B[5], A( 0, 1 ) * B[2] + A( 1, 1 ) * B[4] + A( 2, 1 ) * B[5],
        A( 0, 2 ) * B[2] + A( 1, 2 ) * B[4] + A( 2, 2 ) * B[5] );
}
const Matrix3D MBMesquite::operator* ( const SymMatrix3D &  a,
const SymMatrix3D &  b 
) [inline]

Definition at line 698 of file Matrix3D.hpp.

{
    return Matrix3D( a[0] * b[0] + a[1] * b[1] + a[2] * b[2], a[0] * b[1] + a[1] * b[3] + a[2] * b[4],
                     a[0] * b[2] + a[1] * b[4] + a[2] * b[5],

                     a[1] * b[0] + a[3] * b[1] + a[4] * b[2], a[1] * b[1] + a[3] * b[3] + a[4] * b[4],
                     a[1] * b[2] + a[3] * b[4] + a[4] * b[5],

                     a[2] * b[0] + a[4] * b[1] + a[5] * b[2], a[2] * b[1] + a[4] * b[3] + a[5] * b[4],
                     a[2] * b[2] + a[4] * b[4] + a[5] * b[5] );
}
const Matrix3D MBMesquite::operator* ( double  s,
const Matrix3D &  A 
) [inline]

friend function to allow for commutatative property of scalar mulitplication.

Definition at line 719 of file Matrix3D.hpp.

{
    return ( A.operator*( s ) );
}
const Vector3D MBMesquite::operator* ( const Matrix3D &  A,
const Vector3D &  x 
) [inline]

Computes \( A v \) .

Definition at line 745 of file Matrix3D.hpp.

References eqAx().

{
    Vector3D tmp;
    eqAx( tmp, A, x );
    return tmp;
}
const Vector3D MBMesquite::operator* ( const Vector3D &  x,
const Matrix3D &  A 
) [inline]

Computes \( v^T A \) .

This function implicitly considers the transpose of vector x times the matrix A and it is implicit that the returned vector must be transposed.

Definition at line 757 of file Matrix3D.hpp.

References eqTransAx().

{
    Vector3D tmp;
    eqTransAx( tmp, A, x );
    return tmp;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator* ( const MsqMatrix< R, C > &  m,
double  s 
) [inline]

Definition at line 898 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp *= s;
    return tmp;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator* ( double  s,
const MsqMatrix< R, C > &  m 
) [inline]

Definition at line 906 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp *= s;
    return tmp;
}
template<unsigned R, unsigned RC, unsigned C>
MsqMatrix< R, C > MBMesquite::operator* ( const MsqMatrix< R, RC > &  A,
const MsqMatrix< RC, C > &  B 
) [inline]

Definition at line 941 of file MsqMatrix.hpp.

References C, multiply_helper_result_val(), and moab::R.

{
    // MsqMatrix<R,C> result(0.0);
    // for (unsigned i = 0; i < R; ++i)
    //  for (unsigned j = 0; j < C; ++j)
    //    for (unsigned k = 0; k < RC; ++k)
    //      result(i,j) += A(i,k) * B(k,j);

    MsqMatrix< R, C > result;
    for( unsigned r = 0; r < R; ++r )
        for( unsigned c = 0; c < C; ++c )
            result( r, c ) = multiply_helper_result_val( r, c, A, B );

    return result;
}
double MBMesquite::operator* ( const MsqMatrix< 2, 1 > &  v1,
const MsqMatrix< 2, 1 > &  v2 
) [inline]

Definition at line 1222 of file MsqMatrix.hpp.

References vector_product().

{
    return vector_product( v1, v2 );
}
double MBMesquite::operator* ( const MsqMatrix< 1, 2 > &  v1,
const MsqMatrix< 1, 2 > &  v2 
) [inline]

Definition at line 1227 of file MsqMatrix.hpp.

References vector_product().

{
    return vector_product( v1, v2 );
}
MsqMatrix< 3, 1 > MBMesquite::operator* ( const MsqMatrix< 3, 1 > &  v1,
const MsqMatrix< 3, 1 > &  v2 
) [inline]

Definition at line 1232 of file MsqMatrix.hpp.

References vector_product().

{
    return vector_product( v1, v2 );
}
MsqMatrix< 1, 3 > MBMesquite::operator* ( const MsqMatrix< 1, 3 > &  v1,
const MsqMatrix< 1, 3 > &  v2 
) [inline]

Definition at line 1237 of file MsqMatrix.hpp.

References vector_product().

{
    return vector_product( v1, v2 );
}
SymMatrix3D MBMesquite::operator+ ( const SymMatrix3D &  a,
const SymMatrix3D &  b 
) [inline]

Definition at line 168 of file SymMatrix3D.hpp.

References b.

{
    SymMatrix3D r( a );
    r += b;
    return r;
}
const Vector3D MBMesquite::operator+ ( const Vector3D &  lhs,
const Vector3D &  rhs 
) [inline]

Definition at line 316 of file Vector3D.hpp.

References MBMesquite::Vector3D::x(), MBMesquite::Vector3D::y(), and MBMesquite::Vector3D::z().

{
    return Vector3D( lhs.x() + rhs.x(), lhs.y() + rhs.y(), lhs.z() + rhs.z() );
}
const Matrix3D MBMesquite::operator+ ( const Matrix3D &  A,
const Matrix3D &  B 
) [inline]
Returns:
A+B

Definition at line 420 of file Matrix3D.hpp.

{
    Matrix3D tmp( A );
    tmp += B;
    return tmp;
}
Matrix3D MBMesquite::operator+ ( const Matrix3D &  A,
const SymMatrix3D &  B 
) [inline]

Definition at line 427 of file Matrix3D.hpp.

References MBMesquite::SymMatrix3D::T00, MBMesquite::SymMatrix3D::T01, MBMesquite::SymMatrix3D::T02, MBMesquite::SymMatrix3D::T10, MBMesquite::SymMatrix3D::T11, MBMesquite::SymMatrix3D::T12, MBMesquite::SymMatrix3D::T20, MBMesquite::SymMatrix3D::T21, and MBMesquite::SymMatrix3D::T22.

{
    return Matrix3D( A( 0, 0 ) + B[SymMatrix3D::T00], A( 0, 1 ) + B[SymMatrix3D::T01], A( 0, 2 ) + B[SymMatrix3D::T02],
                     A( 1, 0 ) + B[SymMatrix3D::T10], A( 1, 1 ) + B[SymMatrix3D::T11], A( 1, 2 ) + B[SymMatrix3D::T12],
                     A( 2, 0 ) + B[SymMatrix3D::T20], A( 2, 1 ) + B[SymMatrix3D::T21],
                     A( 2, 2 ) + B[SymMatrix3D::T22] );
}
Matrix3D MBMesquite::operator+ ( const SymMatrix3D &  B,
const Matrix3D &  A 
) [inline]

Definition at line 434 of file Matrix3D.hpp.

{
    return A + B;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator+ ( const MsqMatrix< R, C > &  m,
double  s 
) [inline]

Definition at line 850 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp += s;
    return tmp;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator+ ( double  s,
const MsqMatrix< R, C > &  m 
) [inline]

Definition at line 858 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp += s;
    return tmp;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator+ ( const MsqMatrix< R, C > &  A,
const MsqMatrix< R, C > &  B 
) [inline]

Definition at line 866 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( A );
    tmp += B;
    return tmp;
}
SymMatrix3D MBMesquite::operator- ( const SymMatrix3D &  m) [inline]

Definition at line 118 of file SymMatrix3D.hpp.

References MBMesquite::SymMatrix3D::T00, MBMesquite::SymMatrix3D::T01, MBMesquite::SymMatrix3D::T02, MBMesquite::SymMatrix3D::T11, MBMesquite::SymMatrix3D::T12, and MBMesquite::SymMatrix3D::T22.

{
    return SymMatrix3D( -m[SymMatrix3D::T00], -m[SymMatrix3D::T01], -m[SymMatrix3D::T02], -m[SymMatrix3D::T11],
                        -m[SymMatrix3D::T12], -m[SymMatrix3D::T22] );
}
SymMatrix3D MBMesquite::operator- ( const SymMatrix3D &  a,
const SymMatrix3D &  b 
) [inline]

Definition at line 174 of file SymMatrix3D.hpp.

References b.

{
    SymMatrix3D r( a );
    r -= b;
    return r;
}
const Vector3D MBMesquite::operator- ( const Vector3D &  lhs,
const Vector3D &  rhs 
) [inline]

Definition at line 320 of file Vector3D.hpp.

References MBMesquite::Vector3D::x(), MBMesquite::Vector3D::y(), and MBMesquite::Vector3D::z().

{
    return Vector3D( lhs.x() - rhs.x(), lhs.y() - rhs.y(), lhs.z() - rhs.z() );
}
Matrix3D MBMesquite::operator- ( const Matrix3D &  A) [inline]

Definition at line 414 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::v_.

{
    return Matrix3D( -A.v_[0], -A.v_[1], -A.v_[2], -A.v_[3], -A.v_[4], -A.v_[5], -A.v_[6], -A.v_[7], -A.v_[8] );
}
const Matrix3D MBMesquite::operator- ( const Matrix3D &  A,
const Matrix3D &  B 
) [inline]
Returns:
A-B

Definition at line 440 of file Matrix3D.hpp.

{
    Matrix3D tmp( A );
    tmp -= B;
    return tmp;
}
Matrix3D MBMesquite::operator- ( const Matrix3D &  A,
const SymMatrix3D &  B 
) [inline]

Definition at line 447 of file Matrix3D.hpp.

References MBMesquite::SymMatrix3D::T00, MBMesquite::SymMatrix3D::T01, MBMesquite::SymMatrix3D::T02, MBMesquite::SymMatrix3D::T10, MBMesquite::SymMatrix3D::T11, MBMesquite::SymMatrix3D::T12, MBMesquite::SymMatrix3D::T20, MBMesquite::SymMatrix3D::T21, and MBMesquite::SymMatrix3D::T22.

{
    return Matrix3D( A( 0, 0 ) - B[SymMatrix3D::T00], A( 0, 1 ) - B[SymMatrix3D::T01], A( 0, 2 ) - B[SymMatrix3D::T02],
                     A( 1, 0 ) - B[SymMatrix3D::T10], A( 1, 1 ) - B[SymMatrix3D::T11], A( 1, 2 ) - B[SymMatrix3D::T12],
                     A( 2, 0 ) - B[SymMatrix3D::T20], A( 2, 1 ) - B[SymMatrix3D::T21],
                     A( 2, 2 ) - B[SymMatrix3D::T22] );
}
Matrix3D MBMesquite::operator- ( const SymMatrix3D &  B,
const Matrix3D &  A 
) [inline]

Definition at line 454 of file Matrix3D.hpp.

References MBMesquite::SymMatrix3D::T00, MBMesquite::SymMatrix3D::T01, MBMesquite::SymMatrix3D::T02, MBMesquite::SymMatrix3D::T10, MBMesquite::SymMatrix3D::T11, MBMesquite::SymMatrix3D::T12, MBMesquite::SymMatrix3D::T20, MBMesquite::SymMatrix3D::T21, and MBMesquite::SymMatrix3D::T22.

{
    return Matrix3D( B[SymMatrix3D::T00] - A( 0, 0 ), B[SymMatrix3D::T01] - A( 0, 1 ), B[SymMatrix3D::T02] - A( 0, 2 ),
                     B[SymMatrix3D::T10] - A( 1, 0 ), B[SymMatrix3D::T11] - A( 1, 1 ), B[SymMatrix3D::T12] - A( 1, 2 ),
                     B[SymMatrix3D::T20] - A( 2, 0 ), B[SymMatrix3D::T21] - A( 2, 1 ),
                     B[SymMatrix3D::T22] - A( 2, 2 ) );
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator- ( const MsqMatrix< R, C > &  m) [inline]

Definition at line 841 of file MsqMatrix.hpp.

References C, MBMesquite::MsqMatrix< R, C >::data(), and moab::R.

{
    MsqMatrix< R, C > result;
    for( unsigned i = 0; i < R * C; ++i )
        result.data()[i] = -m.data()[i];
    return result;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator- ( const MsqMatrix< R, C > &  m,
double  s 
) [inline]

Definition at line 874 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp -= s;
    return tmp;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator- ( double  s,
const MsqMatrix< R, C > &  m 
) [inline]

Definition at line 882 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp -= s;
    return tmp;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator- ( const MsqMatrix< R, C > &  A,
const MsqMatrix< R, C > &  B 
) [inline]

Definition at line 890 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( A );
    tmp -= B;
    return tmp;
}
SymMatrix3D MBMesquite::operator/ ( const SymMatrix3D &  a,
double  s 
) [inline]

Definition at line 192 of file SymMatrix3D.hpp.

{
    SymMatrix3D r( a );
    r /= s;
    return r;
}
SymMatrix3D MBMesquite::operator/ ( double  s,
const SymMatrix3D &  a 
) [inline]

Definition at line 198 of file SymMatrix3D.hpp.

{
    SymMatrix3D r( a );
    r /= s;
    return r;
}
const Vector3D MBMesquite::operator/ ( const Vector3D &  lhs,
const double  scalar 
) [inline]

Definition at line 332 of file Vector3D.hpp.

References MBMesquite::Vector3D::x(), MBMesquite::Vector3D::y(), and MBMesquite::Vector3D::z().

{
    assert( scalar != 0 );
    return Vector3D( lhs.x() / scalar, lhs.y() / scalar, lhs.z() / scalar );
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::operator/ ( const MsqMatrix< R, C > &  m,
double  s 
) [inline]

Definition at line 958 of file MsqMatrix.hpp.

{
    MsqMatrix< R, C > tmp( m );
    tmp /= s;
    return tmp;
}
bool MBMesquite::operator< ( const EdgeData &  e1,
const EdgeData &  e2 
) [inline]

Definition at line 60 of file EdgeQM.cpp.

References MBMesquite::EdgeData::endVtx.

{
    return e1.endVtx < e2.endVtx;
}
bool MBMesquite::operator< ( const EdgeIterator::Edge &  e1,
const EdgeIterator::Edge &  e2 
) [inline]

Definition at line 69 of file EdgeIterator.hpp.

References MBMesquite::EdgeIterator::Edge::midVertex, and MBMesquite::EdgeIterator::Edge::otherVertex.

{
    return e1.otherVertex < e2.otherVertex || ( e1.otherVertex == e2.otherVertex && e1.midVertex < e2.midVertex );
}
static bool MBMesquite::operator< ( const Mesh::EntityHandle  h,
const DomainClassifier::DomainBlock &  b 
) [inline, static]

Definition at line 1164 of file DomainClassifier.cpp.

References MBMesquite::DomainClassifier::DomainBlock::firstHandle.

{
    return h < b.firstHandle;
}
static bool MBMesquite::operator< ( const DomainClassifier::DomainBlock &  b,
const Mesh::EntityHandle  h 
) [inline, static]

Definition at line 1169 of file DomainClassifier.cpp.

References MBMesquite::DomainClassifier::DomainBlock::lastHandle.

{
    return b.lastHandle < h;
}
static bool MBMesquite::operator< ( const DomainClassifier::DomainBlock &  b,
const DomainClassifier::DomainBlock &  c 
) [inline, static]

Definition at line 1174 of file DomainClassifier.cpp.

References MBMesquite::DomainClassifier::DomainBlock::firstHandle, and MBMesquite::DomainClassifier::DomainBlock::lastHandle.

{
    return b.lastHandle < c.firstHandle;
}
std::ostream & MBMesquite::operator<< ( std::ostream &  str,
Sample  s 
)

Definition at line 38 of file Sample.cpp.

References MBMesquite::Sample::dimension, and MBMesquite::Sample::number.

{
    return str << s.dimension << '-' << s.number;
}
std::ostream & MBMesquite::operator<< ( std::ostream &  s,
NodeSet  set 
)

Print bits in reverse order (least-signficant to most-significant, or corner 0 to mid-region).

Definition at line 39 of file NodeSet.cpp.

References MBMesquite::NodeSet::NUM_CORNER_BITS, MBMesquite::NodeSet::NUM_EDGE_BITS, MBMesquite::NodeSet::NUM_FACE_BITS, and MBMesquite::NodeSet::NUM_REGION_BITS.

{
    unsigned i;
    s << '{';
    for( i = 0; i < NodeSet::NUM_CORNER_BITS; ++i )
        s << ( set.corner_node( i ) ? '1' : '0' );
    s << ' ';
    for( i = 0; i < NodeSet::NUM_EDGE_BITS; ++i )
        s << ( set.mid_edge_node( i ) ? '1' : '0' );
    s << ' ';
    for( i = 0; i < NodeSet::NUM_FACE_BITS; ++i )
        s << ( set.mid_face_node( i ) ? '1' : '0' );
    s << ' ';
    for( i = 0; i < NodeSet::NUM_REGION_BITS; ++i )
        s << ( set.mid_region_node( i ) ? '1' : '0' );
    s << '}';
    return s;
}
MESQUITE_EXPORT std::ostream & MBMesquite::operator<< ( std::ostream &  s,
const MBMesquite::Vector3D v 
)

Definition at line 42 of file Vector3D.cpp.

{
    return s << v[0] << ' ' << v[1] << ' ' << v[2];
}
std::ostream & MBMesquite::operator<< ( std::ostream &  str,
MBMesquite::StopWatchCollection coll 
)

Definition at line 279 of file MsqTimer.cpp.

References MBMesquite::StopWatchCollection::get_keys_sorted_by_time(), MBMesquite::StopWatchCollection::get_string(), MBMesquite::StopWatchCollection::number_of_starts(), and MBMesquite::StopWatchCollection::total_time().

{
    std::vector< MBMesquite::StopWatchCollection::Key > sorted_keys;
    MBMesquite::GlobalStopWatches.get_keys_sorted_by_time( sorted_keys );
    int number_of_keys = sorted_keys.size();
    int i              = 0;
    str << "\nTIME        | NUM. STARTS | TIMER NAME (" << number_of_keys << " timers)\n";
    for( i = 0; i < number_of_keys; ++i )
    {
        str << std::setiosflags( std::ios::left ) << std::setw( 13 )
            << MBMesquite::GlobalStopWatches.total_time( sorted_keys[i] ) << " " << std::setw( 13 )
            << MBMesquite::GlobalStopWatches.number_of_starts( sorted_keys[i] ) << " "
            << MBMesquite::GlobalStopWatches.get_string( sorted_keys[i] ) << std::endl;
    }
    return str;
}
std::ostream& MBMesquite::operator<< ( std::ostream &  s,
const Matrix3D &  A 
) [inline]

Definition at line 373 of file Matrix3D.hpp.

{
    for( size_t i = 0; i < 3; ++i )
    {
        for( size_t j = 0; j < 3; ++j )
            s << A[i][j] << " ";
        s << "\n";
    }
    return s;
}
ostream& MBMesquite::operator<< ( ostream &  stream,
const MsqMeshEntity &  entity 
)

Definition at line 395 of file MsqMeshEntity.cpp.

References MBMesquite::MsqMeshEntity::vertex_count(), and MBMesquite::MsqMeshEntity::vertexIndices.

{
    size_t num_vert = entity.vertex_count();
    stream << "MsqMeshEntity " << &entity << " with vertices ";
    for( size_t i = 0; i < num_vert; ++i )
        stream << entity.vertexIndices[i] << " ";
    stream << endl;
    return stream;
}
std::ostream & MBMesquite::operator<< ( std::ostream &  s,
const MsqHessian &  h 
)

Prints out the MsqHessian blocks.

Definition at line 627 of file MsqHessian.cpp.

References MBMesquite::MsqHessian::mColIndex, MBMesquite::MsqHessian::mEntries, MBMesquite::MsqHessian::mRowStart, and MBMesquite::MsqHessian::mSize.

{
    size_t i, j;
    s << "MsqHessian of size: " << h.mSize << "x" << h.mSize << "\n";
    for( i = 0; i < h.mSize; ++i )
    {
        s << " ROW " << i << " ------------------------\n";
        for( j = h.mRowStart[i]; j < h.mRowStart[i + 1]; ++j )
        {
            s << "   column " << h.mColIndex[j] << " ----\n";
            s << h.mEntries[j];
        }
    }
    return s;
}
template<unsigned R, unsigned C>
std::ostream& MBMesquite::operator<< ( std::ostream &  str,
const MsqMatrix< R, C > &  m 
) [inline]

Definition at line 1118 of file MsqMatrix.hpp.

References C, and moab::R.

{
    str << m.data()[0];
    for( unsigned i = 1; i < R * C; ++i )
        str << ' ' << m.data()[i];
    return str;
}
ostream& MBMesquite::operator<< ( ostream &  stream,
const PatchData &  pd 
)

Definition at line 1401 of file PatchData.cpp.

References MBMesquite::PatchData::AVERAGE_DET3D, MBMesquite::PatchData::computedInfos, MBMesquite::PatchData::elementArray, MBMesquite::PatchData::elementHandlesArray, MBMesquite::PatchData::have_computed_info(), MBMesquite::PatchData::haveComputedInfos, MBMesquite::PatchData::MAX_EDGE_LENGTH, MBMesquite::PatchData::MAX_UNSIGNED_AREA, MBMesquite::PatchData::MIN_EDGE_LENGTH, MBMesquite::PatchData::MIN_UNSIGNED_AREA, MBMesquite::PatchData::MINMAX_SIGNED_DET2D, MBMesquite::PatchData::MINMAX_SIGNED_DET3D, MBMesquite::MsqVertex::MSQ_CULLED, MBMesquite::MsqVertex::MSQ_DEPENDENT, MBMesquite::MsqVertex::MSQ_HARD_FIXED, MBMesquite::MsqVertex::MSQ_MARK, MBMesquite::MsqVertex::MSQ_PATCH_FIXED, MBMesquite::PatchData::myDomain, MBMesquite::PatchData::myMesh, MBMesquite::PatchData::num_elements(), MBMesquite::PatchData::num_nodes(), MBMesquite::PatchData::vertAdjacencyArray, MBMesquite::PatchData::vertAdjacencyOffsets, MBMesquite::PatchData::vertexArray, MBMesquite::PatchData::vertexHandlesArray, and width().

{
    size_t i;
    int fw = 5;  // width of bit flags
    int hw = 6;  // width of a handle
    int cw = 4;  // with of a coordinate value
    int iw = 3;  // with of an index
    int tw = 3;  // with of the string name of an element type
    int xw = cw, yw = cw, zw = cw;

    for( i = 0; i < pd.num_nodes(); ++i )
    {
        int w = 2 + width( pd.vertexHandlesArray[i] );
        if( w > hw ) hw = w;
        w = width( pd.vertexArray[i].x() );
        if( w > xw ) xw = w;
        w = width( pd.vertexArray[i].y() );
        if( w > yw ) yw = w;
        w = width( pd.vertexArray[i].z() );
        if( w > zw ) zw = w;
    }
    for( i = 0; i < pd.num_elements(); ++i )
    {
        int w = 2 + width( pd.elementHandlesArray[i] );
        if( w > hw ) hw = w;
        const char* name = TopologyInfo::short_name( pd.elementArray[i].get_element_type() );
        if( name && (int)strlen( name ) > tw ) tw = strlen( name );
    }
    if( iw < (int)ceil( log10( (double)( 1 + pd.num_nodes() ) ) ) )
        iw = (int)ceil( log10( (double)( 1 + pd.num_nodes() ) ) );
    if( iw < (int)ceil( log10( (double)( 1 + pd.num_elements() ) ) ) )
        iw = (int)ceil( log10( (double)( 1 + pd.num_elements() ) ) );

    stream << "Vertices: " << endl;
    stream << "Flags: C: culled, F: fixed, S: slave, P: patch vertex, M: marked" << endl;
    stream << setw( iw ) << "Idx"
           << " " << setw( hw ) << "Handle"
           << " " << setw( cw ) << "X"
           << "," << setw( cw ) << "Y"
           << "," << setw( cw ) << "Z"
           << " " << setw( fw ) << "Flags"
           << " "
           << "Adj.Elems" << endl
           << setw( iw ) << setfill( '-' ) << ""
           << " " << setw( hw ) << setfill( '-' ) << ""
           << " " << setw( cw ) << setfill( '-' ) << ""
           << "," << setw( cw ) << setfill( '-' ) << ""
           << "," << setw( cw ) << setfill( '-' ) << ""
           << " " << setw( fw ) << setfill( '-' ) << ""
           << " " << setfill( ' ' ) << "-------------" << std::endl;
    for( i = 0; i < pd.num_nodes(); ++i )
    {
        stream << setw( iw ) << i << " " << setw( hw ) << pd.vertexHandlesArray[i] << " " << setw( cw )
               << pd.vertexArray[i].x() << "," << setw( cw ) << pd.vertexArray[i].y() << "," << setw( cw )
               << pd.vertexArray[i].z() << " ";
        if( pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_CULLED ) )
            stream << "C";
        else
            stream << " ";
        if( pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_HARD_FIXED ) )
            stream << "F";
        else
            stream << " ";
        if( pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_DEPENDENT ) )
            stream << "S";
        else
            stream << " ";
        if( pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_PATCH_FIXED ) )
            stream << "f";
        else
            stream << " ";
        if( pd.vertexArray[i].is_flag_set( MsqVertex::MSQ_MARK ) )
            stream << "M";
        else
            stream << " ";

        if( pd.vertAdjacencyArray.size() )
        {
            size_t j   = pd.vertAdjacencyOffsets[i];
            size_t end = pd.vertAdjacencyOffsets[i + 1];
            if( j != end ) stream << " " << pd.vertAdjacencyArray[j++];
            for( ; j < end; ++j )
                stream << "," << pd.vertAdjacencyArray[j];
        }

        stream << endl;
    }

    stream << "Elements: " << endl;
    stream << setw( iw ) << "Idx"
           << " " << setw( hw ) << "Handle"
           << " " << setw( tw + 2 ) << "Type"
           << " "
           << "Connectivity" << std::endl
           << setw( iw ) << setfill( '-' ) << ""
           << " " << setw( hw ) << setfill( '-' ) << ""
           << " " << setw( tw + 2 ) << setfill( '-' ) << ""
           << " " << setfill( ' ' ) << "--------------------------" << std::endl;
    for( i = 0; i < pd.num_elements(); ++i )
    {
        EntityTopology type = pd.elementArray[i].get_element_type();
        stream << setw( iw ) << i << " " << setw( hw ) << pd.elementHandlesArray[i] << " " << setw( tw )
               << TopologyInfo::short_name( type ) << left << setw( 2 ) << pd.elementArray[i].node_count() << internal
               << " " << setw( iw ) << pd.elementArray[i].get_vertex_index_array()[0];
        for( size_t j = 1; j < pd.elementArray[i].node_count(); ++j )
            stream << "," << setw( iw ) << pd.elementArray[i].get_vertex_index_array()[j];
        stream << endl;
    }
    stream << endl;

    stream << "Mesh: " << ( pd.myMesh ? "yes" : "no" ) << endl;
    stream << "Domain: " << ( pd.myDomain ? "yes" : "no" ) << endl;
    //   stream << "mType: " << (pd.mType==PatchData::VERTICES_ON_VERTEX_PATCH?"vert-on-vert":
    //                           pd.mType==PatchData::ELEMENTS_ON_VERTEX_PATCH?"elem-on-vert":
    //                           pd.mType==PatchData::GLOBAL_PATCH?"global":"unknown") << endl;

    if( pd.haveComputedInfos )
    {
        stream << "ComputedInfos:" << endl;
        if( pd.have_computed_info( PatchData::MIN_UNSIGNED_AREA ) )
            stream << "\t MIN_UNSINGED_AREA = " << pd.computedInfos[PatchData::MIN_UNSIGNED_AREA] << endl;
        if( pd.have_computed_info( PatchData::MAX_UNSIGNED_AREA ) )
            stream << "\t MAX_UNSIGNED_AREA = " << pd.computedInfos[PatchData::MAX_UNSIGNED_AREA] << endl;
        if( pd.have_computed_info( PatchData::MIN_EDGE_LENGTH ) )
            stream << "\t MIN_EDGE_LENGTH = " << pd.computedInfos[PatchData::MIN_EDGE_LENGTH] << endl;
        if( pd.have_computed_info( PatchData::MAX_EDGE_LENGTH ) )
            stream << "\t MAX_EDGE_LENGTH = " << pd.computedInfos[PatchData::MAX_EDGE_LENGTH] << endl;
        if( pd.have_computed_info( PatchData::MINMAX_SIGNED_DET2D ) )
            stream << "\t MINMAX_SIGNED_DET2D = " << pd.computedInfos[PatchData::MINMAX_SIGNED_DET2D] << endl;
        if( pd.have_computed_info( PatchData::MINMAX_SIGNED_DET3D ) )
            stream << "\t MINMAX_SIGNED_DET3D = " << pd.computedInfos[PatchData::MINMAX_SIGNED_DET3D] << endl;
        if( pd.have_computed_info( PatchData::AVERAGE_DET3D ) )
            stream << "\t AVERAGE_DET3D = " << pd.computedInfos[PatchData::AVERAGE_DET3D] << endl;
    }

    return stream << endl;
}
bool MBMesquite::operator== ( const EdgeData &  e1,
const EdgeData &  e2 
) [inline]

Definition at line 64 of file EdgeQM.cpp.

References MBMesquite::EdgeData::endVtx.

{
    return e1.endVtx == e2.endVtx;
}
bool MBMesquite::operator== ( const EdgeIterator::Edge &  e1,
const EdgeIterator::Edge &  e2 
) [inline]

Definition at line 74 of file EdgeIterator.hpp.

References MBMesquite::EdgeIterator::Edge::midVertex, and MBMesquite::EdgeIterator::Edge::otherVertex.

{
    return e1.otherVertex == e2.otherVertex && e1.midVertex == e2.midVertex;
}
bool MBMesquite::operator== ( const Matrix3D &  lhs,
const Matrix3D &  rhs 
) [inline]

Definition at line 403 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::v_.

{
    return lhs.v_[0] == rhs.v_[0] && lhs.v_[1] == rhs.v_[1] && lhs.v_[2] == rhs.v_[2] && lhs.v_[3] == rhs.v_[3] &&
           lhs.v_[4] == rhs.v_[4] && lhs.v_[5] == rhs.v_[5] && lhs.v_[6] == rhs.v_[6] && lhs.v_[7] == rhs.v_[7] &&
           lhs.v_[8] == rhs.v_[8];
}
bool MBMesquite::operator== ( const Vector3D &  v1,
const Vector3D &  v2 
) [inline]

Definition at line 487 of file Vector3D.hpp.

References MBMesquite::Vector3D::mCoords.

{
    return v1.mCoords[0] == v2.mCoords[0] && v1.mCoords[1] == v2.mCoords[1] && v1.mCoords[2] == v2.mCoords[2];
}
template<unsigned R, unsigned C>
bool MBMesquite::operator== ( const MsqMatrix< R, C > &  A,
const MsqMatrix< R, C > &  B 
) [inline]

Definition at line 1104 of file MsqMatrix.hpp.

References C, MBMesquite::MsqMatrix< R, C >::data(), and moab::R.

{
    for( unsigned i = 0; i < R * C; ++i )
        if( A.data()[i] != B.data()[i] ) return false;
    return true;
}
std::istream& MBMesquite::operator>> ( std::istream &  s,
Matrix3D &  A 
) [inline]

Definition at line 384 of file Matrix3D.hpp.

{
    for( size_t i = 0; i < 3; i++ )
        for( size_t j = 0; j < 3; j++ )
        {
            s >> A[i][j];
        }
    return s;
}
template<unsigned R, unsigned C>
std::istream& MBMesquite::operator>> ( std::istream &  str,
MsqMatrix< R, C > &  m 
) [inline]

Definition at line 1127 of file MsqMatrix.hpp.

References C, MBMesquite::MsqMatrix< R, C >::data(), and moab::R.

{
    for( unsigned i = 0; i < R * C; ++i )
        str >> m.data()[i];
    return str;
}
SymMatrix3D MBMesquite::outer ( const Vector3D &  v) [inline]

Calculate the outer product of a vector with itself

Definition at line 216 of file SymMatrix3D.hpp.

{
    return SymMatrix3D( v[0] * v[0], v[0] * v[1], v[0] * v[2], v[1] * v[1], v[1] * v[2], v[2] * v[2] );
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::outer ( const MsqMatrix< 1, R > &  v1,
const MsqMatrix< 1, C > &  v2 
) [inline]

Definition at line 1179 of file MsqMatrix.hpp.

References C, and moab::R.

{
    MsqMatrix< R, C > result;
    for( unsigned r = 0; r < R; ++r )
        for( unsigned c = 0; c < C; ++c )
            result( r, c ) = v1( 0, r ) * v2( 0, c );
    return result;
}
SymMatrix3D MBMesquite::outer_plus_transpose ( const Vector3D &  u,
const Vector3D &  v 
) [inline]

Given to vectors u and v, calculate the symmetric matrix equal to outer(u,v) + transpose(outer(u,v)) equal to outer(v,u) + transpose(outer(v,u))

Definition at line 225 of file SymMatrix3D.hpp.

Referenced by MBMesquite::CompositeOFMultiply::evaluate_with_Hessian_diagonal().

{
    return SymMatrix3D( 2 * u[0] * v[0], u[0] * v[1] + u[1] * v[0], u[0] * v[2] + u[2] * v[0], 2 * u[1] * v[1],
                        u[1] * v[2] + u[2] * v[1], 2 * u[2] * v[2] );
}

Definition at line 27 of file ParallelHelper.cpp.

References MPI_COMM_WORLD.

{
    int is_init = 0;
    int err     = MPI_Initialized( &is_init );
    if( MPI_SUCCESS != err ) return;
    if( is_init ) MPI_Barrier( MPI_COMM_WORLD );
}
static void MBMesquite::plus_eq_scaled ( Vector3D *  v,
double  s,
const Vector3D *  x,
size_t  n 
) [inline, static]

Definition at line 101 of file QuasiNewton.cpp.

References n.

Referenced by MBMesquite::QuasiNewton::optimize_vertex_positions(), and MBMesquite::TrustRegion::optimize_vertex_positions().

{
    Vector3D* end = v + n;
    for( ; v != end; ++v, ++x )
        *v += s * *x;
}
Matrix3D MBMesquite::plus_transpose ( const Matrix3D &  A,
const Matrix3D &  B 
) [inline]

\( + B^T \)

Definition at line 627 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::plus_transpose_equal().

Referenced by Matrix3DTest::test_plus_transpose().

{
    Matrix3D tmp( A );
    tmp.plus_transpose_equal( B );
    return tmp;
}
void MBMesquite::pluseq_I_outer_product ( MsqMatrix< 3, 3 >  R[6],
const MsqMatrix< 3, 3 > &  A 
) [inline]

\( R += I \otimes A \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 813 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::add_row(), and MBMesquite::MsqMatrix< R, C >::row().

Referenced by pluseq_scaled_sum_outer_product_I_t().

{
    R[0].add_row( 0, A.row( 0 ) );
    R[1].add_row( 0, A.row( 1 ) );
    R[2].add_row( 0, A.row( 2 ) );
    R[3].add_row( 1, A.row( 1 ) );
    R[4].add_row( 1, A.row( 2 ) );
    R[5].add_row( 2, A.row( 2 ) );
}
void MBMesquite::pluseq_I_outer_product ( MsqMatrix< 2, 2 >  R[3],
const MsqMatrix< 2, 2 > &  A 
) [inline]

Definition at line 822 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::add_row(), and MBMesquite::MsqMatrix< R, C >::row().

{
    R[0].add_row( 0, A.row( 0 ) );
    R[1].add_row( 0, A.row( 1 ) );
    R[2].add_row( 1, A.row( 1 ) );
}
void MBMesquite::pluseq_outer_product_I ( MsqMatrix< 3, 3 >  R[6],
const MsqMatrix< 3, 3 > &  A 
) [inline]

\( R += A \otimes I \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 847 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::add_column(), MBMesquite::MsqMatrix< R, C >::row(), and transpose().

Referenced by pluseq_scaled_sum_outer_product_I_t().

{
    R[0].add_column( 0, transpose( A.row( 0 ) ) );
    R[1].add_column( 1, transpose( A.row( 0 ) ) );
    R[2].add_column( 2, transpose( A.row( 0 ) ) );
    R[3].add_column( 1, transpose( A.row( 1 ) ) );
    R[4].add_column( 2, transpose( A.row( 1 ) ) );
    R[5].add_column( 2, transpose( A.row( 2 ) ) );
}
void MBMesquite::pluseq_outer_product_I ( MsqMatrix< 2, 2 >  R[3],
const MsqMatrix< 2, 2 > &  A 
) [inline]

Definition at line 856 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::add_column(), MBMesquite::MsqMatrix< R, C >::row(), and transpose().

{
    R[0].add_column( 0, transpose( A.row( 0 ) ) );
    R[1].add_column( 1, transpose( A.row( 0 ) ) );
    R[2].add_column( 1, transpose( A.row( 1 ) ) );
}
template<unsigned D>
void MBMesquite::pluseq_scaled ( MsqMatrix< D, D >  R[D *(D+1)/2],
double  alpha,
const MsqMatrix< D, D >  Z[D *(D+1)/2] 
) [inline]

Definition at line 915 of file TMPDerivs.hpp.

References MBMesquite::MeshWriter::Z.

{
    for( unsigned i = 0; i < D * ( D + 1 ) / 2; ++i )
        R[i] += alpha * Z[i];
}
void MBMesquite::pluseq_scaled_2nd_deriv_of_det ( MsqMatrix< 3, 3 >  R[6],
double  alpha,
const MsqMatrix< 3, 3 > &  T 
) [inline]

\( R += \alpha \frac{\partial}{\partial T}det(T) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 357 of file TMPDerivs.hpp.

Referenced by MBMesquite::TShape2DNB2::evaluate_with_hess(), MBMesquite::TShapeSize2DB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB1::evaluate_with_hess(), MBMesquite::TSizeB1::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShapeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeSizeB3::evaluate_with_hess(), MBMesquite::TShapeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeNB3::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), MBMesquite::TShapeB1::evaluate_with_hess(), MBMesquite::TShapeNB1::evaluate_with_hess(), MBMesquite::TShapeSize3DB4::evaluate_with_hess(), MBMesquite::TShapeSize3DNB1::evaluate_with_hess(), MBMesquite::TUntangleBeta::hess(), MBMesquite::TUntangle1::hess(), pluseq_scaled_2nd_deriv_of_det(), and TMPDerivsTest::test_pluseq_scaled_2nd_deriv_of_det().

{
    MsqMatrix< 3, 3 > A( T );
    A *= alpha;

    R[1]( 0, 1 ) += A( 2, 2 );
    R[1]( 1, 0 ) -= A( 2, 2 );
    R[1]( 0, 2 ) -= A( 2, 1 );
    R[1]( 2, 0 ) += A( 2, 1 );
    R[1]( 1, 2 ) += A( 2, 0 );
    R[1]( 2, 1 ) -= A( 2, 0 );

    R[2]( 0, 1 ) -= A( 1, 2 );
    R[2]( 1, 0 ) += A( 1, 2 );
    R[2]( 0, 2 ) += A( 1, 1 );
    R[2]( 2, 0 ) -= A( 1, 1 );
    R[2]( 1, 2 ) -= A( 1, 0 );
    R[2]( 2, 1 ) += A( 1, 0 );

    R[4]( 0, 1 ) += A( 0, 2 );
    R[4]( 1, 0 ) -= A( 0, 2 );
    R[4]( 0, 2 ) -= A( 0, 1 );
    R[4]( 2, 0 ) += A( 0, 1 );
    R[4]( 1, 2 ) += A( 0, 0 );
    R[4]( 2, 1 ) -= A( 0, 0 );
}
void MBMesquite::pluseq_scaled_2nd_deriv_of_det ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

\( R += \alpha \frac{\partial}{\partial T}det(T) \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 416 of file TMPDerivs.hpp.

{
    R[1]( 0, 1 ) += alpha;
    R[1]( 1, 0 ) -= alpha;
}
void MBMesquite::pluseq_scaled_2nd_deriv_of_det ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &   
) [inline]

Definition at line 115 of file TMPDerivs.hpp.

References pluseq_scaled_2nd_deriv_of_det().

void MBMesquite::pluseq_scaled_2nd_deriv_tr_adj ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

\( R += \alpha \frac{\partial^2}{\partial T^2}tr(adj T) \)

Note: 2nd deriv is a constant, so T is not passed as an argument.

Referenced by MBMesquite::TShapeSizeOrientB2::evaluate_with_hess().

void MBMesquite::pluseq_scaled_2nd_deriv_tr_adj ( MsqMatrix< 3, 3 >  R[6],
double  alpha 
) [inline]

\( R += \alpha \frac{\partial^2}{\partial T^2}tr(adj T) \)

Note: 2nd deriv is a constant, so T is not passed as an argument.

Definition at line 436 of file TMPDerivs.hpp.

{
    R[1]( 0, 1 ) += alpha;
    R[1]( 1, 0 ) -= alpha;
    R[2]( 0, 2 ) += alpha;
    R[2]( 2, 0 ) -= alpha;
    R[4]( 1, 2 ) += alpha;
    R[4]( 2, 1 ) -= alpha;
}
void MBMesquite::pluseq_scaled_2nd_deriv_tr_adj ( MsqMatrix< 2, 2 > *  ,
double   
)

Definition at line 431 of file TMPDerivs.hpp.

{
    // 2nd derivative is zero
}
void MBMesquite::pluseq_scaled_I ( MsqMatrix< 3, 3 > &  R,
double  alpha 
) [inline]

\( R += \alpha I_9 \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 325 of file TMPDerivs.hpp.

References moab::R.

{
    R( 0, 0 ) += alpha;
    R( 1, 1 ) += alpha;
    R( 2, 2 ) += alpha;
}
void MBMesquite::pluseq_scaled_I ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

\( R += \alpha I_4 \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 351 of file TMPDerivs.hpp.

References pluseq_scaled_I().

{
    pluseq_scaled_I( R[0], alpha );
    pluseq_scaled_I( R[2], alpha );
}
void MBMesquite::pluseq_scaled_I ( MsqMatrix< 2, 2 > &  R,
double  alpha 
) [inline]

\( R += \alpha I_4 \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 332 of file TMPDerivs.hpp.

References moab::R.

{
    R( 0, 0 ) += alpha;
    R( 1, 1 ) += alpha;
}
void MBMesquite::pluseq_scaled_outer_product ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &  M 
) [inline]

Definition at line 172 of file TMPDerivs.hpp.

References moab::R.

{
    pluseq_scaled_outer_product_t< 2 >( R, alpha, M );
}
void MBMesquite::pluseq_scaled_outer_product_I_I ( MsqMatrix< 3, 3 >  R[6],
double  alpha 
) [inline]

\( R += \alpha (I \otimes I) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 795 of file TMPDerivs.hpp.

Referenced by MBMesquite::TShapeOrientB2::evaluate_with_hess(), TMPDerivsTest::test_pluseq_scaled_outer_product_I_I_2D(), and TMPDerivsTest::test_pluseq_scaled_outer_product_I_I_3D().

{
    R[0]( 0, 0 ) += alpha;
    R[1]( 0, 1 ) += alpha;
    R[2]( 0, 2 ) += alpha;
    R[3]( 1, 1 ) += alpha;
    R[4]( 1, 2 ) += alpha;
    R[5]( 2, 2 ) += alpha;
}
void MBMesquite::pluseq_scaled_outer_product_I_I ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

\( R += \alpha (I \otimes I) \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 805 of file TMPDerivs.hpp.

{
    R[0]( 0, 0 ) += alpha;
    R[1]( 0, 1 ) += alpha;
    R[2]( 1, 1 ) += alpha;
}
template<unsigned D>
void MBMesquite::pluseq_scaled_outer_product_t ( MsqMatrix< D, D >  R[D *(D+1)/2],
double  alpha,
const MsqMatrix< D, D > &  M 
) [inline]

\( R += \alpha \left( M \otimes M \right) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 523 of file TMPDerivs.hpp.

References moab::R, MBMesquite::MsqMatrix< R, C >::row(), and transpose().

{
    MsqMatrix< D, D > aM( M );
    aM *= alpha;
    unsigned h = 0;
    for( unsigned i = 0; i < D; ++i )
        for( unsigned j = i; j < D; ++j )
            R[h++] += transpose( aM.row( i ) ) * M.row( j );
}
void MBMesquite::pluseq_scaled_sum_outer_product ( MsqMatrix< 3, 3 >  R[6],
double  alpha,
const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  B 
) [inline]

\( R += \alpha \left( A \otimes B + B \otimes A \right) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 570 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::row(), MBMesquite::Matrix3D::row(), and transpose().

Referenced by MBMesquite::TShape2DNB2::evaluate_with_hess(), MBMesquite::TShapeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSize2DB2::evaluate_with_hess(), MBMesquite::TShapeSize2DNB2::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::TShapeB1::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), MBMesquite::TShapeSize3DB4::evaluate_with_hess(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_2D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_3D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_I_2D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_I_3D(), and TMPDerivsTest::test_set_scaled_sum_outer_product_2D().

{
    // apply scalar first
    MsqMatrix< 3, 3 > A( A_in ), tmp;
    A *= alpha;

    // block 0,0
    tmp = transpose( A.row( 0 ) ) * B.row( 0 );
    R[0] += tmp;
    R[0] += transpose( tmp );

    // block 1,1
    tmp = transpose( A.row( 1 ) ) * B.row( 1 );
    R[3] += tmp;
    R[3] += transpose( tmp );

    // block 2,2
    tmp = transpose( A.row( 2 ) ) * B.row( 2 );
    R[5] += tmp;
    R[5] += transpose( tmp );

    // block 0,1
    R[1] += transpose( A.row( 0 ) ) * B.row( 1 ) + transpose( B.row( 0 ) ) * A.row( 1 );

    // block 0,2
    R[2] += transpose( A.row( 0 ) ) * B.row( 2 ) + transpose( B.row( 0 ) ) * A.row( 2 );

    // block 1,2
    R[4] += transpose( A.row( 1 ) ) * B.row( 2 ) + transpose( B.row( 1 ) ) * A.row( 2 );
}
void MBMesquite::pluseq_scaled_sum_outer_product ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  B 
) [inline]

\( R += \alpha \left( A \otimes B + B \otimes A \right) \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 706 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::row(), MBMesquite::Matrix3D::row(), and transpose().

{
    // apply scalar first
    MsqMatrix< 2, 2 > A( A_in ), tmp;
    A *= alpha;

    // block 0,0
    tmp = transpose( A.row( 0 ) ) * B.row( 0 );
    R[0] += tmp;
    R[0] += transpose( tmp );

    // block 1,1
    tmp = transpose( A.row( 1 ) ) * B.row( 1 );
    R[2] += tmp;
    R[2] += transpose( tmp );

    // block 0,1
    R[1] += transpose( A.row( 0 ) ) * B.row( 1 ) + transpose( B.row( 0 ) ) * A.row( 1 );
}
void MBMesquite::pluseq_scaled_sum_outer_product_I ( MsqMatrix< 3, 3 >  R[6],
double  alpha,
const MsqMatrix< 3, 3 > &  A_in 
) [inline]
void MBMesquite::pluseq_scaled_sum_outer_product_I ( MsqMatrix< 2, 2 >  R[2],
double  alpha,
const MsqMatrix< 2, 2 > &  A_in 
) [inline]

Definition at line 279 of file TMPDerivs.hpp.

References moab::R.

{
    pluseq_scaled_sum_outer_product_I_t< 2 >( R, alpha, A_in );
}
template<unsigned D>
void MBMesquite::pluseq_scaled_sum_outer_product_I_t ( MsqMatrix< D, D >  R[D *(D+1)/2],
double  alpha,
const MsqMatrix< D, D > &  A 
) [inline]

\( R += \alpha \left( I \otimes A + A \otimes I \right) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 881 of file TMPDerivs.hpp.

References pluseq_I_outer_product(), and pluseq_outer_product_I().

{
    // apply scalar first
    MsqMatrix< D, D > A( A_in );
    A *= alpha;
    pluseq_I_outer_product( R, A );
    pluseq_outer_product_I( R, A );
}
template<unsigned D>
void MBMesquite::pluseq_scaled_t ( MsqMatrix< D, D >  R[D *(D+1)/2],
double  alpha,
const MsqMatrix< D, D >  Z[D *(D+1)/2] 
) [inline]

\( R = R + \alpha * Z \)

void MBMesquite::plusEqaA ( Matrix3D &  B,
const double  a,
const Matrix3D &  A 
) [inline]

Definition at line 792 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::v_.

{
    B.v_[0] += a * A.v_[0];
    B.v_[1] += a * A.v_[1];
    B.v_[2] += a * A.v_[2];
    B.v_[3] += a * A.v_[3];
    B.v_[4] += a * A.v_[4];
    B.v_[5] += a * A.v_[5];
    B.v_[6] += a * A.v_[6];
    B.v_[7] += a * A.v_[7];
    B.v_[8] += a * A.v_[8];
}
void MBMesquite::plusEqAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
) [inline]

Definition at line 771 of file Matrix3D.hpp.

References MBMesquite::Vector3D::mCoords, and MBMesquite::Matrix3D::v_.

Referenced by axpy(), and MBMesquite::MsqHessian::product().

{
    v.mCoords[0] += A.v_[0] * x[0] + A.v_[1] * x.mCoords[1] + A.v_[2] * x.mCoords[2];
    v.mCoords[1] += A.v_[3] * x[0] + A.v_[4] * x.mCoords[1] + A.v_[5] * x.mCoords[2];
    v.mCoords[2] += A.v_[6] * x[0] + A.v_[7] * x.mCoords[1] + A.v_[8] * x.mCoords[2];
}
void MBMesquite::plusEqTransAx ( Vector3D &  v,
const Matrix3D &  A,
const Vector3D &  x 
) [inline]

Definition at line 785 of file Matrix3D.hpp.

References MBMesquite::Vector3D::mCoords, and MBMesquite::Matrix3D::v_.

Referenced by axpy(), and MBMesquite::MsqHessian::product().

{
    v.mCoords[0] += A.v_[0] * x.mCoords[0] + A.v_[3] * x.mCoords[1] + A.v_[6] * x.mCoords[2];
    v.mCoords[1] += A.v_[1] * x.mCoords[0] + A.v_[4] * x.mCoords[1] + A.v_[7] * x.mCoords[2];
    v.mCoords[2] += A.v_[2] * x.mCoords[0] + A.v_[5] * x.mCoords[1] + A.v_[8] * x.mCoords[2];
}
template<typename HessIter >
static double MBMesquite::pmean_corner_diagonals ( EntityTopology  type,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
HessIter  corner_diag_blocks,
Vector3D  vertex_grads[],
SymMatrix3D  vertex_hessians[],
double  p 
) [inline, static]

Definition at line 222 of file AveragingQM.cpp.

References corners, grad(), hess(), inv(), n, N, outer(), and moab::R.

Referenced by average_corner_diagonals().

{
    const unsigned N = TopologyInfo::corners( type );
    unsigned i, n, r, R, idx[4];
    const unsigned* adj_list;
    double m = 0.0, nm;
    double gf[8], hf[8];
    double inv = 1.0 / num_corner;
    assert( num_corner <= 8 );

    // calculate mean
    for( i = 0; i < num_corner; ++i )
    {
        nm = pow( corner_values[i], p );
        m += nm;

        gf[i] = inv * p * nm / corner_values[i];
        hf[i] = ( p - 1 ) * gf[i] / corner_values[i];
    }
    nm = inv * m;

    const Vector3D* grad = corner_grads;
    HessIter hess        = corner_diag_blocks;
    for( i = 0; i < num_corner; ++i )
    {
        adj_list = TopologyInfo::adjacent_vertices( type, i, n );
        idx[0]   = i;
        idx[1]   = adj_list[0];
        idx[2]   = adj_list[1];
        idx[3]   = adj_list[2 % n];  // %n so don't read off end if 2D
        ++n;

        for( r = 0; r < n; ++r )
        {
            R = idx[r];
            vertex_grads[R] += gf[i] * *grad;
            vertex_hessians[R] += hf[i] * outer( *grad );
            vertex_hessians[R] += gf[i] * *hess;
            ++grad;
            ++hess;
        }
    }

    m     = pow( nm, 1.0 / p );
    gf[0] = m / ( p * nm );
    hf[0] = ( 1.0 / p - 1 ) * gf[0] / nm;
    for( r = 0; r < N; ++r )
    {
        vertex_hessians[r] *= gf[0];
        vertex_hessians[r] += hf[0] * outer( vertex_grads[r] );
        vertex_grads[r] *= gf[0];
    }

    return m;
}
static double MBMesquite::pmean_corner_hessians ( EntityTopology  type,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
const Matrix3D  corner_hessians[],
Vector3D  vertex_grads[],
Matrix3D  vertex_hessians[],
double  p 
) [inline, static]

Definition at line 480 of file AveragingQM.cpp.

References C, corners, grad(), hess(), inv(), n, N, MBMesquite::Matrix3D::outer_product(), and moab::R.

Referenced by MBMesquite::AveragingQM::average_corner_hessians().

{
    const unsigned N = TopologyInfo::corners( type );
    unsigned i, n, r, c, R, C, idx[4];
    const unsigned* adj_list;
    double m = 0.0, nm;
    Matrix3D op;
    double gf[8], hf[8];
    double inv = 1.0 / num_corner;
    assert( num_corner <= 8 );

    // calculate mean
    for( i = 0; i < num_corner; ++i )
    {
        nm = pow( corner_values[i], p );
        m += nm;

        gf[i] = inv * p * nm / corner_values[i];
        hf[i] = ( p - 1 ) * gf[i] / corner_values[i];
    }
    nm = inv * m;

    const Vector3D* grad = corner_grads;
    const Matrix3D* hess = corner_hessians;
    for( i = 0; i < num_corner; ++i )
    {
        adj_list = TopologyInfo::adjacent_vertices( type, i, n );
        idx[0]   = i;
        idx[1]   = adj_list[0];
        idx[2]   = adj_list[1];
        idx[3]   = adj_list[2 % n];  // %n so don't read off end if 2D
        ++n;

        for( r = 0; r < n; ++r )
        {
            R = idx[r];
            vertex_grads[R] += gf[i] * grad[r];
            for( c = r; c < n; ++c )
            {
                C = idx[c];
                op.outer_product( grad[r], grad[c] );
                op *= hf[i];
                op += gf[i] * *hess;
                if( R <= C )
                    vertex_hessians[N * R - R * ( R + 1 ) / 2 + C] += op;
                else
                    vertex_hessians[N * C - C * ( C + 1 ) / 2 + R].plus_transpose_equal( op );
                ++hess;
            }
        }
        grad += n;
    }

    m     = pow( nm, 1.0 / p );
    gf[0] = m / ( p * nm );
    hf[0] = ( 1.0 / p - 1 ) * gf[0] / nm;
    for( r = 0; r < N; ++r )
    {
        for( c = r; c < N; ++c )
        {
            op.outer_product( vertex_grads[r], vertex_grads[c] );
            op *= hf[0];
            *vertex_hessians *= gf[0];
            *vertex_hessians += op;
            ++vertex_hessians;
        }
        vertex_grads[r] *= gf[0];
    }

    return m;
}
int MBMesquite::popcount ( unsigned int  x) [inline]

Count number of 1-bits in an unsigned integer.

This operation is typically referred to as 'popcount' (short for "population count".) For example the GCC builtin "__builtin_popcount". It is also sometimes referred to as "sideways addition" (e.g. Knuth volume 4.)

Definition at line 47 of file Bits.hpp.

References u.

Referenced by MBMesquite::NodeSet::num_before_bit(), and MBMesquite::NodeSet::num_nodes().

{
#if 0  // April '08 bug report says gcc builtin not so good unless Intel SSE4
//#ifdef __GNUC__
  return __builtin_popcount( x );
#else
    // Use "parallel" algorithm
    //  if (sizeof(x) == 4) {
    x = ( x & 0x55555555u ) + ( ( x >> 1 ) & 0x55555555u );
    x = ( x & 0x33333333u ) + ( ( x >> 2 ) & 0x33333333u );
    x = ( x & 0x0f0f0f0fu ) + ( ( x >> 4 ) & 0x0f0f0f0fu );
    return ( x * 0x1010101u ) >> 24;  // x % 255
                                      //  }
                                      //  else {
                                      //    x = (x & 0x5555555555555555ULL) + ((x >> 1) & 0x5555555555555555ULL);
                                      //    x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
                                      //    x = (x & 0x0F0F0F0F0F0F0F0FULL) + ((x >> 4) & 0x0F0F0F0F0F0F0F0FULL);
                                      //    return (x * 0x0101010101010101ULL) >> 56;
                                      //  }
#endif
}
static void MBMesquite::populate_data ( PatchData &  pd,
CachedTargetData *  data,
TargetCalculator *  calc,
MsqError &  err 
) [static]

Definition at line 105 of file CachingTargetCalculator.cpp.

References MBMesquite::NodeSet::corner_node(), corners, edges, MBMesquite::PatchData::element_by_index(), MBMesquite::CachedTargetData::elementOffsets, faces, MBMesquite::TargetCalculator::get_2D_target(), MBMesquite::TargetCalculator::get_3D_target(), MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::PatchData::get_samples(), MBMesquite::TargetCalculator::get_surface_target(), MBMesquite::TargetCalculator::have_surface_orient(), MBMesquite::NodeSet::mid_edge_node(), MBMesquite::NodeSet::mid_face_node(), MBMesquite::NodeSet::mid_region_node(), MSQ_ERRRTN, MBMesquite::PatchData::num_elements(), MBMesquite::NodeSet::num_nodes(), MBMesquite::CachedTargetData::targets2D, MBMesquite::CachedTargetData::targets3D, and MBMesquite::CachedTargetData::targetsSurface.

Referenced by MBMesquite::CachingTargetCalculator::get_2D_target(), MBMesquite::CachingTargetCalculator::get_3D_target(), and MBMesquite::CachingTargetCalculator::get_surface_target().

{
    size_t i, j;

    const bool orient = calc->have_surface_orient();
    if( data->elementOffsets.empty() )
    {
        size_t count_3d = 0, count_2d = 0;
        data->elementOffsets.resize( pd.num_elements() );
        for( i = 0; i < pd.num_elements(); ++i )
        {
            EntityTopology type     = pd.element_by_index( i ).get_element_type();
            NodeSet sample_pts      = pd.get_samples( i );
            size_t& count           = ( TopologyInfo::dimension( type ) == 3 ) ? count_3d : count_2d;
            data->elementOffsets[i] = count;
            count += sample_pts.num_nodes();
        }
        data->targets3D.resize( count_3d );
        if( orient )
            data->targetsSurface.resize( count_2d );
        else
            data->targets2D.resize( count_2d );
    }

    size_t off2 = 0, off3 = 0;
    for( i = 0; i < pd.num_elements(); ++i )
    {
        EntityTopology type = pd.element_by_index( i ).get_element_type();
        NodeSet sample_pts  = pd.get_samples( i );
        if( TopologyInfo::dimension( type ) == 3 )
        {
            assert( off3 == data->elementOffsets[i] );
            for( j = 0; j < TopologyInfo::corners( type ); ++j )
            {
                if( sample_pts.corner_node( j ) )
                {
                    assert( off3 < data->targets3D.size() );
                    calc->get_3D_target( pd, i, Sample( 0, j ), data->targets3D[off3++], err );MSQ_ERRRTN( err );
                }
            }
            for( j = 0; j < TopologyInfo::edges( type ); ++j )
            {
                if( sample_pts.mid_edge_node( j ) )
                {
                    assert( off3 < data->targets3D.size() );
                    calc->get_3D_target( pd, i, Sample( 1, j ), data->targets3D[off3++], err );MSQ_ERRRTN( err );
                }
            }
            for( j = 0; j < TopologyInfo::faces( type ); ++j )
            {
                if( sample_pts.mid_face_node( j ) )
                {
                    assert( off3 < data->targets3D.size() );
                    calc->get_3D_target( pd, i, Sample( 2, j ), data->targets3D[off3++], err );MSQ_ERRRTN( err );
                }
            }
            if( sample_pts.mid_region_node() )
            {
                assert( off3 < data->targets3D.size() );
                calc->get_3D_target( pd, i, Sample( 3, 0 ), data->targets3D[off3++], err );MSQ_ERRRTN( err );
            }
        }
        else if( orient )
        {
            assert( off2 == data->elementOffsets[i] );
            for( j = 0; j < TopologyInfo::corners( type ); ++j )
            {
                if( sample_pts.corner_node( j ) )
                {
                    assert( off2 < data->targetsSurface.size() );
                    calc->get_surface_target( pd, i, Sample( 0, j ), data->targetsSurface[off2++], err );MSQ_ERRRTN( err );
                }
            }
            for( j = 0; j < TopologyInfo::edges( type ); ++j )
            {
                if( sample_pts.mid_edge_node( j ) )
                {
                    assert( off2 < data->targetsSurface.size() );
                    calc->get_surface_target( pd, i, Sample( 1, j ), data->targetsSurface[off2++], err );MSQ_ERRRTN( err );
                }
            }
            if( sample_pts.mid_face_node( 0 ) )
            {
                assert( off2 < data->targetsSurface.size() );
                calc->get_surface_target( pd, i, Sample( 2, 0 ), data->targetsSurface[off2++], err );MSQ_ERRRTN( err );
            }
        }
        else
        {
            assert( off2 == data->elementOffsets[i] );
            for( j = 0; j < TopologyInfo::corners( type ); ++j )
            {
                if( sample_pts.corner_node( j ) )
                {
                    assert( off2 < data->targets2D.size() );
                    calc->get_2D_target( pd, i, Sample( 0, j ), data->targets2D[off2++], err );MSQ_ERRRTN( err );
                }
            }
            for( j = 0; j < TopologyInfo::edges( type ); ++j )
            {
                if( sample_pts.mid_edge_node( j ) )
                {
                    assert( off2 < data->targets2D.size() );
                    calc->get_2D_target( pd, i, Sample( 1, j ), data->targets2D[off2++], err );MSQ_ERRRTN( err );
                }
            }
            if( sample_pts.mid_face_node( 0 ) )
            {
                assert( off2 < data->targets2D.size() );
                calc->get_2D_target( pd, i, Sample( 2, 0 ), data->targets2D[off2++], err );MSQ_ERRRTN( err );
            }
        }
    }
}
static void MBMesquite::print ( const char *  title,
const char *  name1,
const char *  name2,
const SimpleStats &  s1,
const SimpleStats &  s2,
const SimpleStats &  sd 
) [static]

Definition at line 516 of file CompareQM.cpp.

References MBMesquite::SimpleStats::average(), dashes(), MBMesquite::SimpleStats::maximum(), MBMesquite::SimpleStats::minimum(), MBMesquite::SimpleStats::rms(), and MBMesquite::SimpleStats::standard_deviation().

Referenced by TreeValidator::error(), MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal(), moab::Core::list_entity(), moab::Tqdcfr::ModelEntry::print_block_headers(), moab::Tqdcfr::ModelEntry::print_group_headers(), moab::Tqdcfr::ModelEntry::print_nodeset_headers(), moab::Tqdcfr::ModelEntry::print_sideset_headers(), MBMesquite::CompareQM::print_stats(), string_tag_value(), and TreeValidator::visit().

{
    const char named[] = "difference";
    int len = std::max( std::max( strlen( named ), strlen( title ) ), std::max( strlen( name1 ), strlen( name2 ) ) );
    std::vector< char > dashes( len, '-' );
    dashes.push_back( '\0' );
    printf( "%*s %12s %12s %12s %12s %12s\n", len, title, "minimum", "average", "rms", "maximum", "std.dev." );
    printf( "%s ------------ ------------ ------------ ------------ ------------\n", &dashes[0] );
    printf( "%*s % 12g % 12g % 12g % 12g % 12g\n", len, name1, s1.minimum(), s1.average(), s1.rms(), s1.maximum(),
            s1.standard_deviation() );
    printf( "%*s % 12g % 12g % 12g % 12g % 12g\n", len, name2, s2.minimum(), s2.average(), s2.rms(), s2.maximum(),
            s2.standard_deviation() );
    printf( "%*s % 12g % 12g % 12g % 12g % 12g\n", len, named, sd.minimum(), sd.average(), sd.rms(), sd.maximum(),
            sd.standard_deviation() );
    printf( "\n" );
}
void MBMesquite::print_patch_data ( const PatchData &  pd)

Definition at line 1539 of file PatchData.cpp.

{
    std::cout << pd << std::endl;
}
MESQUITE_EXPORT void MBMesquite::print_timing_diagnostics ( std::ostream &  stream) [inline]

Definition at line 197 of file MsqTimer.hpp.

References GlobalStopWatches.

{
    stream << GlobalStopWatches;
}
std::string MBMesquite::process_itaps_error ( int  ierr)

Definition at line 43 of file MsqIBase.cpp.

References iBase_BAD_ARRAY_DIMENSION, iBase_BAD_ARRAY_SIZE, iBase_BAD_TYPE_AND_TOPO, iBase_ENTITY_CREATION_ERROR, iBase_FILE_NOT_FOUND, iBase_FILE_WRITE_ERROR, iBase_INVALID_ARGUMENT, iBase_INVALID_ENTITY_COUNT, iBase_INVALID_ENTITY_HANDLE, iBase_INVALID_ENTITY_TOPOLOGY, iBase_INVALID_ENTITY_TYPE, iBase_INVALID_ENTITYSET_HANDLE, iBase_INVALID_ITERATOR_HANDLE, iBase_INVALID_TAG_HANDLE, iBase_MEMORY_ALLOCATION_FAILED, iBase_MESH_ALREADY_LOADED, iBase_NIL_ARRAY, iBase_NOT_SUPPORTED, iBase_TAG_ALREADY_EXISTS, iBase_TAG_IN_USE, iBase_TAG_NOT_FOUND, and MSQ_DBGOUT.

Referenced by chk_igeom_error(), MBMesquite::MsqIRel::closest_point(), MBMesquite::MsqIGeom::closest_point(), MBMesquite::MsqIRel::domain_DoF(), MBMesquite::MsqIGeom::domain_DoF(), MBMesquite::MsqIGeom::element_normal_at(), MBMesquite::MsqIMesh::elements_get_topologies(), MBMesquite::MsqMOAB::get_adjacent_entities(), MBMesquite::MsqIMesh::get_adjacent_entities(), MBMesquite::MsqIMesh::get_all_elements(), MBMesquite::MsqIMesh::get_flag_data(), MBMesquite::MsqIMesh::init_active_mesh(), MBMesquite::MsqIRel::snap_to(), MBMesquite::MsqIGeom::snap_to(), MBMesquite::MsqIMesh::tag_create(), MBMesquite::MsqIMesh::tag_delete(), MBMesquite::MsqIMesh::tag_get(), MBMesquite::MsqIMesh::tag_get_data(), MBMesquite::MsqIMesh::tag_properties(), MBMesquite::MsqIMesh::tag_set_data(), MBMesquite::MsqIMesh::vertex_get_byte(), MBMesquite::MsqIRel::vertex_normal_at(), MBMesquite::MsqIGeom::vertex_normal_at(), MBMesquite::MsqIMesh::vertex_set_byte(), MBMesquite::MsqIMesh::vertex_set_coordinates(), MBMesquite::MsqIMesh::vertices_get_attached_elements(), MBMesquite::MsqIMesh::vertices_get_byte(), MBMesquite::MsqIMesh::vertices_get_coordinates(), and MBMesquite::MsqIMesh::vertices_set_byte().

{
    std::string result( "ITAPS ERROR: " );
    switch( ierr )
    {
        case iBase_MESH_ALREADY_LOADED:
            result += "File Already Loaded";
            break;
        case iBase_FILE_NOT_FOUND:
            result += "File Not Found";
            break;
        case iBase_FILE_WRITE_ERROR:
            result += "File Write Error";
            break;
        case iBase_NIL_ARRAY:
            result += "NULL Array";
            break;
        case iBase_BAD_ARRAY_SIZE:
            result += "Bad Array Size";
            break;
        case iBase_BAD_ARRAY_DIMENSION:
            result += "Bad Array Dimension";
            break;
        case iBase_INVALID_ENTITY_HANDLE:
            result += "Invalid Handle";
            break;
        case iBase_INVALID_ENTITY_COUNT:
            result += "Invalid Count";
            break;
        case iBase_INVALID_ENTITY_TYPE:
            result += "Invalid Type";
            break;
        case iBase_INVALID_ENTITY_TOPOLOGY:
            result += "Invalid Topology";
            break;
        case iBase_BAD_TYPE_AND_TOPO:
            result += "Invalid Type";
            break;
        case iBase_ENTITY_CREATION_ERROR:
            result += "Creation Failed";
            break;
        case iBase_INVALID_TAG_HANDLE:
            result += "Invalid Tag";
            break;
        case iBase_TAG_NOT_FOUND:
            result += "Tag Not Found";
            break;
        case iBase_TAG_ALREADY_EXISTS:
            result += "Tag Exists";
            break;
        case iBase_TAG_IN_USE:
            result += "Tag In Use";
            break;
        case iBase_INVALID_ENTITYSET_HANDLE:
            result += "Invalid Handle";
            break;
        case iBase_INVALID_ITERATOR_HANDLE:
            result += "Invalid Iterator";
            break;
        case iBase_INVALID_ARGUMENT:
            result += "Invalid Argument";
            break;
        case iBase_MEMORY_ALLOCATION_FAILED:
            result += "Out of Memory";
            break;
        case iBase_NOT_SUPPORTED:
            result += "Not Supported";
            break;
        default:
            result += "Uknown/Internal Error";
            break;
    }
    MSQ_DBGOUT( 1 ) << result << std::endl;
    return result;
}
static void MBMesquite::project_to_matrix_plane ( const MsqMatrix< 3, 2 > &  M_in,
MsqMatrix< 2, 2 > &  M_out,
MsqVector< 3 > &  u,
MsqVector< 3 > &  u_perp 
) [inline, static]

Definition at line 197 of file TMPQualityMetric.cpp.

References MBMesquite::MsqMatrix< R, C >::column(), divide(), get_u_perp(), length(), and project_to_perp_plane().

Referenced by MBMesquite::TMPQualityMetric::evaluate_surface_common().

{
    u            = M_in.column( 0 ) * M_in.column( 1 );
    u_perp       = M_in.column( 0 );
    double len0  = length( u_perp );
    double u_len = length( u );
    double d_perp, d_u;
    if( !divide( 1.0, len0, d_perp ) )
    {
        // try the other column
        u_perp = M_in.column( 1 );
        len0   = length( u_perp );
        if( !divide( 1.0, len0, d_perp ) )
        {
            // matrix is all zeros
            u[0]      = 0;
            u[1]      = 0;
            u[2]      = 1;
            u_perp[0] = 1;
            u_perp[1] = 0;
            u_perp[2] = 0;
            M_out     = MsqMatrix< 2, 2 >( 0.0 );
        }
        else
        {
            MsqMatrix< 3, 2 > junk;
            get_u_perp( u_perp, u );
            project_to_perp_plane( M_in, u, u_perp, M_out, junk );
        }
    }
    else if( !divide( 1.0, u_len, d_u ) )
    {
        MsqMatrix< 3, 2 > junk;
        get_u_perp( u_perp, u );
        project_to_perp_plane( M_in, u, u_perp, M_out, junk );
    }
    else
    {  // the normal case (neither column is zero)
        u *= d_u;
        u_perp *= d_perp;

        // M_out = transpose(theta)*M_in
        M_out( 0, 0 ) = len0;
        M_out( 0, 1 ) = u_perp % M_in.column( 1 );
        M_out( 1, 0 ) = 0.0;
        M_out( 1, 1 ) = u_len / len0;
    }
}
static bool MBMesquite::project_to_perp_plane ( MsqMatrix< 3, 2 >  J,
const MsqVector< 3 > &  u,
const MsqVector< 3 > &  u_perp,
MsqMatrix< 2, 2 > &  A,
MsqMatrix< 3, 2 > &  S_a_transpose_Theta 
) [inline, static]

Definition at line 144 of file TMPQualityMetric.cpp.

References MBMesquite::MsqMatrix< R, C >::column(), moab::cross(), divide(), length(), n, MBMesquite::MsqMatrix< R, C >::set_column(), transpose(), and u.

Referenced by MBMesquite::TMPQualityMetric::evaluate_surface_common(), and project_to_matrix_plane().

{
    MsqVector< 3 > n_a = J.column( 0 ) * J.column( 1 );
    double sc, len = length( n_a );
    if( !divide( 1.0, len, sc ) ) return false;
    n_a *= sc;
    double ndot          = n_a % u;
    double sigma         = ( ndot < 0.0 ) ? -1 : 1;
    double cosphi        = sigma * ndot;
    MsqVector< 3 > cross = n_a * u;
    double sinphi        = length( cross );

    MsqMatrix< 3, 2 > Theta;
    Theta.set_column( 0, u_perp );
    Theta.set_column( 1, u * u_perp );

    // If columns of J are not in plane orthogonal to u, then
    // rotate J such that they are.
    if( sinphi > 1e-12 )
    {
        MsqVector< 3 > m = sigma * cross;
        MsqVector< 3 > n = ( 1 / sinphi ) * m;
        MsqVector< 3 > p = ( 1 - cosphi ) * n;
        double s_a[]     = { p[0] * n[0] + cosphi, p[0] * n[1] - m[2],   p[0] * n[2] + m[1],
                         p[1] * n[0] + m[2],   p[1] * n[1] + cosphi, p[1] * n[2] - m[0],
                         p[2] * n[0] - m[1],   p[2] * n[1] + m[0],   p[2] * n[2] + cosphi };
        MsqMatrix< 3, 3 > S_a( s_a );
        J                   = S_a * J;
        S_a_transpose_Theta = transpose( S_a ) * Theta;
    }
    else
    {
        S_a_transpose_Theta = Theta;
        //    J *= sigma;
    }

    // Project to get 2x2 A from A_hat (which might be equal to J)
    A = transpose( Theta ) * J;
    return true;
}
static void MBMesquite::project_to_plane ( Vector3D &  vect,
const Vector3D &  norm 
) [static]

Definition at line 423 of file PatchData.cpp.

Referenced by MBMesquite::PatchData::project_gradient().

{
    double len_sqr = norm % norm;
    if( len_sqr > DBL_EPSILON ) vect -= norm * ( ( norm % vect ) / len_sqr );
}
void MBMesquite::QR ( Matrix3D &  Q,
Matrix3D &  R,
const Matrix3D &  A 
) [inline]

Definition at line 836 of file Matrix3D.hpp.

Referenced by MsqMatrixTest::test_qr().

{
    // Compute the QR factorization of A.  This code uses the
    // Modified Gram-Schmidt method for computing the factorization.
    // The Householder version is more stable, but costs twice as many
    // floating point operations.

    Q = A;

    R[0][0]         = sqrt( Q[0][0] * Q[0][0] + Q[1][0] * Q[1][0] + Q[2][0] * Q[2][0] );
    double temp_dbl = 1.0 / R[0][0];
    R[1][0]         = 0.0L;
    R[2][0]         = 0.0L;
    // Q[0][0] /= R[0][0];
    // Q[1][0] /= R[0][0];
    // Q[2][0] /= R[0][0];
    Q[0][0] *= temp_dbl;
    Q[1][0] *= temp_dbl;
    Q[2][0] *= temp_dbl;

    R[0][1] = Q[0][0] * Q[0][1] + Q[1][0] * Q[1][1] + Q[2][0] * Q[2][1];
    Q[0][1] -= Q[0][0] * R[0][1];
    Q[1][1] -= Q[1][0] * R[0][1];
    Q[2][1] -= Q[2][0] * R[0][1];

    R[0][2] = Q[0][0] * Q[0][2] + Q[1][0] * Q[1][2] + Q[2][0] * Q[2][2];
    Q[0][2] -= Q[0][0] * R[0][2];
    Q[1][2] -= Q[1][0] * R[0][2];
    Q[2][2] -= Q[2][0] * R[0][2];

    R[1][1]  = sqrt( Q[0][1] * Q[0][1] + Q[1][1] * Q[1][1] + Q[2][1] * Q[2][1] );
    temp_dbl = 1.0 / R[1][1];
    R[2][1]  = 0.0L;
    //     Q[0][1] /= R[1][1];
    //     Q[1][1] /= R[1][1];
    //     Q[2][1] /= R[1][1];
    Q[0][1] *= temp_dbl;
    Q[1][1] *= temp_dbl;
    Q[2][1] *= temp_dbl;

    R[1][2] = Q[0][1] * Q[0][2] + Q[1][1] * Q[1][2] + Q[2][1] * Q[2][2];
    Q[0][2] -= Q[0][1] * R[1][2];
    Q[1][2] -= Q[1][1] * R[1][2];
    Q[2][2] -= Q[2][1] * R[1][2];

    R[2][2]  = sqrt( Q[0][2] * Q[0][2] + Q[1][2] * Q[1][2] + Q[2][2] * Q[2][2] );
    temp_dbl = 1.0 / R[2][2];

    //     Q[0][2] /= R[2][2];
    //     Q[1][2] /= R[2][2];
    //     Q[2][2] /= R[2][2];
    Q[0][2] *= temp_dbl;
    Q[1][2] *= temp_dbl;
    Q[2][2] *= temp_dbl;

    return;
}
void MBMesquite::QR ( const MsqMatrix< 3, 3 > &  A,
MsqMatrix< 3, 3 > &  Q,
MsqMatrix< 3, 3 > &  R 
) [inline]

Compute QR factorization of A

Definition at line 1243 of file MsqMatrix.hpp.

References moab::R.

{
    Q = A;

    R( 0, 0 )       = sqrt( Q( 0, 0 ) * Q( 0, 0 ) + Q( 1, 0 ) * Q( 1, 0 ) + Q( 2, 0 ) * Q( 2, 0 ) );
    double temp_dbl = 1.0 / R( 0, 0 );
    R( 1, 0 )       = 0.0;
    R( 2, 0 )       = 0.0;
    Q( 0, 0 ) *= temp_dbl;
    Q( 1, 0 ) *= temp_dbl;
    Q( 2, 0 ) *= temp_dbl;

    R( 0, 1 ) = Q( 0, 0 ) * Q( 0, 1 ) + Q( 1, 0 ) * Q( 1, 1 ) + Q( 2, 0 ) * Q( 2, 1 );
    Q( 0, 1 ) -= Q( 0, 0 ) * R( 0, 1 );
    Q( 1, 1 ) -= Q( 1, 0 ) * R( 0, 1 );
    Q( 2, 1 ) -= Q( 2, 0 ) * R( 0, 1 );

    R( 0, 2 ) = Q( 0, 0 ) * Q( 0, 2 ) + Q( 1, 0 ) * Q( 1, 2 ) + Q( 2, 0 ) * Q( 2, 2 );
    Q( 0, 2 ) -= Q( 0, 0 ) * R( 0, 2 );
    Q( 1, 2 ) -= Q( 1, 0 ) * R( 0, 2 );
    Q( 2, 2 ) -= Q( 2, 0 ) * R( 0, 2 );

    R( 1, 1 ) = sqrt( Q( 0, 1 ) * Q( 0, 1 ) + Q( 1, 1 ) * Q( 1, 1 ) + Q( 2, 1 ) * Q( 2, 1 ) );
    temp_dbl  = 1.0 / R( 1, 1 );
    R( 2, 1 ) = 0.0;
    Q( 0, 1 ) *= temp_dbl;
    Q( 1, 1 ) *= temp_dbl;
    Q( 2, 1 ) *= temp_dbl;

    R( 1, 2 ) = Q( 0, 1 ) * Q( 0, 2 ) + Q( 1, 1 ) * Q( 1, 2 ) + Q( 2, 1 ) * Q( 2, 2 );
    Q( 0, 2 ) -= Q( 0, 1 ) * R( 1, 2 );
    Q( 1, 2 ) -= Q( 1, 1 ) * R( 1, 2 );
    Q( 2, 2 ) -= Q( 2, 1 ) * R( 1, 2 );

    R( 2, 2 ) = sqrt( Q( 0, 2 ) * Q( 0, 2 ) + Q( 1, 2 ) * Q( 1, 2 ) + Q( 2, 2 ) * Q( 2, 2 ) );
    temp_dbl  = 1.0 / R( 2, 2 );
    Q( 0, 2 ) *= temp_dbl;
    Q( 1, 2 ) *= temp_dbl;
    Q( 2, 2 ) *= temp_dbl;
}
void MBMesquite::QR ( const MsqMatrix< 2, 2 > &  A,
MsqMatrix< 2, 2 > &  Q,
MsqMatrix< 2, 2 > &  R 
) [inline]

Compute QR factorization of A

Definition at line 1285 of file MsqMatrix.hpp.

References moab::R.

{
    R( 0, 0 )          = std::sqrt( A( 0, 0 ) * A( 0, 0 ) + A( 1, 0 ) * A( 1, 0 ) );
    const double r0inv = 1.0 / R( 0, 0 );
    Q( 0, 0 ) = Q( 1, 1 ) = A( 0, 0 ) * r0inv;
    Q( 1, 0 )             = A( 1, 0 ) * r0inv;
    Q( 0, 1 )             = -Q( 1, 0 );
    R( 0, 1 )             = r0inv * ( A( 0, 0 ) * A( 0, 1 ) + A( 1, 0 ) * A( 1, 1 ) );
    R( 1, 1 )             = r0inv * ( A( 0, 0 ) * A( 1, 1 ) - A( 0, 1 ) * A( 1, 0 ) );
    R( 1, 0 )             = 0.0;
}
double MBMesquite::reduce_parallel_max ( double  value)

Definition at line 55 of file ParallelHelper.cpp.

References MPI_COMM_WORLD, and value().

{
    int is_init = 0;
    int err     = MPI_Initialized( &is_init );
    if( MPI_SUCCESS != err ) return value;
    if( !is_init ) return value;

    double d_max[1];
    double d_max_recv[1];
    d_max[0] = value;
    int rval = MPI_Allreduce( d_max, d_max_recv, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
    if( MPI_SUCCESS != rval ) return value;

    return d_max_recv[0];
}
static void MBMesquite::restore_bytes ( Mesh *  mesh,
std::vector< unsigned char > &  saved_bytes,
MsqError &  err 
) [static]

Definition at line 449 of file VertexMover.cpp.

References MBMesquite::Mesh::get_all_vertices(), MSQ_ERRRTN, and MBMesquite::Mesh::vertices_set_byte().

Referenced by MBMesquite::VertexMover::loop_over_mesh().

{
    std::vector< Mesh::VertexHandle > vertexHandlesArray;
    mesh->get_all_vertices( vertexHandlesArray, err );MSQ_ERRRTN( err );
    mesh->vertices_set_byte( &vertexHandlesArray[0], &saved_bytes[0], vertexHandlesArray.size(), err );MSQ_ERRRTN( err );
}
static void MBMesquite::save_or_restore_debug_state ( bool  save) [static]

Definition at line 456 of file VertexMover.cpp.

References moab::debug, MBMesquite::MsqDebug::enable(), and MBMesquite::MsqDebug::get().

Referenced by MBMesquite::VertexMover::loop_over_mesh().

{
    static bool debug[3] = { false, false, false };
    if( save )
    {
        debug[0] = MsqDebug::get( 1 );
        debug[1] = MsqDebug::get( 2 );
        debug[2] = MsqDebug::get( 3 );
    }
    else
    {
        if( debug[0] ) MsqDebug::enable( 1 );
        if( debug[1] ) MsqDebug::enable( 2 );
        if( debug[2] ) MsqDebug::enable( 3 );
    }
}
void MBMesquite::second_deriv_wrt_product_factor ( MsqMatrix< 3, 3 >  R[6],
const MsqMatrix< 3, 3 > &  Z 
) [inline]

Definition at line 293 of file TMPDerivs.hpp.

References moab::R, and MBMesquite::MeshWriter::Z.

Referenced by MBMesquite::TQualityMetric::evaluate_with_Hessian(), and MBMesquite::TQualityMetric::evaluate_with_Hessian_diagonal().

{
    second_deriv_wrt_product_factor_t< 3 >( R, Z );
}
void MBMesquite::second_deriv_wrt_product_factor ( MsqMatrix< 2, 2 >  R[3],
const MsqMatrix< 2, 2 > &  Z 
) [inline]

Definition at line 298 of file TMPDerivs.hpp.

References moab::R, and MBMesquite::MeshWriter::Z.

{
    second_deriv_wrt_product_factor_t< 2 >( R, Z );
}
template<unsigned D>
void MBMesquite::second_deriv_wrt_product_factor_t ( MsqMatrix< D, D >  R[D *(D+1)/2],
const MsqMatrix< D, D > &  Z 
) [inline]

\( \frac{\partial^2 f}{\partial (AZ)^2} \Rightarrow \frac{\partial^2 f}{\partial A^2} \)

Given the second derivatives of a function with respect to a matrix product, calculate the derivatives of the function with respect to the first matrix in the product.

Definition at line 893 of file TMPDerivs.hpp.

References transpose().

{
    const MsqMatrix< D, D > Zt = transpose( Z );
    for( unsigned i = 0; i < D * ( D + 1 ) / 2; ++i )
        R[i] = ( Z * R[i] ) * Zt;
}
static void MBMesquite::set_corner_derivatives ( unsigned  corner,
double  value,
size_t *  indices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [inline, static]

Definition at line 113 of file LinearPyramid.cpp.

References value().

Referenced by MBMesquite::LinearPyramid::derivatives().

{
    const unsigned adj_in_xi  = ( 5 - corner ) % 4;
    const unsigned adj_in_eta = 3 - corner;

    const int dxi_sign      = 2 * ( ( corner + 1 ) / 2 % 2 ) - 1;
    const int deta_sign     = 2 * ( corner / 2 ) - 1;
    const double dxi_value  = dxi_sign * value;
    const double deta_value = deta_sign * value;

    num_vtx    = 4;
    indices[0] = corner;
    indices[1] = adj_in_xi;
    indices[2] = adj_in_eta;
    indices[3] = 4;

    derivs[0][0] = dxi_value;
    derivs[0][1] = deta_value;
    derivs[0][2] = -1.0;

    derivs[1][0] = -dxi_value;
    derivs[1][1] = 0.0;
    derivs[1][2] = 0.0;

    derivs[2][0] = 0.0;
    derivs[2][1] = -deta_value;
    derivs[2][2] = 0.0;

    derivs[3][0] = 0.0;
    derivs[3][1] = 0.0;
    derivs[3][2] = 1.0;
}
static void MBMesquite::set_edge_derivatives ( unsigned  base_corner,
double  value,
size_t *  indices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [inline, static]

Definition at line 71 of file LinearPyramid.cpp.

References edge_beg, edge_end, and value().

Referenced by MBMesquite::LinearPyramid::derivatives().

{
    const int direction = base_corner % 2;
    const int edge_beg  = base_corner;
    const int edge_end  = ( base_corner + 1 ) % 4;
    const int adj_end   = ( base_corner + 2 ) % 4;
    const int adj_beg   = ( base_corner + 3 ) % 4;
    const int dir_sign  = 2 * ( edge_beg / 2 ) - 1;
    const int oth_sign  = 2 * ( ( edge_beg + 1 ) / 2 % 2 ) - 1;

    num_vtx    = 5;
    indices[0] = edge_beg;
    indices[1] = edge_end;
    indices[2] = adj_end;
    indices[3] = adj_beg;
    indices[4] = 4;

    derivs[0][direction]     = 2 * dir_sign * value;
    derivs[0][1 - direction] = oth_sign * value;
    derivs[0][2]             = -0.5;

    derivs[1][direction]     = -2 * dir_sign * value;
    derivs[1][1 - direction] = oth_sign * value;
    derivs[1][2]             = -0.5;

    derivs[2][direction]     = 0.0;
    derivs[2][1 - direction] = -oth_sign * value;
    derivs[2][2]             = 0.0;

    derivs[3][direction]     = 0.0;
    derivs[3][1 - direction] = -oth_sign * value;
    derivs[3][2]             = 0.0;

    derivs[4][0] = 0.0;
    derivs[4][1] = 0.0;
    derivs[4][2] = 1.0;
}
static void MBMesquite::set_equal_derivatives ( double  value,
size_t *  indices,
MsqVector< 3 > *  derivs,
size_t &  num_vtx 
) [inline, static]

Definition at line 41 of file LinearPyramid.cpp.

References value().

Referenced by MBMesquite::LinearPyramid::derivatives().

{
    num_vtx    = 5;
    indices[0] = 0;
    indices[1] = 1;
    indices[2] = 2;
    indices[3] = 3;
    indices[4] = 4;

    derivs[0][0] = -value;
    derivs[0][1] = -value;
    derivs[0][2] = -0.25;

    derivs[1][0] = value;
    derivs[1][1] = -value;
    derivs[1][2] = -0.25;

    derivs[2][0] = value;
    derivs[2][1] = value;
    derivs[2][2] = -0.25;

    derivs[3][0] = -value;
    derivs[3][1] = value;
    derivs[3][2] = -0.25;

    derivs[4][0] = 0.0;
    derivs[4][1] = 0.0;
    derivs[4][2] = 1.0;
}
template<unsigned R1, unsigned C1, unsigned R2, unsigned C2>
void MBMesquite::set_region ( MsqMatrix< R1, C1 > &  d,
unsigned  r,
unsigned  c,
MsqMatrix< R2, C2 > &  s 
) [inline]

Set a subset of this matrix to some other matrix.

Definition at line 750 of file MsqMatrix.hpp.

{
    const unsigned rmax = r + R2 > R1 ? R1 : r + R2;
    const unsigned cmax = c + C2 > C1 ? C1 : c + C2;
    for( unsigned i = r; i < rmax; ++i )
        for( unsigned j = c; j < cmax; ++j )
            d( i, j ) = s( i - r, j - c );
}
void MBMesquite::set_scaled_2nd_deriv_norm_sqr_adj ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &  T 
) [inline]
void MBMesquite::set_scaled_2nd_deriv_norm_sqr_adj ( MsqMatrix< 3, 3 >  R[6],
double  alpha,
const MsqMatrix< 3, 3 > &  T 
) [inline]

\( R += \alpha \frac{\partial^2}{\partial T^2}|adj T|^2 \)

Definition at line 451 of file TMPDerivs.hpp.

References set_scaled_outer_product(), sqr_Frobenius(), T, and transpose().

{
    set_scaled_outer_product( R, 1, T );
    double tmp01, tmp02, tmp12;
    // R[1] = 2*R[1] - transpose(R[1]);
    tmp01        = R[1]( 0, 1 );
    tmp02        = R[1]( 0, 2 );
    tmp12        = R[1]( 1, 2 );
    R[1]( 0, 1 ) = 2 * R[1]( 0, 1 ) - R[1]( 1, 0 );
    R[1]( 0, 2 ) = 2 * R[1]( 0, 2 ) - R[1]( 2, 0 );
    R[1]( 1, 2 ) = 2 * R[1]( 1, 2 ) - R[1]( 2, 1 );
    R[1]( 1, 0 ) = 2 * R[1]( 1, 0 ) - tmp01;
    R[1]( 2, 0 ) = 2 * R[1]( 2, 0 ) - tmp02;
    R[1]( 2, 1 ) = 2 * R[1]( 2, 1 ) - tmp12;
    // R[2] = 2*R[2] - transpose(R[1]);
    tmp01        = R[2]( 0, 1 );
    tmp02        = R[2]( 0, 2 );
    tmp12        = R[2]( 1, 2 );
    R[2]( 0, 1 ) = 2 * R[2]( 0, 1 ) - R[2]( 1, 0 );
    R[2]( 0, 2 ) = 2 * R[2]( 0, 2 ) - R[2]( 2, 0 );
    R[2]( 1, 2 ) = 2 * R[2]( 1, 2 ) - R[2]( 2, 1 );
    R[2]( 1, 0 ) = 2 * R[2]( 1, 0 ) - tmp01;
    R[2]( 2, 0 ) = 2 * R[2]( 2, 0 ) - tmp02;
    R[2]( 2, 1 ) = 2 * R[2]( 2, 1 ) - tmp12;
    // R[4] = 2*R[4] - transpose(R[1]);
    tmp01        = R[4]( 0, 1 );
    tmp02        = R[4]( 0, 2 );
    tmp12        = R[4]( 1, 2 );
    R[4]( 0, 1 ) = 2 * R[4]( 0, 1 ) - R[4]( 1, 0 );
    R[4]( 0, 2 ) = 2 * R[4]( 0, 2 ) - R[4]( 2, 0 );
    R[4]( 1, 2 ) = 2 * R[4]( 1, 2 ) - R[4]( 2, 1 );
    R[4]( 1, 0 ) = 2 * R[4]( 1, 0 ) - tmp01;
    R[4]( 2, 0 ) = 2 * R[4]( 2, 0 ) - tmp02;
    R[4]( 2, 1 ) = 2 * R[4]( 2, 1 ) - tmp12;

    const MsqMatrix< 3, 3 > TpT = transpose( T ) * T;
    R[0] -= TpT;
    R[3] -= TpT;
    R[5] -= TpT;

    const MsqMatrix< 3, 3 > TTp = T * transpose( T );
    const double ns             = sqr_Frobenius( T );
    R[0]( 0, 0 ) += ns - TTp( 0, 0 );
    R[0]( 1, 1 ) += ns - TTp( 0, 0 );
    R[0]( 2, 2 ) += ns - TTp( 0, 0 );
    R[1]( 0, 0 ) += -TTp( 0, 1 );
    R[1]( 1, 1 ) += -TTp( 0, 1 );
    R[1]( 2, 2 ) += -TTp( 0, 1 );
    R[2]( 0, 0 ) += -TTp( 0, 2 );
    R[2]( 1, 1 ) += -TTp( 0, 2 );
    R[2]( 2, 2 ) += -TTp( 0, 2 );
    R[3]( 0, 0 ) += ns - TTp( 1, 1 );
    R[3]( 1, 1 ) += ns - TTp( 1, 1 );
    R[3]( 2, 2 ) += ns - TTp( 1, 1 );
    R[4]( 0, 0 ) += -TTp( 1, 2 );
    R[4]( 1, 1 ) += -TTp( 1, 2 );
    R[4]( 2, 2 ) += -TTp( 1, 2 );
    R[5]( 0, 0 ) += ns - TTp( 2, 2 );
    R[5]( 1, 1 ) += ns - TTp( 2, 2 );
    R[5]( 2, 2 ) += ns - TTp( 2, 2 );

    alpha *= 2;
    R[0] *= alpha;
    R[1] *= alpha;
    R[2] *= alpha;
    R[3] *= alpha;
    R[4] *= alpha;
    R[5] *= alpha;
}
void MBMesquite::set_scaled_2nd_deriv_of_det ( MsqMatrix< 3, 3 >  R[6],
double  alpha,
const MsqMatrix< 3, 3 > &  T 
) [inline]

\( R = \alpha \frac{\partial}{\partial T}det(T) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 384 of file TMPDerivs.hpp.

Referenced by MBMesquite::TShapeNB1::evaluate_with_hess(), set_scaled_2nd_deriv_of_det(), QualityMetricTest::test_diagonal_tau(), QualityMetricTest::test_Hessian_tau(), and TMPDerivsTest::test_set_scaled_2nd_deriv_of_det().

{
    MsqMatrix< 3, 3 > A( T );
    A *= alpha;

    R[0] = R[3] = R[5] = MsqMatrix< 3, 3 >( 0.0 );

    R[1]( 0, 0 ) = R[1]( 1, 1 ) = R[1]( 2, 2 ) = 0;
    R[1]( 0, 1 )                               = A( 2, 2 );
    R[1]( 1, 0 )                               = -A( 2, 2 );
    R[1]( 0, 2 )                               = -A( 2, 1 );
    R[1]( 2, 0 )                               = A( 2, 1 );
    R[1]( 1, 2 )                               = A( 2, 0 );
    R[1]( 2, 1 )                               = -A( 2, 0 );

    R[2]( 0, 0 ) = R[2]( 1, 1 ) = R[2]( 2, 2 ) = 0;
    R[2]( 0, 1 )                               = -A( 1, 2 );
    R[2]( 1, 0 )                               = A( 1, 2 );
    R[2]( 0, 2 )                               = A( 1, 1 );
    R[2]( 2, 0 )                               = -A( 1, 1 );
    R[2]( 1, 2 )                               = -A( 1, 0 );
    R[2]( 2, 1 )                               = A( 1, 0 );

    R[4]( 0, 0 ) = R[4]( 1, 1 ) = R[4]( 2, 2 ) = 0;
    R[4]( 0, 1 )                               = A( 0, 2 );
    R[4]( 1, 0 )                               = -A( 0, 2 );
    R[4]( 0, 2 )                               = -A( 0, 1 );
    R[4]( 2, 0 )                               = A( 0, 1 );
    R[4]( 1, 2 )                               = A( 0, 0 );
    R[4]( 2, 1 )                               = -A( 0, 0 );
}
void MBMesquite::set_scaled_2nd_deriv_of_det ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

\( R = \alpha \frac{\partial}{\partial T}det(T) \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 422 of file TMPDerivs.hpp.

{
    R[0] = R[2]  = MsqMatrix< 2, 2 >( 0.0 );
    R[1]( 0, 0 ) = 0.0;
    R[1]( 0, 1 ) = alpha;
    R[1]( 1, 0 ) = -alpha;
    R[1]( 1, 1 ) = 0.0;
}
void MBMesquite::set_scaled_2nd_deriv_of_det ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &   
) [inline]

Definition at line 133 of file TMPDerivs.hpp.

References set_scaled_2nd_deriv_of_det().

void MBMesquite::set_scaled_2nd_deriv_wrt_psi ( MsqMatrix< 2, 2 >  R[3],
const double  alpha,
const double  psi,
const MsqMatrix< 2, 2 > &  T 
) [inline]

\( R = \alpha * \frac{\partial^2 \psi(T)}{\partial T^2} \)

\( \psi(T) = \sqrt{ |T|^2 + 2 \tau } \)

Definition at line 900 of file TMPDerivs.hpp.

References t, T, and trace().

Referenced by MBMesquite::TShapeSize2DNB1::evaluate_with_hess(), and MBMesquite::TShapeSize2DNB2::evaluate_with_hess().

{
    const double t = trace( T );
    const double f = alpha / ( psi * psi * psi );
    const double s = T( 0, 1 ) - T( 1, 0 );
    R[0]( 0, 0 ) = R[1]( 0, 1 ) = R[2]( 1, 1 ) = f * s * s;
    R[0]( 0, 1 ) = R[0]( 1, 0 ) = R[1]( 1, 1 ) = -f * s * t;
    R[1]( 0, 0 ) = R[2]( 0, 1 ) = R[2]( 1, 0 ) = f * s * t;
    R[0]( 1, 1 ) = R[2]( 0, 0 ) = -( R[1]( 1, 0 ) = -f * t * t );
}
void MBMesquite::set_scaled_I ( MsqMatrix< 3, 3 >  R[6],
double  alpha 
) [inline]

\( R = \alpha I_9 \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 319 of file TMPDerivs.hpp.

Referenced by MBMesquite::TShapeNB1::evaluate_with_hess(), hess(), MBMesquite::TUntangleBeta::hess(), MBMesquite::TUntangleMu::hess(), set_scaled_2nd_deriv_norm_sqr_adj(), and TMPDerivsTest::test_set_scaled_I().

{
    R[0] = R[3] = R[5] = MsqMatrix< 3, 3 >( alpha );
    R[1] = R[2] = R[4] = MsqMatrix< 3, 3 >( 0.0 );
}
void MBMesquite::set_scaled_I ( MsqMatrix< 2, 2 >  R[3],
double  alpha 
) [inline]

\( R = \alpha I_4 \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 345 of file TMPDerivs.hpp.

{
    R[0] = R[2] = MsqMatrix< 2, 2 >( alpha );
    R[1]        = MsqMatrix< 2, 2 >( 0.0 );
}
void MBMesquite::set_scaled_outer_product ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &  M 
) [inline]

Definition at line 192 of file TMPDerivs.hpp.

References moab::R.

{
    set_scaled_outer_product_t< 2 >( R, alpha, M );
}
template<unsigned D>
void MBMesquite::set_scaled_outer_product_t ( MsqMatrix< D, D >  R[D *(D+1)/2],
double  alpha,
const MsqMatrix< D, D > &  M 
) [inline]

\( R = \alpha \left( M \otimes M \right) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 547 of file TMPDerivs.hpp.

References moab::R, MBMesquite::MsqMatrix< R, C >::row(), and transpose().

{
    MsqMatrix< D, D > aM( M );
    aM *= alpha;
    unsigned h = 0;
    for( unsigned i = 0; i < D; ++i )
        for( unsigned j = i; j < D; ++j )
            R[h++] = transpose( aM.row( i ) ) * M.row( j );
}
void MBMesquite::set_scaled_sum_outer_product ( MsqMatrix< 3, 3 >  R[6],
double  alpha,
const MsqMatrix< 3, 3 > &  A,
const MsqMatrix< 3, 3 > &  B 
) [inline]

\( R = \alpha \left( A \otimes B + B \otimes A \right) \)

Parameters:
RThe 6 blocks of the upper triangular portion of a 9x9 symmetric matrix.

Definition at line 603 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::row(), and transpose().

Referenced by MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeOrientB2::evaluate_with_hess(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_2D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_3D(), and TMPDerivsTest::test_set_scaled_sum_outer_product_3D().

{
    // apply scalar first
    MsqMatrix< 3, 3 > A( A_in );
    A *= alpha;

    // block 0,0
    R[0] = transpose( A.row( 0 ) ) * B.row( 0 );
    R[0] += transpose( R[0] );

    // block 1,1
    R[3] = transpose( A.row( 1 ) ) * B.row( 1 );
    R[3] += transpose( R[3] );

    // block 2,2
    R[5] = transpose( A.row( 2 ) ) * B.row( 2 );
    R[5] += transpose( R[5] );

    // block 0,1
    R[1] = transpose( A.row( 0 ) ) * B.row( 1 );
    R[1] += transpose( B.row( 0 ) ) * A.row( 1 );

    // block 0,2
    R[2] = transpose( A.row( 0 ) ) * B.row( 2 );
    R[2] += transpose( B.row( 0 ) ) * A.row( 2 );

    // block 1,2
    R[4] = transpose( A.row( 1 ) ) * B.row( 2 );
    R[4] += transpose( B.row( 1 ) ) * A.row( 2 );
}
void MBMesquite::set_scaled_sum_outer_product ( MsqMatrix< 2, 2 >  R[3],
double  alpha,
const MsqMatrix< 2, 2 > &  A,
const MsqMatrix< 2, 2 > &  B 
) [inline]

\( R = \alpha \left( A \otimes B + B \otimes A \right) \)

Parameters:
RThe 3 blocks of the upper triangular portion of a 4x4 symmetric matrix.

Definition at line 728 of file TMPDerivs.hpp.

References MBMesquite::MsqMatrix< R, C >::row(), and transpose().

{
    // apply scalar first
    MsqMatrix< 2, 2 > A( A_in );
    A *= alpha;

    // block 0,0
    R[0] = transpose( A.row( 0 ) ) * B.row( 0 );
    R[0] += transpose( R[0] );

    // block 1,1
    R[2] = transpose( A.row( 1 ) ) * B.row( 1 );
    R[2] += transpose( R[2] );

    // block 0,1
    R[1] = transpose( A.row( 0 ) ) * B.row( 1 );
    R[1] += transpose( B.row( 0 ) ) * A.row( 1 );
}
template<unsigned R, unsigned C>
double MBMesquite::sqr_Frobenius ( const MsqMatrix< R, C > &  m) [inline]

Definition at line 1089 of file MsqMatrix.hpp.

References C, MBMesquite::MsqMatrix< R, C >::data(), and moab::R.

Referenced by eval(), MBMesquite::TShapeSize2DB2::evaluate(), MBMesquite::TShapeSize2DNB1::evaluate(), MBMesquite::TShapeSize2DNB2::evaluate(), MBMesquite::TShape2DNB2::evaluate(), MBMesquite::TShapeSize3DB2::evaluate(), MBMesquite::TShapeSizeB1::evaluate(), MBMesquite::TShapeSizeOrientB1::evaluate(), MBMesquite::TInverseMeanRatio::evaluate(), MBMesquite::TShapeSizeB3::evaluate(), MBMesquite::AWShape2DNB1::evaluate(), MBMesquite::TShapeSizeOrientB2::evaluate(), MBMesquite::TShapeOrientB2::evaluate(), MBMesquite::AWShape2DB1::evaluate(), MBMesquite::AWShape2DNB2::evaluate(), MBMesquite::AWShapeSizeB1::evaluate(), MBMesquite::TShapeSizeNB3::evaluate(), MBMesquite::TShapeNB1::evaluate(), MBMesquite::TShape3DB2::evaluate(), MBMesquite::TShapeB1::evaluate(), HessTestMetricRel::evaluate(), HessTestMetricAbs::evaluate(), TestGradTargetMetric< Base >::evaluate(), MBMesquite::TShapeSize2DB2::evaluate_with_grad(), MBMesquite::TShapeSize2DNB1::evaluate_with_grad(), MBMesquite::TShapeSize2DNB2::evaluate_with_grad(), MBMesquite::TShapeSize3DB2::evaluate_with_grad(), MBMesquite::TShape2DNB2::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB1::evaluate_with_grad(), MBMesquite::TShapeSizeB3::evaluate_with_grad(), MBMesquite::TInverseMeanRatio::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB2::evaluate_with_grad(), MBMesquite::TShapeOrientB2::evaluate_with_grad(), MBMesquite::AWShape2DNB2::evaluate_with_grad(), MBMesquite::AWShape2DNB1::evaluate_with_grad(), MBMesquite::TShapeSizeNB3::evaluate_with_grad(), MBMesquite::TShapeNB1::evaluate_with_grad(), MBMesquite::TShapeB1::evaluate_with_grad(), MBMesquite::TShape3DB2::evaluate_with_grad(), HessTestMetricAbs::evaluate_with_grad(), HessTestMetricRel::evaluate_with_grad(), TestGradTargetMetric< Base >::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeSize2DB2::evaluate_with_hess(), MBMesquite::TShapeSize2DNB1::evaluate_with_hess(), MBMesquite::TShape2DNB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShapeSize2DNB2::evaluate_with_hess(), MBMesquite::TShapeSizeB3::evaluate_with_hess(), MBMesquite::TInverseMeanRatio::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::TShapeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeNB3::evaluate_with_hess(), MBMesquite::TShapeB1::evaluate_with_hess(), MBMesquite::TShapeNB1::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), first_deriv_norm_sqr_adj(), grad(), hess(), set_scaled_2nd_deriv_norm_sqr_adj(), sqr_length(), MsqMatrixTest::test_frobenius(), TMPQualityMetricTest< QMType >::test_gradient_3D(), and TMPQualityMetricTest< QMType >::test_gradient_common().

{
    double result = *m.data() * *m.data();
    for( unsigned i = 1; i < R * C; ++i )
        result += m.data()[i] * m.data()[i];
    return result;
}
template<unsigned R>
double MBMesquite::sqr_length ( const MsqMatrix< R, 1 > &  v) [inline]

Definition at line 1135 of file MsqMatrix.hpp.

References sqr_Frobenius().

Referenced by MsqMatrixTest::test_vec_length().

{
    return sqr_Frobenius( v );
}
template<unsigned C>
double MBMesquite::sqr_length ( const MsqMatrix< 1, C > &  v) [inline]

Definition at line 1141 of file MsqMatrix.hpp.

References sqr_Frobenius().

{
    return sqr_Frobenius( v );
}
template<typename HessIter >
static double MBMesquite::sum_corner_diagonals ( EntityTopology  type,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
HessIter  corner_diag_blocks,
Vector3D  vertex_grads[],
SymMatrix3D  vertex_hessians[] 
) [inline, static]

Definition at line 141 of file AveragingQM.cpp.

References grad(), hess(), n, and moab::R.

Referenced by average_corner_diagonals().

{
    unsigned i, n, r, R, idx[4];
    const unsigned* adj_list;
    double avg = 0.0;

    // calculate mean
    for( i = 0; i < num_corner; ++i )
        avg += corner_values[i];

    const Vector3D* grad = corner_grads;
    HessIter hess        = corner_diag_blocks;
    for( i = 0; i < num_corner; ++i )
    {
        adj_list = TopologyInfo::adjacent_vertices( type, i, n );
        idx[0]   = i;
        idx[1]   = adj_list[0];
        idx[2]   = adj_list[1];
        idx[3]   = adj_list[2 % n];  // %n so don't read off end if 2D

        for( r = 0; r <= n; ++r )
        {
            R = idx[r];
            vertex_grads[R] += *grad;
            vertex_hessians[R] += *hess;
            ++grad;
            ++hess;
        }
    }
    return avg;
}
static double MBMesquite::sum_corner_hessians ( EntityTopology  type,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
const Matrix3D  corner_hessians[],
Vector3D  vertex_grads[],
Matrix3D  vertex_hessians[] 
) [inline, static]

Definition at line 383 of file AveragingQM.cpp.

References C, corners, grad(), hess(), n, N, and moab::R.

Referenced by MBMesquite::AveragingQM::average_corner_hessians().

{
    const unsigned N = TopologyInfo::corners( type );
    unsigned i, n, r, c, R, C, idx[4];
    const unsigned* adj_list;
    double avg = 0.0;

    // calculate mean
    for( i = 0; i < num_corner; ++i )
        avg += corner_values[i];

    const Vector3D* grad = corner_grads;
    const Matrix3D* hess = corner_hessians;
    for( i = 0; i < num_corner; ++i )
    {
        adj_list = TopologyInfo::adjacent_vertices( type, i, n );
        idx[0]   = i;
        idx[1]   = adj_list[0];
        idx[2]   = adj_list[1];
        idx[3]   = adj_list[2 % n];  // %n so don't read off end if 2D

        for( r = 0; r <= n; ++r )
        {
            R = idx[r];
            vertex_grads[R] += *grad;
            ++grad;
            for( c = r; c <= n; ++c )
            {
                C = idx[c];
                if( R <= C )
                    vertex_hessians[N * R - R * ( R + 1 ) / 2 + C] += *hess;
                else
                    vertex_hessians[N * C - C * ( C + 1 ) / 2 + R].plus_transpose_equal( *hess );
                ++hess;
            }
        }
    }
    return avg;
}
template<typename HessIter >
static double MBMesquite::sum_sqr_corner_diagonals ( EntityTopology  type,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
HessIter  corner_diag_blocks,
Vector3D  vertex_grads[],
SymMatrix3D  vertex_hessians[] 
) [inline, static]

Definition at line 180 of file AveragingQM.cpp.

References grad(), hess(), n, outer(), and moab::R.

Referenced by average_corner_diagonals().

{
    unsigned i, n, r, R, idx[4];
    const unsigned* adj_list;
    double v, avg = 0.0;

    // calculate mean
    for( i = 0; i < num_corner; ++i )
        avg += corner_values[i] * corner_values[i];

    const Vector3D* grad = corner_grads;
    HessIter hess        = corner_diag_blocks;
    for( i = 0; i < num_corner; ++i )
    {
        adj_list = TopologyInfo::adjacent_vertices( type, i, n );
        idx[0]   = i;
        idx[1]   = adj_list[0];
        idx[2]   = adj_list[1];
        idx[3]   = adj_list[2 % n];  // %n so don't read off end if 2D
        ++n;

        v = 2.0 * corner_values[i];
        for( r = 0; r < n; ++r )
        {
            R = idx[r];
            vertex_grads[R] += v * *grad;
            vertex_hessians[R] += 2.0 * outer( *grad );
            vertex_hessians[R] += v * *hess;
            ++grad;
            ++hess;
        }
    }
    return avg;
}
static double MBMesquite::sum_sqr_corner_hessians ( EntityTopology  type,
unsigned  num_corner,
const double  corner_values[],
const Vector3D  corner_grads[],
const Matrix3D  corner_hessians[],
Vector3D  vertex_grads[],
Matrix3D  vertex_hessians[] 
) [inline, static]

Definition at line 429 of file AveragingQM.cpp.

References C, corners, grad(), hess(), n, N, MBMesquite::Matrix3D::outer_product(), and moab::R.

Referenced by MBMesquite::AveragingQM::average_corner_hessians().

{
    const unsigned N = TopologyInfo::corners( type );
    unsigned i, n, r, c, R, C, idx[4];
    const unsigned* adj_list;
    double v, avg = 0.0;
    Matrix3D op;

    // calculate mean
    for( i = 0; i < num_corner; ++i )
        avg += corner_values[i] * corner_values[i];

    const Vector3D* grad = corner_grads;
    const Matrix3D* hess = corner_hessians;
    for( i = 0; i < num_corner; ++i )
    {
        adj_list = TopologyInfo::adjacent_vertices( type, i, n );
        idx[0]   = i;
        idx[1]   = adj_list[0];
        idx[2]   = adj_list[1];
        idx[3]   = adj_list[2 % n];  // %n so don't read off end if 2D
        ++n;

        v = 2.0 * corner_values[i];
        for( r = 0; r < n; ++r )
        {
            R = idx[r];
            vertex_grads[R] += v * grad[r];
            for( c = r; c < n; ++c )
            {
                C = idx[c];
                op.outer_product( 2.0 * grad[r], grad[c] );
                op += v * *hess;
                if( R <= C )
                    vertex_hessians[N * R - R * ( R + 1 ) / 2 + C] += op;
                else
                    vertex_hessians[N * C - C * ( C + 1 ) / 2 + R].plus_transpose_equal( op );
                ++hess;
            }
        }
        grad += n;
    }
    return avg;
}
void MBMesquite::surface_to_2d ( const MsqMatrix< 3, 2 > &  A,
const MsqMatrix< 3, 2 > &  W_32,
MsqMatrix< 2, 2 > &  W_22,
MsqMatrix< 3, 2 > &  RZ 
)

Calculate R and Z such that \(W\prime = Z^{-1} W\) and \(A\prime = (RZ)^{-1} A\).

Calculate the matrices required to transform the active and target matrices from the 3x2 surface domain to a 2x2 2D domain.

Parameters:
AInput: Element Jacobian matrix.
W_32Input: Target Jacobian matrix.
W_22Output: 2D Target matrix.
RZOutput: Product of R and Z needed to calculate the 2D element matrix.

Definition at line 42 of file TargetMetricUtil.cpp.

References MBMesquite::MsqMatrix< R, C >::column(), moab::dot(), length(), np, nr, transpose(), MBMesquite::MeshWriter::Z, and z.

Referenced by MBMesquite::AffineMapMetric::evaluate().

{
    MsqMatrix< 3, 1 > W1 = W.column( 0 );
    MsqMatrix< 3, 1 > W2 = W.column( 1 );
    MsqMatrix< 3, 1 > nw = W1 * W2;
    nw *= 1.0 / length( nw );

    MsqMatrix< 3, 1 > z[2];
    z[0] = W1 * ( 1.0 / length( W1 ) );
    z[1] = nw * z[0];
    MsqMatrix< 3, 2 > Z( z );

    MsqMatrix< 3, 1 > np = A.column( 0 ) * A.column( 1 );
    np *= 1.0 / length( np );
    double dot           = np % nw;
    MsqMatrix< 3, 1 > nr = ( dot >= 0.0 ) ? nw : -nw;
    MsqMatrix< 3, 1 > v  = nr * np;
    double vlen          = length( v );
    if( vlen < DBL_EPSILON )
    {
        RZ = Z;  // R = I
    }
    else
    {
        v *= 1.0 / vlen;
        MsqMatrix< 3, 1 > r1[3] = { v, np, v * np };
        MsqMatrix< 3, 1 > r2[3] = { v, nr, v * nr };
        MsqMatrix< 3, 3 > R1( r1 ), R2( r2 );
        RZ = R1 * transpose( R2 ) * Z;
    }

    W_22 = transpose( Z ) * W;
}
static void MBMesquite::times_eq_minus ( Vector3D *  v,
double  s,
const Vector3D *  x,
size_t  n 
) [inline, static]

Definition at line 112 of file TrustRegion.cpp.

References n.

Referenced by MBMesquite::TrustRegion::optimize_vertex_positions().

{
    Vector3D* end = v + n;
    for( ; v != end; ++v, ++x )
    {
        *v *= s;
        *v -= *x;
    }
}
void MBMesquite::timesInvA ( Matrix3D &  B,
const Matrix3D &  A 
) [inline]

Definition at line 828 of file Matrix3D.hpp.

References inv().

Referenced by Matrix3DTest::test_B_times_invA().

{

    Matrix3D Ainv;
    inv( Ainv, A );
    B = B * Ainv;
}
const SymMatrix3D& MBMesquite::transpose ( const SymMatrix3D &  a) [inline]

Definition at line 231 of file SymMatrix3D.hpp.

{
    return a;
}
Matrix3D MBMesquite::transpose ( const Matrix3D &  A) [inline]

Definition at line 506 of file Matrix3D.hpp.

References MBMesquite::Matrix3D::v_.

Referenced by MBMesquite::CompareQM::check_hess(), TargetCalculatorTest::check_valid_V(), ObjectiveFunctionTests::compare_numerical_hessian(), LinearMappingFunctionTest::do_ideal_test(), do_numerical_hessian(), IdealTargetTest::do_test(), MBMesquite::TShape2DNB2::evaluate(), MBMesquite::AWShape2DNB1::evaluate(), MBMesquite::AWShapeSizeB1::evaluate(), MBMesquite::AffineMapMetric::evaluate(), HessTestMetricRel::evaluate(), HessTestMetricAbs::evaluate(), MBMesquite::TShape2DNB2::evaluate_with_grad(), MBMesquite::TShapeSize3DB2::evaluate_with_grad(), MBMesquite::AWShape2DNB1::evaluate_with_grad(), MBMesquite::AWShape2DNB2::evaluate_with_grad(), MBMesquite::TShape3DB2::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB2::evaluate_with_grad(), HessTestMetricAbs::evaluate_with_grad(), HessTestMetricRel::evaluate_with_grad(), MBMesquite::TQualityMetric::evaluate_with_gradient(), MBMesquite::TShape2DNB2::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TInverseMeanRatio::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), HessTestMetricRel_2::evaluate_with_hess(), HessTestMetricAbs_2::evaluate_with_hess(), MBMesquite::TQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian(), CompareMetric::evaluate_with_Hessian(), MBMesquite::TQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::AWQualityMetric::evaluate_with_Hessian_diagonal(), first_deriv_norm_sqr_adj(), TMetricTest< Metric, DIM >::grad(), TMetricTest< Metric, DIM >::hess(), hessian(), hessian_diagonal(), MBMesquite::MappingFunction2D::ideal(), MBMesquite::MappingFunction3D::ideal(), MBMesquite::MappingFunction2D::jacobian(), MBMesquite::MappingFunction3D::jacobian(), TMetricTest< Metric, DIM >::num_grad(), TMetricTest< Metric, DIM >::num_hess(), pluseq_outer_product_I(), pluseq_scaled_outer_product_t(), pluseq_scaled_sum_outer_product(), pmean_of_triangle_corner_hessians(), project_to_perp_plane(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), second_deriv_wrt_product_factor_t(), set_scaled_2nd_deriv_norm_sqr_adj(), set_scaled_outer_product_t(), set_scaled_sum_outer_product(), surface_to_2d(), QualityMetricTest::test_diagonal_tau(), TargetCalculatorTest::test_factor_2D(), TargetCalculatorTest::test_factor_surface(), TMPQualityMetricTest< QMType >::test_gradient_3D(), TMPQualityMetricTest< QMType >::test_gradient_common(), QualityMetricTest::test_gradient_tau(), PMeanPMetricTest::test_hessian(), QualityMetricTest::test_Hessian_tau(), MappingFunctionTest::test_ideal_2d(), MappingFunctionTest::test_ideal_3d(), TriLagrangeShapeTest::test_ideal_jacobian(), QuadLagrangeShapeTest::test_ideal_jacobian(), TetLagrangeShapeTest::test_ideal_jacobian(), HexLagrangeShapeTest::test_ideal_jacobian(), MappingFunctionTest::test_jacobian_2d(), MappingFunctionTest::test_jacobian_3d(), CompositeOFTest::test_multiply_hess_diagonal(), TMPDerivsTest::test_pluseq_scaled_outer_product(), MsqMatrixTest::test_qr(), TMPDerivsTest::test_set_scaled_outer_product(), TMPDerivsTest::test_set_scaled_sum_outer_product_2D(), TMPDerivsTest::test_set_scaled_sum_outer_product_3D(), Matrix3DTest::test_transpose(), and MsqMatrixTest::test_vec_outer_product().

{
    Matrix3D S;
    //     size_t i;
    //     for (i=0; i<3; ++i) {
    //         S[size_t(0)][i] = A[i][0];
    //         S[size_t(1)][i] = A[i][1];
    //         S[size_t(2)][i] = A[i][2];
    //     }
    S.v_[0] = A.v_[0];
    S.v_[1] = A.v_[3];
    S.v_[2] = A.v_[6];
    S.v_[3] = A.v_[1];
    S.v_[4] = A.v_[4];
    S.v_[5] = A.v_[7];
    S.v_[6] = A.v_[2];
    S.v_[7] = A.v_[5];
    S.v_[8] = A.v_[8];

    return S;
}
template<unsigned R, unsigned C>
MsqMatrix< R, C > MBMesquite::transpose ( const MsqMatrix< C, R > &  m) [inline]

Definition at line 1062 of file MsqMatrix.hpp.

References C, and moab::R.

{
    MsqMatrix< R, C > result;
    for( unsigned r = 0; r < R; ++r )
        for( unsigned c = 0; c < C; ++c )
            result( r, c ) = m( c, r );
    return result;
}
MsqMatrix< 2, 2 > MBMesquite::transpose_adj ( const MsqMatrix< 2, 2 > &  m) [inline]

Definition at line 1007 of file MsqMatrix.hpp.

Referenced by MBMesquite::InvTransBarrier::evaluate(), MBMesquite::AWShapeSizeB1::evaluate(), MBMesquite::TShapeSizeB1::evaluate(), MBMesquite::TShape2DNB2::evaluate_with_grad(), MBMesquite::TShapeOrientB1::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB1::evaluate_with_grad(), MBMesquite::TShapeSize2DB2::evaluate_with_grad(), MBMesquite::TSizeB1::evaluate_with_grad(), MBMesquite::TShapeSize2DNB1::evaluate_with_grad(), MBMesquite::TShapeSize2DNB2::evaluate_with_grad(), MBMesquite::TShapeSize3DB2::evaluate_with_grad(), MBMesquite::TShapeSizeB3::evaluate_with_grad(), MBMesquite::TInverseMeanRatio::evaluate_with_grad(), MBMesquite::TShapeOrientB2::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB2::evaluate_with_grad(), MBMesquite::TShapeSizeNB3::evaluate_with_grad(), MBMesquite::AWShape2DNB1::evaluate_with_grad(), MBMesquite::TShape3DB2::evaluate_with_grad(), MBMesquite::AWSizeB1::evaluate_with_grad(), MBMesquite::TShapeB1::evaluate_with_grad(), MBMesquite::TShapeNB1::evaluate_with_grad(), MBMesquite::TShapeSize3DB4::evaluate_with_grad(), MBMesquite::TShapeSize3DNB1::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSize2DNB1::evaluate_with_hess(), MBMesquite::TShape2DNB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSize2DB2::evaluate_with_hess(), MBMesquite::TSizeB1::evaluate_with_hess(), MBMesquite::TShapeSize2DNB2::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShapeSizeB3::evaluate_with_hess(), MBMesquite::TInverseMeanRatio::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::TShapeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeNB3::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), MBMesquite::TShapeNB1::evaluate_with_hess(), MBMesquite::TShapeB1::evaluate_with_hess(), MBMesquite::TShapeSize3DB4::evaluate_with_hess(), MBMesquite::TShapeSize3DNB1::evaluate_with_hess(), MBMesquite::TUntangleBeta::grad(), MBMesquite::TUntangle1::grad(), MBMesquite::AWUntangleBeta::grad(), MBMesquite::TUntangleBeta::hess(), and MBMesquite::TUntangle1::hess().

{
    MsqMatrix< 2, 2 > result;
    result( 0, 0 ) = m( 1, 1 );
    result( 1, 0 ) = -m( 0, 1 );
    result( 0, 1 ) = -m( 1, 0 );
    result( 1, 1 ) = m( 0, 0 );
    return result;
}
MsqMatrix< 3, 3 > MBMesquite::transpose_adj ( const MsqMatrix< 3, 3 > &  m) [inline]

Definition at line 1036 of file MsqMatrix.hpp.

{
    MsqMatrix< 3, 3 > result;

    result( 0, 0 ) = m( 1, 1 ) * m( 2, 2 ) - m( 1, 2 ) * m( 2, 1 );
    result( 0, 1 ) = m( 1, 2 ) * m( 2, 0 ) - m( 1, 0 ) * m( 2, 2 );
    result( 0, 2 ) = m( 1, 0 ) * m( 2, 1 ) - m( 1, 1 ) * m( 2, 0 );

    result( 1, 0 ) = m( 0, 2 ) * m( 2, 1 ) - m( 0, 1 ) * m( 2, 2 );
    result( 1, 1 ) = m( 0, 0 ) * m( 2, 2 ) - m( 0, 2 ) * m( 2, 0 );
    result( 1, 2 ) = m( 0, 1 ) * m( 2, 0 ) - m( 0, 0 ) * m( 2, 1 );

    result( 2, 0 ) = m( 0, 1 ) * m( 1, 2 ) - m( 0, 2 ) * m( 1, 1 );
    result( 2, 1 ) = m( 0, 2 ) * m( 1, 0 ) - m( 0, 0 ) * m( 1, 2 );
    result( 2, 2 ) = m( 0, 0 ) * m( 1, 1 ) - m( 0, 1 ) * m( 1, 0 );

    return result;
}
const Vector3D * MBMesquite::unit_edge_element ( EntityTopology  type,
bool  unit_height_pyramid = false 
)

Get ideal element with unit edge length.

Get list of vertex coordinates for an ideal element with it's centroid at the origin and all edges of unit length. Surface elements lie in the XY plane.

Parameters:
typethe type of the element to obtain.
unit_height_pyramidIf true, ideal pyramid has it's height equal to the length of an edge of the base, rather than the default of equilateral triangular faces.
Returns:
corner vertex coordinates in canonical order.

Definition at line 67 of file IdealElements.cpp.

References init_unit_edge(), MIXED, and PYRAMID.

Referenced by create_ideal_element_patch(), LinearMappingFunctionTest::do_ideal_test(), QualityMetricTester::get_ideal_element(), MappingFunctionTest::test_ideal_2d(), MappingFunctionTest::test_ideal_3d(), TriLagrangeShapeTest::test_ideal_jacobian(), QuadLagrangeShapeTest::test_ideal_jacobian(), TetLagrangeShapeTest::test_ideal_jacobian(), TargetCalculatorTest::test_ideal_shape_pyramid(), TargetCalculatorTest::test_ideal_skew_prism(), TargetCalculatorTest::test_ideal_skew_pyramid(), TargetCalculatorTest::test_ideal_skew_tet(), TargetCalculatorTest::test_ideal_skew_tri(), IdealElementTest::test_unit_edge_hex(), IdealElementTest::test_unit_edge_pyr(), IdealElementTest::test_unit_edge_quad(), IdealElementTest::test_unit_edge_tet(), IdealElementTest::test_unit_edge_tri(), IdealElementTest::test_unit_edge_wdg(), and IdealElementTest::test_unit_height_pyr().

{
    static Vector3D* values[MIXED + 1];
    static const Vector3D* const* data = init_unit_edge( values );
    return ( ptype == PYRAMID && punit_pyr ) ? data[MIXED] : data[ptype];
}
const Vector3D * MBMesquite::unit_element ( EntityTopology  type,
bool  unit_height_pyramid = false 
)

Get ideal element with unit area or volume.

Get list of vertex coordinates for an ideal element with it's centroid at the origin and unit area/volume. Surface elements lie in the XY plane.

Parameters:
typethe type of the element to obtain.
unit_height_pyramidIf true, ideal pyramid has it's height equal to the length of an edge of the base, rather than the default of equilateral triangular faces.
Returns:
corner vertex coordinates in canonical order.

Definition at line 74 of file IdealElements.cpp.

References init_unit_elem(), MIXED, and PYRAMID.

Referenced by QualityMetricTester::get_ideal_element(), IdealTargetTest::get_ideal_target(), MBMesquite::MappingFunction2D::ideal(), MBMesquite::MappingFunction3D::ideal(), IdealElementTest::test_side_height_pyr(), IdealElementTest::test_unit_hex(), IdealElementTest::test_unit_pyr(), IdealElementTest::test_unit_quad(), IdealElementTest::test_unit_tet(), IdealElementTest::test_unit_tri(), and IdealElementTest::test_unit_wdg().

{
    static Vector3D* values[MIXED + 1];
    static const Vector3D* const* data = init_unit_elem( values );
    return ( ptype == PYRAMID && punit_pyr ) ? data[MIXED] : data[ptype];
}
double MBMesquite::vector_product ( const MsqMatrix< 2, 1 > &  v1,
const MsqMatrix< 2, 1 > &  v2 
) [inline]

Definition at line 1188 of file MsqMatrix.hpp.

Referenced by operator*().

{
    return v1( 0, 0 ) * v2( 1, 0 ) - v1( 1, 0 ) * v2( 0, 0 );
}
double MBMesquite::vector_product ( const MsqMatrix< 1, 2 > &  v1,
const MsqMatrix< 1, 2 > &  v2 
) [inline]

Definition at line 1193 of file MsqMatrix.hpp.

{
    return v1( 0, 0 ) * v2( 0, 1 ) - v1( 0, 1 ) * v2( 0, 0 );
}
MsqMatrix< 3, 1 > MBMesquite::vector_product ( const MsqMatrix< 3, 1 > &  a,
const MsqMatrix< 3, 1 > &  b 
) [inline]

Definition at line 1198 of file MsqMatrix.hpp.

References b.

{
    MsqMatrix< 3, 1 > result;
    result( 0, 0 ) = a( 1, 0 ) * b( 2, 0 ) - a( 2, 0 ) * b( 1, 0 );
    result( 1, 0 ) = a( 2, 0 ) * b( 0, 0 ) - a( 0, 0 ) * b( 2, 0 );
    result( 2, 0 ) = a( 0, 0 ) * b( 1, 0 ) - a( 1, 0 ) * b( 0, 0 );
    return result;
}
MsqMatrix< 1, 3 > MBMesquite::vector_product ( const MsqMatrix< 1, 3 > &  a,
const MsqMatrix< 1, 3 > &  b 
) [inline]

Definition at line 1207 of file MsqMatrix.hpp.

References b.

{
    MsqMatrix< 1, 3 > result;
    result( 0, 0 ) = a( 0, 1 ) * b( 0, 2 ) - a( 0, 2 ) * b( 0, 1 );
    result( 0, 1 ) = a( 0, 2 ) * b( 0, 0 ) - a( 0, 0 ) * b( 0, 2 );
    result( 0, 2 ) = a( 0, 0 ) * b( 0, 1 ) - a( 0, 1 ) * b( 0, 0 );
    return result;
}
static void MBMesquite::vert_classify_elements ( Mesh *  mesh,
DomainClassifier::DomainSet *  dim_sorted_domains,
unsigned  num_domain,
int  dim_indices[4],
const std::vector< Mesh::ElementHandle > &  elems,
std::vector< Mesh::ElementHandle > &  unknown_elems,
MsqError &  err 
) [static]

Classify mesh elements using vertex classification.

Classify elements using vertex classification, according to the following rules, listed highest-precedence first. Case 1: one or more vertices has no classification -> element has no classification Case 2: all vertices classified to domain with dimension < 2 -> unknown Case 3: one or more vertices has dimension-2 classification: Case 3a: all have same dimension-2 domain -> element assigned to same domain Case 3b: different dimension-2 domains -> element has no classification

Parameters:
meshThe MBMesquite::Mesh instance
dim_sorted_domainsThe list of MeshDomains, sorted from lowest to highest dimension.
num_domainLength of 'dim_sorted_domains' array.
elemsElements to classify
uknownElements for which all vertices are classified to domains with dimension less than two.

Definition at line 370 of file DomainClassifier.cpp.

References MBMesquite::DomainClassifier::DomainSet::elements, MBMesquite::Mesh::elements_get_attached_vertices(), MSQ_ERRRTN, and MBMesquite::DomainClassifier::DomainSet::vertices.

Referenced by MBMesquite::DomainClassifier::classify_geometrically(), and MBMesquite::DomainClassifier::classify_skin_geometrically().

{
    // sort vertex lists for faster search
    for( unsigned i = 0; i < num_domain; ++i )
        std::sort( dim_sorted_domains[i].vertices.begin(), dim_sorted_domains[i].vertices.end() );

    std::vector< Mesh::ElementHandle >::const_iterator iter;
    std::vector< Mesh::VertexHandle > verts;
    std::vector< size_t > junk;
    for( iter = elems.begin(); iter != elems.end(); ++iter )
    {
        int dom = -1;
        verts.clear();
        mesh->elements_get_attached_vertices( &*iter, 1, verts, junk, err );MSQ_ERRRTN( err );
        for( unsigned v = 0; v < verts.size(); ++v )
        {
            int i;
            for( i = 0; i < dim_indices[3]; ++i )
            {
                DomainClassifier::DomainSet* d = dim_sorted_domains + i;
                if( std::binary_search( d->vertices.begin(), d->vertices.end(), verts[v] ) ) break;
            }
            // if any vertex in element has no domain, then element has no domain
            if( i < 0 )
            {
                dom = -2;
                break;
            }
            // if vertex is in curve or point, ignore it
            else if( i < dim_indices[2] )
                continue;
            // else if we already have a vertex on a different surface,
            // element must be in volume (no domain)
            else if( dom >= 0 && dom != i )
            {
                dom = -2;
                break;
            }
            else
            {
                dom = i;
            }
        }

        if( dom >= 0 )
            dim_sorted_domains[dom].elements.push_back( *iter );
        else if( dom == -1 )  // all verts on curves or points
            unknown_elems.push_back( *iter );
    }
}
static int MBMesquite::vertex_map_find ( const VertexIdMap &  map,
size_t  glob_id,
int  proc_id 
) [static]
static bool MBMesquite::vertex_map_insert ( VertexIdMap &  map,
size_t  glob_id,
int  proc_id,
int  value 
) [static]

Definition at line 105 of file ParallelHelper.cpp.

References MBMesquite::VertexIdMapKey::glob_id, and MBMesquite::VertexIdMapKey::proc_id.

Referenced by MBMesquite::ParallelHelperImpl::smoothing_close(), and MBMesquite::ParallelHelperImpl::smoothing_init().

{
    VertexIdMapKey vid;
    vid.glob_id = glob_id;
    vid.proc_id = proc_id;
    return map.insert( VertexIdMap::value_type( vid, value ) ).second;
}

Definition at line 579 of file MeshInterface.hpp.

References corners.

{
    return TopologyInfo::corners( topo );
}
static int MBMesquite::width ( double  d) [static]

Definition at line 1383 of file PatchData.cpp.

Referenced by center(), do_rank_subst(), main(), operator<<(), print_tag_desc(), moab::TupleList::sort(), test_string_rank_subst(), width(), and MBMesquite::MeshWriter::write_eps_triangle().

{
    if( d == 0.0 ) return 1;
    const int max_precision = 6;
    int w                   = (int)ceil( log10( 0.001 + fabs( d ) ) );
    if( w < 0 ) w = 2 + std::min( max_precision, -w );
    if( d < 0.0 ) ++w;
    return w;
}
static int MBMesquite::width ( size_t  t) [static]

Definition at line 1392 of file PatchData.cpp.

{
    return t ? (int)ceil( log10( (double)( 1 + t ) ) ) : 1;
}
static int MBMesquite::width ( const void *  ptr) [static]

Definition at line 1396 of file PatchData.cpp.

References width().

{
    return width( (size_t)ptr );
}

Variable Documentation

const std::string& MBMesquite::barrier_violated_msg [static]
Initial value:
" Barrier of barrier metric has been violated due to negative volume.\n \
  Hint: If your initial mesh is tangled, you must use a non-Barrier metric.\n \
        If a Barrier metric is used, you can only use untangled initial meshes.\n"

Definition at line 42 of file TMetricBarrier.hpp.

Referenced by MBMesquite::TShapeOrientB1::evaluate(), MBMesquite::TShapeSize2DB2::evaluate(), MBMesquite::TSizeB1::evaluate(), MBMesquite::TShapeSize3DB2::evaluate(), MBMesquite::TShapeSizeOrientB1::evaluate(), MBMesquite::TInverseMeanRatio::evaluate(), MBMesquite::TShapeSizeB3::evaluate(), MBMesquite::InvTransBarrier::evaluate(), MBMesquite::TShapeSizeOrientB2::evaluate(), MBMesquite::TShapeOrientB2::evaluate(), MBMesquite::TShapeB1::evaluate(), MBMesquite::TShape3DB2::evaluate(), MBMesquite::TShapeSize3DB4::evaluate(), MBMesquite::TShapeSizeOrientB1::evaluate_with_grad(), MBMesquite::TShapeSize2DB2::evaluate_with_grad(), MBMesquite::TSizeB1::evaluate_with_grad(), MBMesquite::TShapeSize3DB2::evaluate_with_grad(), MBMesquite::TShapeSizeB1::evaluate_with_grad(), MBMesquite::TShapeOrientB1::evaluate_with_grad(), MBMesquite::TShapeSizeB3::evaluate_with_grad(), MBMesquite::TInverseMeanRatio::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB2::evaluate_with_grad(), MBMesquite::TShapeOrientB2::evaluate_with_grad(), MBMesquite::TShapeB1::evaluate_with_grad(), MBMesquite::TShape3DB2::evaluate_with_grad(), MBMesquite::TShapeSize3DB4::evaluate_with_grad(), MBMesquite::TShapeSizeOrientB1::evaluate_with_hess(), MBMesquite::TShapeSizeB1::evaluate_with_hess(), MBMesquite::TShapeSize2DB2::evaluate_with_hess(), MBMesquite::TShapeSize3DB2::evaluate_with_hess(), MBMesquite::TShapeOrientB1::evaluate_with_hess(), MBMesquite::TSizeB1::evaluate_with_hess(), MBMesquite::TShapeSizeB3::evaluate_with_hess(), MBMesquite::TInverseMeanRatio::evaluate_with_hess(), MBMesquite::TShapeOrientB2::evaluate_with_hess(), MBMesquite::TShapeSizeOrientB2::evaluate_with_hess(), MBMesquite::TShapeB1::evaluate_with_hess(), MBMesquite::TShape3DB2::evaluate_with_hess(), and MBMesquite::TShapeSize3DB4::evaluate_with_hess().

const std::string& MBMesquite::barrier_violated_msg_aw [static]
Initial value:
" Barrier of barrier metric has been violated due to negative volume.\n \
  Hint: If your initial mesh is tangled, you must use a non-Barrier metric.\n \
        If a Barrier metric is used, you can only use untangled initial meshes.\n"

Definition at line 42 of file AWMetricBarrier.hpp.

Referenced by MBMesquite::AWShape2DB1::evaluate(), MBMesquite::AWShapeSizeB1::evaluate(), MBMesquite::AWSizeB1::evaluate(), and MBMesquite::AWSizeB1::evaluate_with_grad().

const bool MBMesquite::CULLING_DEFAULT = true

Definition at line 44 of file LaplaceWrapper.cpp.

const double MBMesquite::DEF_SUC_EPS = 1e-4

Definition at line 55 of file ShapeImprovementWrapper.cpp.

const double MBMesquite::DEF_UNT_BETA = 1e-8

Definition at line 54 of file ShapeImprovementWrapper.cpp.

const double MBMesquite::DEFAULT_BETA = 0.0

Definition at line 53 of file ShapeImprover.cpp.

const double MBMesquite::DEFAULT_CPU_TIME = 0.0

Definition at line 62 of file DeformingDomainWrapper.cpp.

const bool MBMesquite::DEFAULT_CULLING = true

Definition at line 61 of file DeformingDomainWrapper.cpp.

const char MBMesquite::DEFAULT_CURVE_TAG[] = "MesquiteCurveFraction"

Definition at line 65 of file DeformingDomainWrapper.cpp.

Definition at line 45 of file LaplaceWrapper.cpp.

Definition at line 63 of file DeformingDomainWrapper.cpp.

Definition at line 54 of file ShapeImprover.cpp.

static const int MBMesquite::edge_beg = { 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7 }
Initial value:
 { 3, 5, 1, 7, 1, 0,
                               3, 2, 7, 1, 5, 3 }

Definition at line 76 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_edge().

Initial value:
 { 4, 0, 6, 2, 3, 2,
                               1, 0, 0, 4, 2, 6 }

Definition at line 78 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_edge().

const int MBMesquite::edge_dir[] = { xi, eta, xi, eta, zeta, zeta, zeta, zeta, xi, eta, xi, eta }

Definition at line 72 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_edge().

static const int MBMesquite::edge_end = { 1, 2, 3, 0, 4, 5, 6, 7, 5, 6, 7, 4 }
Initial value:
 { 2, 6, 0, 4, 5, 4,
                               7, 6, 6, 2, 4, 0 }

Definition at line 80 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_edge().

Initial value:
 { 5, 3, 7, 1, 7, 6,
                               5, 4, 1, 7, 3, 5 }

Definition at line 82 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_edge().

const int MBMesquite::edge_opposite[] = { 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1 }

Definition at line 75 of file LinearHexahedron.cpp.

const double MBMesquite::edr[3][3] = { { 0.0, -2.0, 2.0 }, { 0.0, 2.0, 2.0 }, { 0.0, -2.0, -2.0 } } [static]

Definition at line 225 of file TriLagrangeShape.cpp.

const double MBMesquite::eds[3][3] = { { -2.0, -2.0, 0.0 }, { 2.0, 2.0, 0.0 }, { 2.0, -2.0, 0.0 } } [static]

Definition at line 226 of file TriLagrangeShape.cpp.

const double MBMesquite::EPSILON = 1e-16

Definition at line 47 of file NonSmoothDescent.cpp.

Referenced by PMeanPTemplateTest::check_result(), check_slaved_coords(), MBMesquite::NonSmoothDescent::check_vector_dots(), QualityMetricTest::compare_gradient(), QualityMetricTest::compare_indices(), compare_node_coords(), condition3x3(), MBMesquite::BoundedCylinderDomain::evaluate(), MBMesquite::CylinderDomain::evaluate(), MBMesquite::NonSmoothDescent::find_active_set(), MBMesquite::NonSmoothDescent::find_plane_points(), MBMesquite::NonSmoothDescent::get_min_estimate(), main(), MBMesquite::NonSmoothDescent::search_direction(), MBMesquite::NonSmoothDescent::search_edges_faces(), MBMesquite::NonSmoothDescent::singular_test(), MBMesquite::NonSmoothDescent::solve2x2(), BoundedCylinderDomainTest::test_create_curve_from_mesh(), QualityMetricTest::test_diagonal_constant(), QualityMetricTest::test_diagonal_linear(), QualityMetricTest::test_diagonal_parabolic(), QualityMetricTest::test_diagonal_tau(), MeshUtilTest::test_edge_length_distribution_types(), MeshUtilTest::test_edge_length_distribution_unique(), QualityMetricTest::test_gradient_constant(), QualityMetricTest::test_gradient_linear(), QualityMetricTest::test_gradient_parabolic(), QualityMetricTest::test_gradient_tau(), NumericalOFTest::test_gradient_values(), PMeanPTemplateTest::test_Hessian(), QualityMetricTest::test_Hessian_constant(), QualityMetricTest::test_Hessian_linear(), QualityMetricTest::test_Hessian_parabolic(), QualityMetricTest::test_Hessian_tau(), HigherOrderTest::test_hex_basic(), MeshUtilTest::test_lambda_distribution(), CylinderDomainTest::test_x_normal_at(), BoundedCylinderDomainTest::test_x_snap_to(), CylinderDomainTest::test_x_snap_to(), CylinderDomainTest::test_z_normal_at(), CylinderDomainTest::test_z_snap_to(), BoundedCylinderDomainTest::test_z_snap_to(), and MBMesquite::NonSmoothDescent::validity_check().

const int MBMesquite::face_dir[6] = { eta, xi, eta, xi, zeta, zeta }

Definition at line 101 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_face().

const int MBMesquite::face_opp[6] = { 2, 3, 0, 1, 5, 4 }

Definition at line 100 of file LinearHexahedron.cpp.

Referenced by derivatives_at_mid_face().

const int MBMesquite::face_vtx[6][4]
Initial value:
 { { 0, 1, 4, 5 },                  
                             { 1, 2, 5, 6 },                  
                             { 2, 3, 6, 7 },                  
                             { 0, 3, 4, 7 },                  
                             { 0, 1, 2, 3 },                  
                             { 4, 5, 6, 7 } }

Definition at line 94 of file LinearHexahedron.cpp.

Referenced by coefficients_at_mid_face(), and derivatives_at_mid_face().

static const unsigned MBMesquite::faces [static]
Initial value:
 { { 4, 0, 1, 4, 3 },
                                 { 4, 1, 2, 5, 4 },
                                 { 4, 2, 0, 3, 5 },
                                 { 3, 0, 1, 2, -1 },
                                 { 3, 3, 4, 5, -1 } }
Examples:
ExtrudePoly.cpp, HelloMOAB.cpp, and LloydRelaxation.cpp.

Definition at line 53 of file LinearPrism.cpp.

Referenced by adj_perf(), ahf_test(), append_elem_samples(), TopologyInfoTest::bad_type(), moab::GeomUtil::box_hex_overlap(), moab::MeshGeneration::BrickInstance(), moab::FBEngine::chain_able_edge(), moab::FBEngine::chain_two_edges(), MBMesquite::MsqMeshEntity::check_element_orientation(), MBMesquite::LinearTetrahedron::coefficients(), TopologyInfoTest::compare_sides(), moab::SmoothCurve::compute_control_points_on_boundary_edges(), compute_normals(), moab::DualTool::construct_dual(), MBMesquite::MappingFunction::convert_connectivity_indices_impl(), moab::TempestRemapper::convert_mesh_to_tempest_private(), moab::TempestRemapper::convert_overlap_mesh_sorted_by_source(), moab::TempestRemapper::convert_tempest_mesh_private(), moab::NestedRefine::count_subentities(), create(), create_mesh(), create_shell_test(), create_simple_mesh(), create_single_entity(), entity_sets_subtest(), fill_coord_on_edges(), find_face(), TopologyInfoTest::find_face(), TopologyInfoTest::find_side(), smoab::findFaceSets(), MBMesquite::MsqMOAB::get_all_elements(), MBMesquite::PatchData::get_samples(), moab::GeomTopoTool::get_sense(), moab::FBEngine::getEgFcSense(), TopologyInfoTest::hex(), iMOAB_ReadHeaderInfo(), moab::ReadNC::load_file(), main(), mb_adjacent_create_test(), mb_skin_higher_order_faces_common(), mb_skin_higher_order_pyramids(), mb_skin_poly_test(), MBMesquite::PatchData::non_slave_node_set(), moab::GeomQueryTool::point_in_volume_slow(), populate_data(), prism_issue(), process_partition_file(), TopologyInfoTest::pyramid(), TopologyInfoTest::quad(), ray_test(), moab::ScdNCHelper::read_scd_variables_to_nonset_allocate(), moab::NCHelperMPAS::read_ucd_variables_to_nonset_allocate(), moab::NCHelperGCRM::read_ucd_variables_to_nonset_allocate(), MBMesquite::NodeSet::set_all_mid_face_nodes(), split_quads_test(), split_test(), split_test_across(), test_adjacencies(), NodeSetTest::test_clear_node(), test_construct_from_hex(), test_coords_connect_iterate(), test_cut_with_plane(), test_moab_v3_poly_format(), test_normal_linear_quad(), test_normal_linear_tri(), TopologyInfoTest::test_poly(), VtkTest::test_read_quadratic(), test_sub_entity_indices_hex(), test_sub_entity_indices_pri(), test_sub_entity_indices_pyr(), test_sub_entity_indices_tet(), MBMesquite::DomainClassifier::test_valid_classification(), test_wedges(), TopologyInfoTest::tet(), topology_dimension_test(), TopologyInfoTest::tri(), volume_test(), TopologyInfoTest::wedge(), and LinearMappingFunctionTest::xi_at_faces().

const double MBMesquite::fdr[] = { 0.0, 4.0 / 3.0, -4.0 / 3.0 } [static]

Definition at line 285 of file TriLagrangeShape.cpp.

const double MBMesquite::fds[] = { -4.0 / 3.0, 4.0 / 3.0, 0.0 } [static]

Definition at line 286 of file TriLagrangeShape.cpp.

const double MBMesquite::ho_dr[6][4]
Initial value:
 { { 0., -ft, ft, 0. },   { 0., ft, ft, ft }, { 0., -ft, -ft, -ft },
                             { -ft, -ft, -ft, 0. }, { ft, ft, ft, 0. }, { 0., 0., 0., 0. } }

Definition at line 1035 of file TetLagrangeShape.cpp.

Referenced by derivatives_at_mid_face().

const double MBMesquite::ho_ds[6][4]
Initial value:
 { { -ft, -ft, 0., -ft }, { ft, ft, 0., ft }, { ft, -ft, 0., 0. },
                             { -ft, -ft, -ft, 0. }, { 0., 0., 0., 0. }, { ft, ft, ft, 0. } }

Definition at line 1038 of file TetLagrangeShape.cpp.

Referenced by derivatives_at_mid_face().

const double MBMesquite::ho_dt[6][4]
Initial value:
 { { -ft, -ft, 0., -ft }, { 0., 0., 0., 0. }, { 0., -ft, -ft, -ft },
                             { 0., -ft, 0., ft },   { ft, ft, 0., ft }, { 0., ft, ft, ft } }

Definition at line 1041 of file TetLagrangeShape.cpp.

Referenced by derivatives_at_mid_face().

const bool MBMesquite::IQ_TRAP_FPE_DEFAULT = false

Definition at line 47 of file Settings.cpp.

const char MBMesquite::long_hexahedron_name[] = "Hexahedron"

Definition at line 43 of file TopologyInfo.cpp.

const char MBMesquite::long_polygon_name[] = "Polygon"

Definition at line 38 of file TopologyInfo.cpp.

const char MBMesquite::long_polyhedron_name[] = "Polyhedron"

Definition at line 41 of file TopologyInfo.cpp.

const char MBMesquite::long_prism_name[] = "Prism"

Definition at line 44 of file TopologyInfo.cpp.

const char MBMesquite::long_pyramid_name[] = "Pyramd"

Definition at line 45 of file TopologyInfo.cpp.

const char MBMesquite::long_quadrilateral_name[] = "Quadrilateral"

Definition at line 40 of file TopologyInfo.cpp.

const char MBMesquite::long_septahedron_name[] = "Septahedron"

Definition at line 46 of file TopologyInfo.cpp.

const char MBMesquite::long_tetrahedron_name[] = "Tetrahedron"

Definition at line 42 of file TopologyInfo.cpp.

const char MBMesquite::long_triangle_name[] = "Triangle"

Definition at line 39 of file TopologyInfo.cpp.

const char* MBMesquite::MESQUITE_FIELD_TAG = "MesquiteTags"

Definition at line 78 of file MeshImpl.cpp.

Referenced by get_field_names(), and MBMesquite::MeshImpl::tag_create().

const double MBMesquite::MSQ_3RT_2_OVER_6RT_3 = std::pow( 2 / MSQ_SQRT_THREE, MSQ_ONE_THIRD ) [static]

Definition at line 139 of file Mesquite.hpp.

const double MBMesquite::MSQ_DBL_MAX = 1.0E30
const double MBMesquite::MSQ_DBL_MIN = 1.0E-30

Definition at line 167 of file Mesquite.hpp.

Definition at line 130 of file Mesquite.hpp.

Definition at line 150 of file Mesquite.hpp.

Definition at line 156 of file Mesquite.hpp.

Definition at line 181 of file Mesquite.hpp.

Definition at line 48 of file NonSmoothDescent.cpp.

Referenced by MBMesquite::NonSmoothDescent::minmax_opt().

const double MBMesquite::MSQ_SQRT_THREE_DIV_TWO = MSQ_SQRT_THREE / 2.0 [static]

Definition at line 133 of file Mesquite.hpp.

Referenced by QualityMetricTester::get_ideal_tris().

Definition at line 136 of file Mesquite.hpp.

const double MBMesquite::MSQ_SQRT_TWO_INV = 1.0 / MSQ_SQRT_TWO [static]

Definition at line 135 of file Mesquite.hpp.

const double MBMesquite::MSQ_TWO_THIRDS = 2.0 / 3.0 [static]

Definition at line 138 of file Mesquite.hpp.

Referenced by cbrt_sqr().

const unsigned MBMesquite::MSQ_UINT_MAX = ~(unsigned)0

Definition at line 144 of file Mesquite.hpp.

const unsigned MBMesquite::reverseIndexList[][3]
Initial value:
 { { 0, 0, 0 },     
                                         { 0, 0, 0 },     
                                         { 0, 0, 0 },     
                                         { 0, 0, 0 },     
                                         { 0, 0, 0 },     
                                         { 0, 0, 0 },     
                                         { 0, 0, 0 },     
                                         { 7, 0, 0 },     
                                         { 5, 22, 0 },    
                                         { 9, 23, 28 },   
                                         { 0, 0, 0 },     
                                         { 10, 24, 0 },   
                                         { 12, 25, 29 },  
                                         { 13, 26, 0 },   
                                         { 14, 27, 0 },   
                                         { 0, 0, 0 },     
                                         { 0, 0, 0 } }

Definition at line 90 of file VtkTypeInfo.cpp.

Referenced by MBMesquite::VtkTypeInfo::find_type().

const char MBMesquite::short_hexahedron_name[] = "Hex"

Definition at line 52 of file TopologyInfo.cpp.

const char MBMesquite::short_polygon_name[] = "Polygon"

Definition at line 47 of file TopologyInfo.cpp.

const char MBMesquite::short_polyhedron_name[] = "Polyhedron"

Definition at line 50 of file TopologyInfo.cpp.

const char MBMesquite::short_prism_name[] = "Pri"

Definition at line 53 of file TopologyInfo.cpp.

const char MBMesquite::short_pyramid_name[] = "Pyr"

Definition at line 54 of file TopologyInfo.cpp.

const char MBMesquite::short_quadrilateral_name[] = "Quad"

Definition at line 49 of file TopologyInfo.cpp.

const char MBMesquite::short_septahedron_name[] = "Sept"

Definition at line 55 of file TopologyInfo.cpp.

const char MBMesquite::short_tetrahedron_name[] = "Tet"

Definition at line 51 of file TopologyInfo.cpp.

const char MBMesquite::short_triangle_name[] = "Tri"

Definition at line 48 of file TopologyInfo.cpp.

const int MBMesquite::signs[6] = { -1, 1, -1, -1, 1, 1 } [static]
Initial value:
 {
    1.0, -1.0 / sqrt( 3.0 ), -1.0 / sqrt( 6.0 ), 0.0, 2.0 / sqrt( 3.0 ), -1.0 / sqrt( 6.0 ), 0.0,
    0.0, sqrt( 3.0 / 2.0 ) }

Definition at line 54 of file AffineMapMetric.cpp.

const double MBMesquite::TRI_XFORM_VALS[] = { 1.0, -1.0 / sqrt( 3.0 ), 0.0, 2.0 / sqrt( 3.0 ) }

Definition at line 51 of file AffineMapMetric.cpp.

Definition at line 51 of file VtkTypeInfo.cpp.

Referenced by MBMesquite::VtkTypeInfo::find_type().

const unsigned MBMesquite::typeInfoListLen = sizeof( typeInfoList ) / sizeof( typeInfoList[0] )

Definition at line 88 of file VtkTypeInfo.cpp.

Referenced by MBMesquite::VtkTypeInfo::find_type().

Definition at line 48 of file IdealElements.cpp.

Referenced by init_unit_edge().

Definition at line 47 of file IdealElements.cpp.

Referenced by init_unit_edge().

Definition at line 46 of file IdealElements.cpp.

Referenced by init_unit_edge().

Definition at line 49 of file IdealElements.cpp.

Referenced by init_unit_edge().

Definition at line 50 of file IdealElements.cpp.

Referenced by init_unit_edge().

Initial value:
 { Vector3D( 0.5, -0.5, -0.5 ),  Vector3D( 0.5, 0.5, -0.5 ), Vector3D( -0.5, 0.5, -0.5 ),
                                Vector3D( -0.5, -0.5, -0.5 ), Vector3D( 0.5, -0.5, 0.5 ), Vector3D( 0.5, 0.5, 0.5 ),
                                Vector3D( -0.5, 0.5, 0.5 ),   Vector3D( -0.5, -0.5, 0.5 ) }

Definition at line 42 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

Definition at line 56 of file IdealElements.cpp.

Referenced by init_unit_elem().

Definition at line 54 of file IdealElements.cpp.

Referenced by init_unit_elem().

Initial value:
 { Vector3D( -0.5, -0.5, 0.0 ), Vector3D( 0.5, -0.5, 0.0 ), Vector3D( 0.5, 0.5, 0.0 ),
                                 Vector3D( -0.5, 0.5, 0.0 ) }

Definition at line 39 of file IdealElements.cpp.

Referenced by init_unit_edge(), and init_unit_elem().

Definition at line 53 of file IdealElements.cpp.

Referenced by init_unit_elem().

Definition at line 52 of file IdealElements.cpp.

Referenced by init_unit_elem().

Definition at line 55 of file IdealElements.cpp.

Referenced by init_unit_elem().

const char *const MBMesquite::VERTEX_BYTE_TAG_NAME = "MesquiteVertexByte"

The name of the tag (integer) that Mesquite will use to store internal data

Definition at line 44 of file MsqIMesh.hpp.

Referenced by MBMesquite::MsqMOAB::init_active_mesh(), and MBMesquite::MsqIMesh::init_active_mesh().

const unsigned MBMesquite::vtk_hex_order[]
Initial value:
 { 0,  1,  2,  3,                   
                                   4,  5,  6,  7,  8,  9,  10, 11,  
                                   16, 17, 18, 19, 12, 13, 14, 15,
                                   22, 21, 23, 20,  
                                   24, 25, 26 }

Definition at line 45 of file VtkTypeInfo.cpp.

const unsigned MBMesquite::vtk_pixel_order[] = { 0, 1, 3, 2 }

Definition at line 34 of file VtkTypeInfo.cpp.

const char* const MBMesquite::vtk_type_names[]
Initial value:
 { "bit",          "char", "unsigned_char", "short", "unsigned_short", "int",
                                       "unsigned_int", "long", "unsigned_long", "float", "double",         0 }

Definition at line 1293 of file MeshImpl.cpp.

const unsigned MBMesquite::vtk_voxel_order[] = { 0, 1, 3, 2, 4, 5, 7, 6 }

Definition at line 36 of file VtkTypeInfo.cpp.

const unsigned MBMesquite::vtk_wedge_order[]
Initial value:
 { 0,  2,  1,     
                                     3,  5,  4,     
                                     8,  7,  6,     
                                     12, 14, 13,    
                                     11, 10, 9,     
                                     17, 16, 15 }

Definition at line 38 of file VtkTypeInfo.cpp.

const unsigned MBMesquite::xi = 0

Definition at line 71 of file LinearHexahedron.cpp.

Referenced by closedsurface_uref_hirec_convergence_study(), moab::NestedRefine::compute_coordinates(), moab::NestedRefine::construct_hm_1D(), derivatives_at_corner(), dl22(), dNdeta(), dNdxi(), moab::Element::DSH(), moab::Element::LinearTet::evaluate(), moab::Element::LinearTri::evaluate(), moab::DualTool::GraphicsPoint::GraphicsPoint(), moab::Element::Map::ievaluate(), moab::element_utility::Spectral_hex_map< moab::Matrix3 >::integrate_scalar_field(), l11(), l12(), l22(), lagrange_weights(), lagrange_weights_deriv(), N(), PartMap::part_from_coords(), moab::ElemUtil::point_in_trilinear_hex(), moab::GeomUtil::point_in_trilinear_hex(), moab::ParallelMergeMesh::PopulateMyMatches(), random_point_in_hex(), moab::Element::SH(), test_hex_nat_coords(), LinearMappingFunctionTest::test_linear_hex_coeff_center(), LinearMappingFunctionTest::test_linear_hex_coeff_corners(), LinearMappingFunctionTest::test_linear_hex_coeff_edges(), LinearMappingFunctionTest::test_linear_hex_coeff_faces(), LinearMappingFunctionTest::test_linear_hex_deriv_center(), LinearMappingFunctionTest::test_linear_hex_deriv_corners(), LinearMappingFunctionTest::test_linear_hex_deriv_edges(), LinearMappingFunctionTest::test_linear_hex_deriv_faces(), LinearMappingFunctionTest::test_linear_prism_coeff_center(), LinearMappingFunctionTest::test_linear_prism_coeff_corners(), LinearMappingFunctionTest::test_linear_prism_coeff_edges(), LinearMappingFunctionTest::test_linear_prism_coeff_faces(), LinearMappingFunctionTest::test_linear_prism_deriv_center(), LinearMappingFunctionTest::test_linear_prism_deriv_corners(), LinearMappingFunctionTest::test_linear_prism_deriv_edges(), LinearMappingFunctionTest::test_linear_prism_deriv_faces(), LinearMappingFunctionTest::test_linear_pyr_coeff_center(), LinearMappingFunctionTest::test_linear_pyr_coeff_corners(), LinearMappingFunctionTest::test_linear_pyr_coeff_edges(), LinearMappingFunctionTest::test_linear_pyr_coeff_faces(), LinearMappingFunctionTest::test_linear_pyr_deriv_center(), LinearMappingFunctionTest::test_linear_pyr_deriv_corners(), LinearMappingFunctionTest::test_linear_pyr_deriv_edges(), LinearMappingFunctionTest::test_linear_pyr_deriv_faces(), LinearMappingFunctionTest::test_linear_quad_coeff_center(), LinearMappingFunctionTest::test_linear_quad_coeff_corners(), LinearMappingFunctionTest::test_linear_quad_coeff_edges(), LinearMappingFunctionTest::test_linear_quad_deriv_center(), LinearMappingFunctionTest::test_linear_quad_deriv_corners(), LinearMappingFunctionTest::test_linear_quad_deriv_edges(), LinearMappingFunctionTest::test_linear_tet_coeff_center(), LinearMappingFunctionTest::test_linear_tet_coeff_corners(), LinearMappingFunctionTest::test_linear_tet_coeff_edges(), LinearMappingFunctionTest::test_linear_tet_coeff_faces(), LinearMappingFunctionTest::test_linear_tet_deriv_center(), LinearMappingFunctionTest::test_linear_tet_deriv_corners(), LinearMappingFunctionTest::test_linear_tet_deriv_edges(), LinearMappingFunctionTest::test_linear_tet_deriv_faces(), LinearMappingFunctionTest::test_linear_tri_coeff_center(), LinearMappingFunctionTest::test_linear_tri_coeff_corners(), LinearMappingFunctionTest::test_linear_tri_coeff_edges(), LinearMappingFunctionTest::test_linear_tri_deriv_center(), LinearMappingFunctionTest::test_linear_tri_deriv_corners(), and LinearMappingFunctionTest::test_linear_tri_deriv_edges().

const unsigned MBMesquite::zeta = 2

Definition at line 71 of file LinearHexahedron.cpp.

Referenced by v_tet_minimum_angle().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines