MOAB: Mesh Oriented datABase  (version 5.3.0)
MBMesquite::PatchData Class Reference

#include <PatchData.hpp>

+ Collaboration diagram for MBMesquite::PatchData:

Public Types

enum  ComputedInfo {
  MIN_UNSIGNED_AREA = 0, MAX_UNSIGNED_AREA, MIN_EDGE_LENGTH, MAX_EDGE_LENGTH,
  MINMAX_SIGNED_DET2D, MINMAX_SIGNED_DET3D, AVERAGE_DET3D, MAX_COMPUTED_INFO_ENUM
}

Public Member Functions

MESQUITE_EXPORT PatchData ()
MESQUITE_EXPORT ~PatchData ()
MESQUITE_EXPORT void attach_settings (const Settings *p_settings)
MESQUITE_EXPORT const Settingssettings () const
MESQUITE_EXPORT void fill (size_t num_vertex, const double *vtx_coords, size_t num_elem, EntityTopology type, const size_t *connectivity, const bool *vertex_fixed_flags, MsqError &err)
 For use by testing code -- create patch explicitly.
MESQUITE_EXPORT void fill (size_t num_vertex, const double *vtx_coords, size_t num_elem, const EntityTopology *elem_types, const size_t *connectivity, const bool *vertex_fixed_flags, MsqError &err)
 For use by testing code -- create patch explicitly.
MESQUITE_EXPORT void fill (size_t num_vertex, const double *vtx_coords, size_t num_elem, const EntityTopology *elem_types, const size_t *vertex_per_elem, const size_t *elem_connectivity, const bool *vertex_fixed_flags, MsqError &err)
 For use by testing code -- create patch explicitly.
MESQUITE_EXPORT void fill_global_patch (MsqError &err)
 Create global patch.
MESQUITE_EXPORT void set_mesh_entities (std::vector< Mesh::ElementHandle > &patch_elems, std::vector< Mesh::VertexHandle > &free_vertices, MsqError &err)
MESQUITE_EXPORT void clear_computed_info ()
 This function clears the patch information such as maximum volume, etc ...
MESQUITE_EXPORT bool have_computed_info (ComputedInfo info) const
MESQUITE_EXPORT void get_minmax_element_unsigned_area (double &min, double &max, MsqError &err)
MESQUITE_EXPORT void get_minmax_edge_length (double &min, double &max) const
MESQUITE_EXPORT void clear ()
 Removes data.
MESQUITE_EXPORT void reorder ()
 Reorders the mesh data.
MESQUITE_EXPORT size_t num_nodes () const
 number of vertices in the patch.
MESQUITE_EXPORT size_t num_free_vertices () const
MESQUITE_EXPORT size_t num_slave_vertices () const
MESQUITE_EXPORT size_t num_fixed_vertices () const
MESQUITE_EXPORT size_t num_elements () const
 number of elements in the Patch.
MESQUITE_EXPORT bool is_vertex_free (size_t index) const
MESQUITE_EXPORT bool is_vertex_not_free (size_t index) const
MESQUITE_EXPORT bool is_vertex_slave (size_t index) const
MESQUITE_EXPORT bool is_vertex_fixed (size_t index) const
MESQUITE_EXPORT size_t num_corners () const
 number of element corners (number of vertex uses) in patch
MESQUITE_EXPORT const MsqVertexget_vertex_array (MsqError &err) const
 Returns a pointer to the start of the vertex array.
MESQUITE_EXPORT const MsqVertexget_vertex_array () const
MESQUITE_EXPORT const
MsqMeshEntity
get_element_array (MsqError &err) const
 Returns a pointer to the start of the element array.
MESQUITE_EXPORT MsqMeshEntityget_element_array (MsqError &err)
MESQUITE_EXPORT size_t * get_connectivity_array ()
MESQUITE_EXPORT
Mesh::ElementHandle
get_element_handles_array ()
MESQUITE_EXPORT
Mesh::VertexHandle
get_vertex_handles_array ()
MESQUITE_EXPORT const MsqVertexvertex_by_index (size_t index) const
MESQUITE_EXPORT MsqMeshEntityelement_by_index (size_t index)
MESQUITE_EXPORT const
MsqMeshEntity
element_by_index (size_t index) const
MESQUITE_EXPORT size_t get_vertex_index (MsqVertex *vertex)
MESQUITE_EXPORT size_t get_element_index (MsqMeshEntity *element)
MESQUITE_EXPORT void get_element_vertex_coordinates (size_t elem_index, std::vector< Vector3D > &coords, MsqError &err)
 Get the coordinates of vertices attached to the specified element.
MESQUITE_EXPORT void get_element_vertex_indices (size_t elem_index, std::vector< size_t > &vertex_indices, MsqError &err)
MESQUITE_EXPORT void get_vertex_element_indices (size_t vertex_index, std::vector< size_t > &elem_indices, MsqError &err)
MESQUITE_EXPORT void get_vertex_element_indices (size_t vertex_index, unsigned element_dimension, std::vector< size_t > &elem_indices, MsqError &err)
MESQUITE_EXPORT const size_t * get_vertex_element_adjacencies (size_t vertex_index, size_t &array_len_out, MsqError &err)
MESQUITE_EXPORT void get_adjacent_vertex_indices (size_t vertex_index, std::vector< size_t > &vert_indices, MsqError &err) const
 This function fills a vector<size_t> with the indices to vertices connected to the given vertex by an edge. If vert_indices is not initially empty, the function will not delete the current contents. Instead, it will append the new indices at the end of the vector.
MESQUITE_EXPORT void get_adjacent_entities_via_n_dim (int n, size_t ent_ind, std::vector< size_t > &adj_ents, MsqError &err)
 Get the indices of entities attached to entity (given by ent_ind). adj_ents is filled with the indices into the entity array of elements adjacent to the given element via an n-dimensional entity.
MESQUITE_EXPORT void generate_vertex_to_element_data ()
MESQUITE_EXPORT void set_vertex_coordinates (const Vector3D &coords, size_t index, MsqError &err)
 set the coordinates of the index-th vertex in the raw array
MESQUITE_EXPORT void move_vertex (const Vector3D &delta, size_t index, MsqError &err)
 increment the coordinates of the index-th vertex in the raw array
MESQUITE_EXPORT void snap_vertex_to_domain (size_t vertex_index, MsqError &err)
MESQUITE_EXPORT bool domain_set () const
MESQUITE_EXPORT void get_domain_normal_at_vertex (size_t vert_index, Mesh::ElementHandle element, Vector3D &normal_out, MsqError &err)
MESQUITE_EXPORT void get_domain_normal_at_element (size_t elem_index, Vector3D &surf_norm, MsqError &err)
MESQUITE_EXPORT void get_domain_normals_at_corners (size_t element_index, Vector3D normals_out[], MsqError &err)
MESQUITE_EXPORT void get_domain_normal_at_corner (size_t elemen_index, unsigned corner, Vector3D &normal, MsqError &err)
MESQUITE_EXPORT void get_domain_normal_at_mid_edge (size_t element_index, unsigned edge_number, Vector3D &normal, MsqError &err)
MESQUITE_EXPORT void get_domain_normal_at_element (const MsqMeshEntity *elem_ptr, Vector3D &surf_norm, MsqError &err)
 Alternative signature. Same functionality.
MESQUITE_EXPORT void get_domain_normal_at_sample (size_t element_index, Sample location, Vector3D &surf_norm, MsqError &err)
MESQUITE_EXPORT void move_free_vertices_constrained (Vector3D dk[], size_t nb_vtx, double step_size, MsqError &err)
 Moves free vertices and then snaps the free vertices to the domain.
MESQUITE_EXPORT void set_free_vertices_constrained (PatchDataVerticesMemento *memento, Vector3D dk[], size_t nb_vtx, double step_size, MsqError &err)
MESQUITE_EXPORT void project_gradient (std::vector< Vector3D > &gradient, MsqError &err)
 Project gradient vector terms onto geometric domain.
MESQUITE_EXPORT double get_max_vertex_movement_squared (PatchDataVerticesMemento *memento, MsqError &err)
MESQUITE_EXPORT void update_mesh (MsqError &err, const TagHandle *tag=0)
 This function copies to the TSTT mesh the changes made to the free vertices / elements of the PatchData object.
MESQUITE_EXPORT void update_slave_node_coordinates (MsqError &err)
MESQUITE_EXPORT void update_slave_node_coordinates (const size_t *elem_indices, size_t num_elem, MsqError &err)
MESQUITE_EXPORT void set_all_vertices_soft_free (MsqError &err)
 Remove the soft_fixed flag from all vertices in the patch.
MESQUITE_EXPORT void set_all_vertices_soft_fixed (MsqError &err)
 Add a soft_fixed flag to all vertices in the patch.
MESQUITE_EXPORT void set_free_vertices_soft_fixed (MsqError &err)
 Add a soft_fixed flag to all free vertices in the patch.
MESQUITE_EXPORT void set_vertex_culled (size_t vtx_index)
 Mark vertex as culled (soft fixed)
MESQUITE_EXPORT void clear_vertex_culled (size_t vtx_index)
 Mark vertex as culled (soft fixed)
MESQUITE_EXPORT int check_vertex_culled (size_t vtx_index) const
 check if vertex is culled
MESQUITE_EXPORT void get_subpatch (size_t center_vertex_index, unsigned num_adj_elem_layers, PatchData &pd_to_fill, MsqError &err)
MESQUITE_EXPORT void get_free_vertex_coordinates (std::vector< Vector3D > &coords_out) const
MESQUITE_EXPORT
PatchDataVerticesMemento
create_vertices_memento (MsqError &err)
MESQUITE_EXPORT void recreate_vertices_memento (PatchDataVerticesMemento *memento, MsqError &err)
MESQUITE_EXPORT void set_to_vertices_memento (PatchDataVerticesMemento *memento, MsqError &err)
MESQUITE_EXPORT void set_mesh (Mesh *ms)
MESQUITE_EXPORT Meshget_mesh () const
 Returns the originating meshSet.
MESQUITE_EXPORT void set_domain (MeshDomain *dm)
MESQUITE_EXPORT MeshDomainget_domain () const
MESQUITE_EXPORT const Settingsget_settings () const
MESQUITE_EXPORT const
MappingFunction
get_mapping_function (EntityTopology type) const
MESQUITE_EXPORT const
MappingFunction2D
get_mapping_function_2D (EntityTopology type) const
MESQUITE_EXPORT const
MappingFunction3D
get_mapping_function_3D (EntityTopology type) const
MESQUITE_EXPORT void get_sample_location (size_t element_index, Sample sample, Vector3D &result, MsqError &err) const
 Get R^3 coordinates for logical sample location.
MESQUITE_EXPORT NodeSet non_slave_node_set (size_t elem_idx) const
MESQUITE_EXPORT NodeSet get_samples (size_t element, NodeSet non_slave_nodes) const
MESQUITE_EXPORT NodeSet get_samples (size_t element) const
MESQUITE_EXPORT void get_samples (size_t element, std::vector< Sample > &samples_out, MsqError &err) const

Private Member Functions

 PatchData (const PatchData &pd)
PatchDataoperator= (const PatchData &pd)
bool attach_extra_data (ExtraData *data)
 Attach an ExtraData object to this PatchData.
bool remove_extra_data (ExtraData *data)
 Remove an ExtraData object from this PatchData.
void notify_new_patch ()
 notify all attached ExtraData instances that patch contents have changed
void notify_sub_patch (PatchData &sub_patch, const size_t *vertex_index_map, const size_t *element_index_map, MsqError &err)
 notify all attached ExtraData instances that a subpatch is being initalized
void notify_patch_destroyed ()
 notify all attached ExtraData instances that this patch is being destroyed
void enslave_higher_order_nodes (const size_t *element_offset_array, unsigned char *vertex_flags, MsqError &err) const
void initialize_data (size_t *elem_offset_array, unsigned char *vertex_flags, MsqError &err)
void note_have_info (ComputedInfo info)
void update_cached_normals (MsqError &)

Static Private Member Functions

static void make_handles_unique (Mesh::EntityHandle *handles, size_t &count, size_t *index_map=0)

Private Attributes

MeshmyMesh
 The Mesh used to fill this PatchData [may be NULL].
MeshDomainmyDomain
 The geometric domain of the mesh [may be NULL].
std::vector< MsqVertexvertexArray
std::vector< Mesh::VertexHandlevertexHandlesArray
size_t numFreeVertices
size_t numSlaveVertices
std::vector< MsqMeshEntityelementArray
std::vector< Mesh::ElementHandleelementHandlesArray
std::vector< size_t > elemConnectivityArray
std::vector< size_t > vertAdjacencyArray
std::vector< size_t > vertAdjacencyOffsets
std::vector< unsigned > vertexNormalIndices
std::vector< Vector3DnormalData
std::vector< unsigned short > vertexDomainDOF
std::vector< size_t > offsetArray
std::vector< unsigned char > byteArray
std::vector< bool > bitMap
double computedInfos [MAX_COMPUTED_INFO_ENUM]
unsigned haveComputedInfos
ExtraDatadataList
const SettingsmSettings

Static Private Attributes

static const Settings defaultSettings

Friends

class MBMesquite::ExtraData
std::ostream & operator<< (std::ostream &, const PatchData &)
 Display the coordinates and connectivity information.

Detailed Description

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

Definition at line 70 of file PatchData.hpp.


Member Enumeration Documentation

Enumerator:
MIN_UNSIGNED_AREA 

minimum volume or area out of all elements in the patch

MAX_UNSIGNED_AREA 

maximum volume or area out of all elements in the patch

MIN_EDGE_LENGTH 

minimum edge length in the patch

MAX_EDGE_LENGTH 

maximum edge length in the patch

MINMAX_SIGNED_DET2D 

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

MINMAX_SIGNED_DET3D 

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

AVERAGE_DET3D 

average corner determinant out of all elements in the patch

MAX_COMPUTED_INFO_ENUM 

Definition at line 161 of file PatchData.hpp.

    {
        MIN_UNSIGNED_AREA = 0,  //!< minimum volume or area out of all elements in the patch
        MAX_UNSIGNED_AREA,      //!< maximum volume or area out of all elements in the patch
        MIN_EDGE_LENGTH,        //!< minimum edge length in the patch
        MAX_EDGE_LENGTH,        //!< maximum edge length in the patch
        MINMAX_SIGNED_DET2D,    //!< minimum and maximum corner area out of all elements in the patch
        MINMAX_SIGNED_DET3D,    //!< minimum and maximum corner volume out of all elements in the
                                //!< patch
        AVERAGE_DET3D,          //!< average corner determinant out of all elements in the patch
        MAX_COMPUTED_INFO_ENUM
    };

Constructor & Destructor Documentation

MBMesquite::PatchData::PatchData ( const PatchData pd) [private]

Doesn't allow PatchData to be copied implicitly. Mementos such as PatchDataVerticesMemento should be used when necessary.


Member Function Documentation

Attach an ExtraData object to this PatchData.

Definition at line 1963 of file PatchData.cpp.

References dataList, MBMesquite::ExtraData::patchNext, and MBMesquite::ExtraData::patchPtr.

Referenced by MBMesquite::ExtraData::ExtraData().

{
    if( data->patchNext ) { return false; }

    if( !data->patchPtr )
        data->patchPtr = this;
    else if( data->patchPtr != this )
        return false;

    data->patchNext = dataList;
    dataList        = data;
    return true;
}
MESQUITE_EXPORT void MBMesquite::PatchData::attach_settings ( const Settings p_settings) [inline]

Definition at line 77 of file PatchData.hpp.

References mSettings.

Referenced by MBMesquite::TerminationCriterion::accumulate_outer(), check_global_patch_slaved(), PatchDataTest::check_higher_order_vertices_slaved(), QualityMetricTester::compare_analytical_and_numerical_diagonals(), QualityMetricTester::compare_analytical_and_numerical_gradients(), QualityMetricTester::compare_analytical_and_numerical_hessians(), QualityMetricTester::compare_eval_and_eval_with_indices(), QualityMetricTester::compare_eval_with_diag_and_eval_with_hessian(), QualityMetricTester::compare_eval_with_grad_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_grad_and_eval_with_hessian(), 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(), MBMesquite::create_ideal_element_patch(), MBMesquite::TerminationCriterion::cull_vertices_global(), IdealTargetTest::get_calc_target(), MBMesquite::MeshUtil::get_global_patch(), MBMesquite::PatchPowerMeanP::initialize_block_coordinate_descent(), MBMesquite::TargetWriter::loop_over_mesh(), MBMesquite::VertexMover::loop_over_mesh(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), MBMesquite::TerminationCriterion::reset_outer(), MBMesquite::ShapeImprover::run_wrapper(), tag_patch_slaved(), test_bad_element(), QualityAssessorTest::test_basic_stats_sample(), QualityMetricTester::test_diagonal_with_fixed_vertex(), QualityMetricTester::test_domain_deviation_gradient(), QualityMetricTester::test_domain_deviation_quality(), QualityMetricTester::test_evaluate_unit_edge_element(), QualityMetricTester::test_evaluate_unit_edge_tris_about_vertex(), QualityMetricTester::test_evaluate_unit_element(), QualityMetricTester::test_evaluate_unit_hexes_about_vertex(), QualityMetricTester::test_evaluate_unit_quads_about_vertex(), QualityMetricTester::test_evaluate_unit_tris_about_vertex(), PatchDataTest::test_fixed_by_geom_dim(), QualityMetricTester::test_get_edge_evaluations(), QualityMetricTester::test_get_edge_indices(), QualityMetricTester::test_get_element_evaluations(), QualityMetricTester::test_get_element_indices(), QualityMetricTester::test_get_in_element_evaluations(), QualityMetricTester::test_get_indices_fixed(), QualityMetricTester::test_get_sample_evaluations(), QualityMetricTester::test_get_sample_indices(), QualityMetricTester::test_get_vertex_evaluations(), QualityMetricTester::test_get_vertex_indices(), QualityMetricTester::test_grad_transform_invariant(), TMPQualityMetricTest< QMType >::test_gradient_3D(), TMPQualityMetricTest< QMType >::test_gradient_common(), QualityMetricTester::test_gradient_reflects_quality(), QualityMetricTester::test_gradient_with_fixed_vertex(), QualityMetricTester::test_hessian_transform_invariant(), 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(), QualityMetricTester::test_measures_quality(), QualityMetricTester::test_measures_transform(), QualityMetricTester::test_measures_vertex_quality(), PatchDataTest::test_quad8_patch(), QualityMetricTester::test_symmetric_Hessian_diagonal_blocks(), QualityMetricTester::test_transform_invariant(), QualityMetricTester::test_type_is_not_supported(), QualityMetricTester::test_type_is_supported(), PatchDataTest::test_update_slave_node_coords(), and QualityMetricTester::test_vertex_gradient_reflects_quality().

    {
        mSettings = p_settings;
    }
MESQUITE_EXPORT int MBMesquite::PatchData::check_vertex_culled ( size_t  vtx_index) const [inline]

check if vertex is culled

Definition at line 501 of file PatchData.hpp.

References MBMesquite::MsqVertex::MSQ_CULLED, and vertexArray.

    {
        return vertexArray[vtx_index].get_flags() | MsqVertex::MSQ_CULLED;
    }
void MBMesquite::PatchData::clear ( ) [inline]

Removes data.

Returns average corner determinant over all corners in the patch This information is stored in the patch and should not decrease performance when used properly. See also PatchData::clear_computed_info() .

Definition at line 786 of file PatchData.hpp.

References elemConnectivityArray, elementArray, elementHandlesArray, haveComputedInfos, myDomain, myMesh, normalData, numFreeVertices, numSlaveVertices, vertAdjacencyArray, vertAdjacencyOffsets, vertexArray, vertexHandlesArray, and vertexNormalIndices.

Referenced by set_mesh_entities().

{
    vertexArray.clear();
    vertexHandlesArray.clear();
    elementArray.clear();
    elementHandlesArray.clear();
    elemConnectivityArray.clear();
    vertAdjacencyArray.clear();
    vertAdjacencyOffsets.clear();
    vertexNormalIndices.clear();
    normalData.clear();
    // vertexDomainDOF.clear();
    numFreeVertices   = 0;
    numSlaveVertices  = 0;
    haveComputedInfos = 0;
    myMesh            = 0;
    myDomain          = 0;
}

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

Definition at line 176 of file PatchData.hpp.

References haveComputedInfos.

MESQUITE_EXPORT void MBMesquite::PatchData::clear_vertex_culled ( size_t  vtx_index) [inline]

Mark vertex as culled (soft fixed)

Definition at line 495 of file PatchData.hpp.

References vertexArray.

    {
        vertexArray[vtx_index].flags() &= ~MsqVertex::MSQ_CULLED;
    }

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

This function instantiate PatchDataVerticesMemento object and returns a pointer to it. The PatchDataVerticesMemento contains the current state of the PatchData coordinates. It can be used to restore the same PatchData object to those coordinates.

It is the responsibility of the caller to discard the PatchDataVerticesMemento when not needed any more.

Definition at line 916 of file PatchData.hpp.

References MSQ_CHKERR, and recreate_vertices_memento().

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

{
    PatchDataVerticesMemento* memento = new PatchDataVerticesMemento;
    recreate_vertices_memento( memento, err );
    if( MSQ_CHKERR( err ) )
    {
        delete memento;
        return 0;
    }
    return memento;
}

Definition at line 878 of file PatchData.hpp.

References elementArray.

Referenced by MsqHessianTest::accumulate_entries(), MBMesquite::append_elem_samples(), MBMesquite::RefSizeTargetCalculator::average_edge_length(), PatchDataTest::check_sub_patch(), MBMesquite::TerminationCriterion::count_inverted(), MBMesquite::EdgeLengthMetric::evaluate(), MBMesquite::SizeMetric::evaluate(), MBMesquite::AspectRatioGammaQualityMetric::evaluate(), MBMesquite::ConditionNumberQualityMetric::evaluate(), MBMesquite::AffineMapMetric::evaluate(), MBMesquite::IdealWeightMeanRatio::evaluate(), MBMesquite::UntangleBetaQualityMetric::evaluate(), MBMesquite::IdealWeightInverseMeanRatio::evaluate(), FauxMetric< B >::evaluate(), MBMesquite::AWQualityMetric::evaluate_internal(), MBMesquite::TQualityMetric::evaluate_internal(), MBMesquite::TMPQualityMetric::evaluate_surface_common(), MBMesquite::EdgeLengthMetric::evaluate_with_gradient(), MBMesquite::AWQualityMetric::evaluate_with_gradient(), MBMesquite::TQualityMetric::evaluate_with_gradient(), MBMesquite::IdealWeightMeanRatio::evaluate_with_gradient(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_gradient(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian(), MBMesquite::TQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian(), MBMesquite::IdealWeightMeanRatio::evaluate_with_Hessian_diagonal(), MBMesquite::TQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::AWQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::IdealWeightInverseMeanRatio::evaluate_with_Hessian_diagonal(), MBMesquite::ElementQM::evaluate_with_indices(), MBMesquite::AffineMapMetric::evaluate_with_indices(), MBMesquite::EdgeQM::evaluate_with_indices(), FauxMetric< B >::evaluate_with_indices(), ConstantElementMetric::evaluate_with_indices(), TriTauMetric::evaluate_with_indices(), fill(), MBMesquite::IdealShapeTarget::get_2D_target(), MBMesquite::TargetReader::get_2D_target(), FakeTargetCalc::get_2D_target(), MBMesquite::IdealShapeTarget::get_3D_target(), MBMesquite::TargetReader::get_3D_target(), FakeTargetCalc::get_3D_target(), MBMesquite::EdgeIterator::get_adjacent_vertices(), QualityMetricTester::get_degenerate_element(), get_domain_normal_at_element(), get_domain_normal_at_mid_edge(), MBMesquite::EdgeQM::get_edge_evaluations(), MBMesquite::ElementQM::get_element_evaluations(), FauxMetric< B >::get_element_evaluations(), QualityMetricTester::get_inverted_element(), get_minmax_edge_length(), QualityMetricTester::get_nonideal_element(), MBMesquite::TargetCalculator::get_refmesh_Jacobian_2D(), MBMesquite::TargetCalculator::get_refmesh_Jacobian_3D(), get_sample_location(), get_samples(), get_subpatch(), MBMesquite::TargetReader::get_surface_target(), FakeTargetCalc::get_surface_target(), MBMesquite::VertexQM::get_vertex_corner_handles(), QualityMetricTester::get_zero_element(), MBMesquite::NonGradient::getPatchDimension(), MBMesquite::MappingFunction2D::jacobian(), MBMesquite::MappingFunction3D::jacobian(), MBMesquite::MeshUtil::lambda_distribution(), MBMesquite::TargetWriter::loop_over_mesh(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), TriTauMetric::matrix(), non_slave_node_set(), MBMesquite::CachingTargetCalculator::notify_sub_patch(), MBMesquite::SmartLaplacianSmoother::num_inverted(), MBMesquite::populate_data(), project_gradient(), MsqMeshEntityTest::test_all_nodes(), MsqMeshEntityTest::test_check_element_orientation(), QualityMetricTester::test_diagonal_with_fixed_vertex(), QualityMetricTest::test_fixed_vertex_list(), QualityMetricTester::test_get_element_indices(), QualityMetricTester::test_get_indices_fixed(), QualityMetricTester::test_get_sample_indices(), QualityMetricTester::test_gradient_reflects_quality(), QualityMetricTester::test_gradient_with_fixed_vertex(), QualityMetricTester::test_hessian_with_fixed_vertex(), MappingFunctionTest::test_jacobian_2d(), MappingFunctionTest::test_jacobian_3d(), QualityMetricTester::test_measures_quality(), PatchDataTest::test_patch_contents(), PatchDataTest::test_quad8_patch(), MsqMeshEntityTest::test_unsigned_area_common(), MsqMeshEntityTest::test_unsigned_area_poly(), TerminationCriterionTest::test_untangled_mesh(), PatchDataTest::test_update_slave_node_coords(), update_slave_node_coordinates(), MBMesquite::NonSmoothDescent::validity_check(), and MBMesquite::MeshWriter::write_vtk().

{
    assert( index < elementArray.size() );
    return elementArray[index];
}
const MsqMeshEntity & MBMesquite::PatchData::element_by_index ( size_t  index) const [inline]

Definition at line 884 of file PatchData.hpp.

References elementArray.

{
    assert( index < elementArray.size() );
    return elementArray[index];
}
void MBMesquite::PatchData::enslave_higher_order_nodes ( const size_t *  element_offset_array,
unsigned char *  vertex_flags,
MsqError err 
) const [private]

Call before initialize_data to change vertex_flags for higher-order nodes to MSQ_DEPENDENT.

Definition at line 1521 of file PatchData.cpp.

References elemConnectivityArray, elementArray, MBMesquite::MsqVertex::MSQ_DEPENDENT, MBMesquite::MsqVertex::MSQ_HARD_FIXED, and vertexHandlesArray.

Referenced by fill().

{
    for( size_t i = 0; i < elementArray.size(); ++i )
    {
        size_t start    = elem_offset_array[i];
        size_t conn_len = elem_offset_array[i + 1] - start;
        for( size_t j = elementArray[i].vertex_count(); j < conn_len; ++j )
        {
            const size_t vert_idx = elemConnectivityArray[start + j];
            assert( vert_idx < vertexHandlesArray.size() );
            if( !( vertex_flags[vert_idx] & MsqVertex::MSQ_HARD_FIXED ) )
                vertex_flags[vert_idx] |= MsqVertex::MSQ_DEPENDENT;
        }
    }
}
void MBMesquite::PatchData::fill ( size_t  num_vertex,
const double *  vtx_coords,
size_t  num_elem,
EntityTopology  type,
const size_t *  connectivity,
const bool *  vertex_fixed_flags,
MsqError err 
)

For use by testing code -- create patch explicitly.

Create a patch containing elements of the same type and without any higher-order nodes.

Parameters:
num_vertexNumber of vertices in patch
vtx_coordsArray of vertex coords. Length must be 3*num_vertex
typeElement type
connectivityElement connectivity, specified as a list of vertex numbers, beginning with zero.
vertex_fixed_flagsOptional array to specify which vertices are to be marked as fixed. If not specified, no vertices are fixed.

Definition at line 1660 of file PatchData.cpp.

References MBMesquite::arrptr(), and MSQ_CHKERR.

Referenced by MBMesquite::create_four_quads_patch(), MBMesquite::create_ideal_element_patch(), MBMesquite::create_one_hex_patch(), MBMesquite::create_one_inverted_tet_patch(), MBMesquite::create_one_pyr_patch(), MBMesquite::create_one_quad_patch(), MBMesquite::create_one_tet_patch(), MBMesquite::create_one_tri_patch(), MBMesquite::create_one_wdg_patch(), MBMesquite::create_qm_two_hex_patch(), MBMesquite::create_qm_two_pyr_patch(), MBMesquite::create_qm_two_quad_patch_with_domain(), MBMesquite::create_qm_two_tet_patch(), MBMesquite::create_qm_two_tri_patch_with_domain(), MBMesquite::create_qm_two_wdg_patch(), MBMesquite::create_six_quads_patch_with_domain(), MBMesquite::create_twelve_hex_patch(), MBMesquite::create_two_tri_patch(), fill(), IdealTargetTest::get_calc_target(), QualityMetricTester::get_ideal_element(), QualityMetricTester::get_ideal_hexes(), QualityMetricTester::get_ideal_quads(), QualityMetricTester::get_ideal_tris(), init_pd(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), MsqMeshEntityTest::test_all_nodes(), QualityMetricTest::test_fixed_vertex_list(), TargetCalculatorTest::test_get_refmesh_Jacobian_2D(), TargetCalculatorTest::test_get_refmesh_Jacobian_3D(), TMPQualityMetricTest< QMType >::test_gradient_3D(), TMPQualityMetricTest< QMType >::test_gradient_common(), MappingFunctionTest::test_jacobian_2d(), MappingFunctionTest::test_jacobian_3d(), PatchDataTest::test_patch_contents(), PatchDataTest::test_quad8_patch(), MsqMeshEntityTest::test_unsigned_area_common(), MsqMeshEntityTest::test_unsigned_area_poly(), and PatchDataTest::test_update_slave_node_coords().

{
    std::vector< EntityTopology > types( num_elem );
    std::fill( types.begin(), types.end(), type );
    const EntityTopology* type_ptr = num_elem ? arrptr( types ) : 0;
    this->fill( num_vertex, coords, num_elem, type_ptr, connectivity, fixed, err );MSQ_CHKERR( err );
}
void MBMesquite::PatchData::fill ( size_t  num_vertex,
const double *  vtx_coords,
size_t  num_elem,
const EntityTopology elem_types,
const size_t *  connectivity,
const bool *  vertex_fixed_flags,
MsqError err 
)

For use by testing code -- create patch explicitly.

Create a patch containing elements without any higher-order nodes.

Parameters:
num_vertexNumber of vertices in patch
vtx_coordsArray of vertex coords. Length must be 3*num_vertex
elem_typesThe type of each element
connectivityElement connectivity, specified as a list of vertex numbers, beginning with zero.
vertex_fixed_flagsOptional array to specify which vertices are to be marked as fixed. If NULL, no vertices are fixed.

Definition at line 1669 of file PatchData.cpp.

References MBMesquite::arrptr(), corners, fill(), and MSQ_CHKERR.

{
    std::vector< size_t > lengths( num_elem );
    std::transform( types, types + num_elem, lengths.begin(), std::ptr_fun( TopologyInfo::corners ) );
    const size_t* len_ptr = num_elem ? arrptr( lengths ) : 0;
    this->fill( num_vertex, coords, num_elem, types, len_ptr, conn, fixed, err );MSQ_CHKERR( err );
}
void MBMesquite::PatchData::fill ( size_t  num_vertex,
const double *  vtx_coords,
size_t  num_elem,
const EntityTopology elem_types,
const size_t *  vertex_per_elem,
const size_t *  elem_connectivity,
const bool *  vertex_fixed_flags,
MsqError err 
)

For use by testing code -- create patch explicitly.

Most general form of fill function. Works for polygons, elements with higher-order nodes, etc.

Parameters:
num_vertexNumber of vertices in patch
vtx_coordsArray of vertex coords. Length must be 3*num_vertex
elem_typesThe type of each element
vertex_per_elemThe length of the connectivity list for each element.
connectivityElement connectivity, specified as a list of vertex numbers, beginning with zero.
vertex_fixed_flagsOptional array to specify which vertices are to be marked as fixed. If NULL, no vertices are fixed.

Definition at line 1678 of file PatchData.cpp.

References MBMesquite::arrptr(), byteArray, elemConnectivityArray, element_by_index(), elementArray, elementHandlesArray, enslave_higher_order_nodes(), get_connectivity_array(), MBMesquite::Settings::get_slaved_ho_node_mode(), initialize_data(), mSettings, MSQ_ERRRTN, MBMesquite::MsqVertex::MSQ_HARD_FIXED, MBMesquite::MsqVertex::MSQ_PATCH_FIXED, MSQ_SETERR, NOT_IMPLEMENTED, numFreeVertices, numSlaveVertices, MBMesquite::MsqMeshEntity::set_element_type(), MBMesquite::Settings::SLAVE_ALL, MBMesquite::Settings::SLAVE_NONE, moab::sum(), vertexArray, and vertexHandlesArray.

{
    size_t i;

    // count vertex uses
    size_t num_uses = std::accumulate( lengths, lengths + num_elem, 0 );

    // Allocate storage for data
    vertexArray.resize( num_vertex );
    vertexHandlesArray.resize( num_vertex );
    elementArray.resize( num_elem );
    elementHandlesArray.resize( num_elem );
    elemConnectivityArray.resize( num_uses );
    numFreeVertices  = 0;
    numSlaveVertices = 0;

    // Must call clear() first so that any stale values get
    // zero'd when we call resize.
    byteArray.clear();
    if( fixed )
    {
        byteArray.resize( num_vertex, 0 );
        for( i = 0; i < num_vertex; ++i )
            if( fixed[i] ) byteArray[i] |= ( MsqVertex::MSQ_HARD_FIXED | MsqVertex::MSQ_PATCH_FIXED );
    }

    for( i = 0; i < num_elem; ++i )
    {
        element_by_index( i ).set_element_type( types[i] );
        elementHandlesArray[i] = (Mesh::ElementHandle)i;
    }
    for( i = 0; i < num_vertex; ++i )
        vertexHandlesArray[i] = (Mesh::VertexHandle)i;

    memcpy( get_connectivity_array(), conn, num_uses * sizeof( size_t ) );

    std::vector< size_t > offsets( num_elem + 1 );
    size_t sum = offsets[0] = 0;
    for( i = 1; i <= num_elem; ++i )
        offsets[i] = sum += lengths[i - 1];

    const Settings::HigherOrderSlaveMode ho_mode =
        mSettings ? mSettings->get_slaved_ho_node_mode() : Settings::SLAVE_ALL;
    switch( ho_mode )
    {
        case Settings::SLAVE_ALL:
            byteArray.resize( num_vertex, 0 );
            enslave_higher_order_nodes( arrptr( offsets ), arrptr( byteArray ), err );MSQ_ERRRTN( err );
            break;
        case Settings::SLAVE_NONE:
            // Do nothing.  We clear other bits when processing the 'fixed' array above.
            break;
        default:
            MSQ_SETERR( err )
            ( "Specified higher-order noded slaving scheme not supported "
              "when initializind PatchData using PatchData::fill",
              MsqError::NOT_IMPLEMENTED );
            return;
    }

    this->initialize_data( arrptr( offsets ), arrptr( byteArray ), err );MSQ_ERRRTN( err );

    // initialize_data will re-order vertex handles and
    // update element connectivity accordingly.  Use
    // the values we stored in vertexHandlesArray to
    // figure out the new index of each vertex, and initialize
    // the vertex.
    for( i = 0; i < num_vertex; ++i )
        vertexArray[i] = coords + 3 * (size_t)vertexHandlesArray[i];

    for( i = 0; i < num_vertex; ++i )
        vertexArray[i].flags() = byteArray[i];
}

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

Definition at line 943 of file PatchData.cpp.

References elemConnectivityArray, elementArray, MSQ_FUNCTION_TIMER, num_nodes(), vertAdjacencyArray, and vertAdjacencyOffsets.

Referenced by MBMesquite::EdgeIterator::EdgeIterator(), get_vertex_element_adjacencies(), and reorder().

{
    MSQ_FUNCTION_TIMER( "PatchData::generate_vertex_to_element_data" );

    // Skip if data already exists
    if( !vertAdjacencyArray.empty() ) return;

    // Skip if patch is empty
    if( 0 == num_nodes() ) return;

    // Allocate offset array
    vertAdjacencyOffsets.clear();
    vertAdjacencyOffsets.resize( num_nodes() + 1, 0 );

    // Temporarily use offsets array to hold per-vertex element count
    std::vector< MsqMeshEntity >::iterator elem_iter;
    const std::vector< MsqMeshEntity >::iterator elem_end = elementArray.end();
    for( elem_iter = elementArray.begin(); elem_iter != elem_end; ++elem_iter )
    {
        size_t* conn_iter      = elem_iter->get_vertex_index_array();
        const size_t* conn_end = conn_iter + elem_iter->node_count();
        for( ; conn_iter != conn_end; ++conn_iter )
            ++vertAdjacencyOffsets[*conn_iter];
    }

    // Convert counts to end indices.
    // When done, vertAdjacencyOffsets will contain, for each vertex,
    // one more than the *last* index for that vertex's data in the
    // adjacency array.  This is *not* the final state for this data.
    // See comments for next loop.
    std::vector< size_t >::iterator off_iter      = vertAdjacencyOffsets.begin();
    const std::vector< size_t >::iterator off_end = vertAdjacencyOffsets.end();
    size_t prev                                   = *off_iter;
    ++off_iter;
    for( ; off_iter != off_end; ++off_iter )
    {
        prev += *off_iter;
        *off_iter = prev;
    }

    // Allocate space for element numbers
    const size_t num_vert_uses = vertAdjacencyOffsets[num_nodes() - 1];
    assert( num_vert_uses == elemConnectivityArray.size() );
    vertAdjacencyArray.resize( num_vert_uses );

    // Fill vertAdjacencyArray, using the indices in vertAdjacencyOffsets
    // as the location to insert the next element number in
    // vertAdjacencyArray.  When done, vertAdjacenyOffsets will contain
    // the start index for each vertex, rather than one past the last
    // index.
    for( size_t i = 0; i < elementArray.size(); ++i )
    {
        size_t* conn_iter      = elementArray[i].get_vertex_index_array();
        const size_t* conn_end = conn_iter + elementArray[i].node_count();
        for( ; conn_iter != conn_end; ++conn_iter )
        {
            const size_t array_index        = --vertAdjacencyOffsets[*conn_iter];
            vertAdjacencyArray[array_index] = i;
        }
    }

    // Last entry should be number of vertex uses (one past the
    // last index of the last vertex.)
    vertAdjacencyOffsets[num_nodes()] = num_vert_uses;
}
void MBMesquite::PatchData::get_adjacent_entities_via_n_dim ( int  n,
size_t  ent_ind,
std::vector< size_t > &  adj_ents,
MsqError err 
)

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

Fills a vector of indices into the entities array. The entities in the vector are connected the given entity (ent_ind) via an n-diminsional entity (where 'n' is a given integer). Thus, if n = 0, the entities must be connected via a vertex. If n = 1, the entities must be connected via an edge. If n = 2, the entities must be connected via a two-dimensional element. NOTE: if n is 2 and the elements in the entity array are two-dimensional, no entities should meet this criterion. The adj_ents vector is cleared at the beginning of the call.

Definition at line 670 of file PatchData.cpp.

References get_element_vertex_indices(), get_vertex_element_indices(), MSQ_ERRRTN, and MBMesquite::MSQ_MAX_NUM_VERT_PER_ENT.

{
    // reset the vector
    adj_ents.clear();
    // vertices of this entity (given by ent_ind)
    vector< size_t > verts;
    // vector to store elements attached to the vertices in verts
    vector< size_t > elem_on_vert[MSQ_MAX_NUM_VERT_PER_ENT];
    // length of above vectos
    int length_elem_on_vert[MSQ_MAX_NUM_VERT_PER_ENT];
    // get verts on this element
    get_element_vertex_indices( ent_ind, verts, err );
    int num_vert = verts.size();
    int i        = 0;
    int j        = 0;
    for( i = 0; i < num_vert; ++i )
    {
        // get elements on the vertices in verts and the number of vertices
        get_vertex_element_indices( verts[i], elem_on_vert[i], err );MSQ_ERRRTN( err );
        length_elem_on_vert[i] = elem_on_vert[i].size();
    }
    // this_ent is the index for an entity which is a candidate to be placed
    // into adj_ents
    size_t this_ent;
    // num of times this_ent has been found in the vectors of entity indices
    int counter = 0;
    i           = 0;
    // loop of each vert on ent_ind
    while( i < num_vert )
    {
        // loop over each ent connected to vert
        j = 0;
        while( j < length_elem_on_vert[i] )
        {
            // get candidate element
            this_ent = elem_on_vert[i][j];
            // if we haven't already consider this ent
            if( this_ent != ent_ind )
            {
                // if this_ent occurred earlier we would have already considered it
                // so start at i and j+1
                int k1 = i;
                int k2 = j + 1;
                // this_ent has occured once so far
                counter = 1;
                // while k1 < num_vert
                while( k1 < num_vert )
                {
                    // loop over entries in the elem on vert vector
                    while( k2 < length_elem_on_vert[k1] )
                    {
                        // if it matches this_ent
                        if( elem_on_vert[k1][k2] == this_ent )
                        {
                            // mark it as 'seen', by making it the same as ent_ind
                            // i.e., the entity  passed to us.
                            elem_on_vert[k1][k2] = ent_ind;
                            ++counter;
                            // do not look at remaining elems in this vector
                            k2 += length_elem_on_vert[k1];
                        }
                        else
                            ++k2;
                    }
                    ++k1;
                    k2 = 0;
                }
                // if this_ent occured enough times and isn't ent_ind
                if( counter > n && this_ent != ent_ind ) { adj_ents.push_back( this_ent ); }
            }
            ++j;
        }
        ++i;
    }
}
void MBMesquite::PatchData::get_adjacent_vertex_indices ( size_t  vertex_index,
std::vector< size_t > &  vert_indices,
MsqError err 
) const

This function fills a vector<size_t> with the indices to vertices connected to the given vertex by an edge. If vert_indices is not initially empty, the function will not delete the current contents. Instead, it will append the new indices at the end of the vector.

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

Definition at line 596 of file PatchData.cpp.

References MBMesquite::adj(), bitMap, conn, corners, dim, elementArray, MSQ_ERRRTN, num_nodes(), and MBMesquite::POLYGON.

Referenced by MBMesquite::EdgeLengthQualityMetric::evaluate_common(), MBMesquite::EdgeLengthRangeQualityMetric::evaluate_common(), MBMesquite::LocalSizeQualityMetric::evaluate_with_indices(), MBMesquite::get_delta_C(), MBMesquite::SmartLaplacianSmoother::optimize_vertex_positions(), MBMesquite::LaplacianSmoother::optimize_vertex_positions(), and QualityMetricTester::test_get_vertex_indices().

{
    bitMap.clear();
    bitMap.resize( num_nodes(), false );

    const size_t* conn;
    size_t conn_idx, curr_vtx_idx;
    const unsigned* adj;
    unsigned num_adj, i;
    std::vector< MsqMeshEntity >::const_iterator e;
    for( e = elementArray.begin(); e != elementArray.end(); ++e )
    {
        conn     = e->get_vertex_index_array();
        conn_idx = std::find( conn, conn + e->node_count(), vertex_index ) - conn;
        if( conn_idx == e->node_count() ) continue;

        // If a higher-order node, return corners of side/face
        // that node is in the center of.
        EntityTopology type = e->get_element_type();
        if( conn_idx >= TopologyInfo::corners( type ) && type != POLYGON )
        {
            unsigned dim, id;
            TopologyInfo::side_from_higher_order( type, e->node_count(), conn_idx, dim, id, err );MSQ_ERRRTN( err );
            adj = TopologyInfo::side_vertices( type, dim, id, num_adj );
        }
        else
        {
            EntityTopology topo = e->get_element_type();
            if( topo == POLYGON )
            {
                unsigned number_of_nodes = e->node_count();
                num_adj                  = 2;  // always 2 for a polygon
                unsigned vert_adj[2];
                vert_adj[0] = ( conn_idx + 1 ) % number_of_nodes;
                vert_adj[1] = ( conn_idx + number_of_nodes - 1 ) % number_of_nodes;
                for( i = 0; i < num_adj; ++i )
                {
                    curr_vtx_idx = conn[vert_adj[i]];  // get index into patch vertex list
                    if( !bitMap[curr_vtx_idx] )
                    {
                        vert_indices.push_back( curr_vtx_idx );
                        bitMap[curr_vtx_idx] = true;
                    }
                }
            }
            else
            {
                adj = TopologyInfo::adjacent_vertices( topo, conn_idx, num_adj );
                for( i = 0; i < num_adj; ++i )
                {
                    curr_vtx_idx = conn[adj[i]];  // get index into patch vertex list
                    if( !bitMap[curr_vtx_idx] )
                    {
                        vert_indices.push_back( curr_vtx_idx );
                        bitMap[curr_vtx_idx] = true;
                    }
                }
            }
        }
    }
}

Definition at line 264 of file PatchData.hpp.

References MBMesquite::arrptr(), and elemConnectivityArray.

Referenced by fill().

    {
        return arrptr( elemConnectivityArray );
    }
void MBMesquite::PatchData::get_domain_normal_at_corner ( size_t  elemen_index,
unsigned  corner,
Vector3D normal,
MsqError err 
)

Definition at line 1324 of file PatchData.cpp.

References elementArray, elementHandlesArray, get_domain_normal_at_vertex(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqError::INVALID_ARG, MSQ_CHKERR, and MSQ_SETERR.

Referenced by MBMesquite::AspectRatioGammaQualityMetric::evaluate(), and get_domain_normal_at_sample().

{
    assert( elem_index < elementArray.size() );
    if( 2 != TopologyInfo::dimension( elementArray[elem_index].get_element_type() ) )
    {
        MSQ_SETERR( err )( "Attempt to get corners of non-surface element", MsqError::INVALID_ARG );
        return;
    }

    MsqMeshEntity& elem                = elementArray[elem_index];
    const size_t* const vertex_indices = elem.get_vertex_index_array();
    get_domain_normal_at_vertex( vertex_indices[corner], elementHandlesArray[elem_index], normal, err );MSQ_CHKERR( err );
}
void MBMesquite::PatchData::get_domain_normal_at_element ( size_t  elem_index,
Vector3D surf_norm,
MsqError err 
)

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

Definition at line 1209 of file PatchData.cpp.

References domain_set(), element_by_index(), MBMesquite::MeshDomain::element_normal_at(), elementArray, elementHandlesArray, get_domain(), get_domain_normal_at_vertex(), MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqError::INVALID_STATE, MSQ_ERRRTN, MSQ_SETERR, and MBMesquite::MsqMeshEntity::node_count().

Referenced by MBMesquite::MsqMeshEntity::check_element_orientation_corners(), MBMesquite::MsqMeshEntity::compute_signed_area(), MBMesquite::condition_number_2d(), MBMesquite::IdealWeightMeanRatio::evaluate(), MBMesquite::IdealWeightInverseMeanRatio::evaluate(), 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(), get_domain_normal_at_element(), get_domain_normal_at_sample(), and untangle_function_2d().

{
    // check if element as a mid-face node
    const MsqMeshEntity& elem = element_by_index( elem_index );
    const int mid_node = TopologyInfo::higher_order_from_side( elem.get_element_type(), elem.node_count(), 2, 0, err );MSQ_ERRRTN( err );
    // if we have the mid-element vertex, get cached normal for it
    if( mid_node > 0 )
    {
        get_domain_normal_at_vertex( elem.get_vertex_index_array()[mid_node], elementHandlesArray[elem_index],
                                     surf_norm, err );MSQ_ERRRTN( err );
    }
    // otherwise query domain for normal at element centroid
    else if( domain_set() )
    {
        assert( elem_index < elementArray.size() );
        elementArray[elem_index].get_centroid( surf_norm, *this, err );MSQ_ERRRTN( err );
        get_domain()->element_normal_at( elementHandlesArray[elem_index], surf_norm );
    }
    else
        MSQ_SETERR( err )( "No domain constraint set.", MsqError::INVALID_STATE );
}
MESQUITE_EXPORT void MBMesquite::PatchData::get_domain_normal_at_element ( const MsqMeshEntity elem_ptr,
Vector3D surf_norm,
MsqError err 
) [inline]

Alternative signature. Same functionality.

Definition at line 407 of file PatchData.hpp.

References elementArray, and get_domain_normal_at_element().

    {
        get_domain_normal_at_element( size_t( elem_ptr - &( elementArray[0] ) ), surf_norm, err );
    }
void MBMesquite::PatchData::get_domain_normal_at_mid_edge ( size_t  element_index,
unsigned  edge_number,
Vector3D normal,
MsqError err 
)

Definition at line 1231 of file PatchData.cpp.

References domain_set(), element_by_index(), MBMesquite::MeshDomain::element_normal_at(), elementHandlesArray, get_domain(), get_domain_normal_at_vertex(), MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqError::INVALID_STATE, MSQ_ERRRTN, MSQ_SETERR, MBMesquite::MsqMeshEntity::node_count(), and vertex_by_index().

Referenced by get_domain_normal_at_sample().

{
    // check if element as a mid-edge node
    const MsqMeshEntity& elem = element_by_index( elem_index );
    const int mid_node =
        TopologyInfo::higher_order_from_side( elem.get_element_type(), elem.node_count(), 1, edge_num, err );MSQ_ERRRTN( err );
    // if we have the mid-edge vertex, get cached normal for it
    if( mid_node > 0 )
    {
        get_domain_normal_at_vertex( elem.get_vertex_index_array()[mid_node], elementHandlesArray[elem_index], normal,
                                     err );MSQ_ERRRTN( err );
    }
    // otherwise query domain for normal at center of edge
    else if( domain_set() )
    {
        const unsigned* edge = TopologyInfo::edge_vertices( elem.get_element_type(), edge_num, err );MSQ_ERRRTN( err );
        const MsqVertex& v1 = vertex_by_index( elem.get_vertex_index_array()[edge[0]] );
        const MsqVertex& v2 = vertex_by_index( elem.get_vertex_index_array()[edge[1]] );
        normal              = 0.5 * ( v1 + v2 );
        get_domain()->element_normal_at( elementHandlesArray[elem_index], normal );
    }
    else
    {
        MSQ_SETERR( err )( "No domain constraint set.", MsqError::INVALID_STATE );
        return;
    }
}
MESQUITE_EXPORT void MBMesquite::PatchData::get_domain_normal_at_sample ( size_t  element_index,
Sample  location,
Vector3D surf_norm,
MsqError err 
) [inline]

Definition at line 413 of file PatchData.hpp.

References MBMesquite::Sample::dimension, get_domain_normal_at_corner(), get_domain_normal_at_element(), get_domain_normal_at_mid_edge(), MBMesquite::MsqError::INVALID_ARG, MSQ_SETERR, and MBMesquite::Sample::number.

Referenced by MBMesquite::TMPQualityMetric::evaluate_surface_common(), and MBMesquite::MsqMeshEntity::inverted_jacobian_2d().

    {
        switch( location.dimension )
        {
            case 0:
                get_domain_normal_at_corner( element_index, location.number, surf_norm, err );
                break;
            case 1:
                get_domain_normal_at_mid_edge( element_index, location.number, surf_norm, err );
                break;
            case 2:
                assert( location.number == 0 );
                get_domain_normal_at_element( element_index, surf_norm, err );
                break;
            default:
                MSQ_SETERR( err )
                ( "Invalid dimension for surface element subentity.\n", MsqError::INVALID_ARG );
        }
    }
void MBMesquite::PatchData::get_domain_normals_at_corners ( size_t  element_index,
Vector3D  normals_out[],
MsqError err 
)

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

Definition at line 1259 of file PatchData.cpp.

References domain_set(), MBMesquite::MeshDomain::element_normal_at(), elementArray, elementHandlesArray, get_domain(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqError::INVALID_ARG, MBMesquite::MsqError::INVALID_STATE, MSQ_ERRRTN, MSQ_SETERR, normalData, update_cached_normals(), MBMesquite::MsqMeshEntity::vertex_count(), vertexArray, and vertexNormalIndices.

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

{
    if( !domain_set() )
    {
        MSQ_SETERR( err )( "No domain constraint set.", MsqError::INVALID_STATE );
        return;
    }

    assert( elem_index < elementArray.size() );
    if( 2 != TopologyInfo::dimension( elementArray[elem_index].get_element_type() ) )
    {
        MSQ_SETERR( err )( "Attempt to get corners of non-surface element", MsqError::INVALID_ARG );
        return;
    }

    if( normalData.empty() )
    {
        update_cached_normals( err );MSQ_ERRRTN( err );
    }

    MsqMeshEntity& elem                = elementArray[elem_index];
    const unsigned count               = elem.vertex_count();
    const size_t* const vertex_indices = elem.get_vertex_index_array();
    for( size_t i = 0; i < count; ++i )
    {
        const size_t v = vertex_indices[i];
        if( vertexNormalIndices.empty() ) { normals_out[i] = normalData[v]; }
        else if( vertexNormalIndices[v] < normalData.size() )
        {
            normals_out[i] = normalData[vertexNormalIndices[v]];
        }
        else
        {
            normals_out[i] = vertexArray[v];
            get_domain()->element_normal_at( elementHandlesArray[elem_index], normals_out[i] );
        }
    }
}

Definition at line 820 of file PatchData.hpp.

References MBMesquite::arrptr(), elementArray, MBMesquite::MsqError::INVALID_STATE, and MSQ_SETERR.

{
    if( elementArray.empty() ) MSQ_SETERR( err )( "No element array defined", MsqError::INVALID_STATE );
    return arrptr( elementArray );
}
void MBMesquite::PatchData::get_element_vertex_coordinates ( size_t  elem_index,
std::vector< Vector3D > &  coords,
MsqError err 
)

Get the coordinates of vertices attached to the specified element.

Get coordinates of element vertices, in canonical order.

Parameters:
elem_indexThe element index in the Patch
coordsThis vector will have the coordinates appended to it. If necessary, make sure to clear the vector before calling the function.

Definition at line 523 of file PatchData.cpp.

References elementArray, num_elements(), and vertexArray.

Referenced by MBMesquite::AspectRatioGammaQualityMetric::evaluate().

{
    // Check index
    if( elem_index >= num_elements() ) return;

    // Ask the element for its vertex indices
    assert( elem_index < elementArray.size() );
    const size_t* vertex_indices = elementArray[elem_index].get_vertex_index_array();

    // Get the coords for each indicated vertex
    size_t num_verts = elementArray[elem_index].vertex_count();
    coords.reserve( coords.size() + num_verts );
    for( size_t i = 0; i < num_verts; i++ )
        coords.push_back( Vector3D( vertexArray[vertex_indices[i]] ) );
}
void MBMesquite::PatchData::get_element_vertex_indices ( size_t  elem_index,
std::vector< size_t > &  vertex_indices,
MsqError err 
)

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

This is an inefficient way of retrieving vertex_indices. Use PatchData::get_element_array followed by MsqMeshEntity::get_vertex_index_array() if you don't need to fill an STL vector.

Definition at line 544 of file PatchData.cpp.

References elementArray.

Referenced by get_adjacent_entities_via_n_dim().

{
    // Ask the element for its vertex indices
    assert( elem_index < elementArray.size() );
    elementArray[elem_index].get_vertex_indices( vertex_indices );
}
void MBMesquite::PatchData::get_free_vertex_coordinates ( std::vector< Vector3D > &  coords_out) const [inline]

Definition at line 902 of file PatchData.hpp.

References num_free_vertices(), and vertexArray.

Referenced by MBMesquite::QuasiNewton::optimize_vertex_positions().

{
    coords_out.resize( num_free_vertices() );
    std::copy( vertexArray.begin(), vertexArray.begin() + num_free_vertices(), coords_out.begin() );
}

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

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

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

Definition at line 480 of file PatchData.cpp.

References MBMesquite::length_squared(), vertexArray, and MBMesquite::PatchDataVerticesMemento::vertices.

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

{
    double max_dist = 0.0;
    for( size_t i = 0; i < memento->vertices.size(); ++i )
    {
        double temp_dist = ( vertexArray[i] - memento->vertices[i] ).length_squared();
        if( temp_dist > max_dist ) max_dist = temp_dist;
    }
    return max_dist;
}
void MBMesquite::PatchData::get_minmax_edge_length ( double &  min,
double &  max 
) const

Definition at line 112 of file PatchData.cpp.

References conn, MBMesquite::edges, element_by_index(), MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::length_squared(), num_elements(), and vertex_by_index().

Referenced by MBMesquite::NonGradient::initialize_mesh_iteration(), UnOptimizer::optimize_vertex_positions(), MBMesquite::SteepestDescent::optimize_vertex_positions(), and MBMesquite::ShapeImprover::run_wrapper().

{
    min = HUGE_VAL;
    max = -HUGE_VAL;

    for( size_t i = 0; i < num_elements(); ++i )
    {
        const MsqMeshEntity& elem = element_by_index( i );
        const size_t* conn        = elem.get_vertex_index_array();
        const unsigned num_edges  = TopologyInfo::edges( elem.get_element_type() );
        for( unsigned e = 0; e < num_edges; ++e )
        {
            const unsigned* edge = TopologyInfo::edge_vertices( elem.get_element_type(), e );
            const double len_sqr =
                ( vertex_by_index( conn[edge[0]] ) - vertex_by_index( conn[edge[1]] ) ).length_squared();
            if( len_sqr < min ) min = len_sqr;
            if( len_sqr > max ) max = len_sqr;
        }
    }
    min = sqrt( min );
    max = sqrt( max );
}
void MBMesquite::PatchData::get_minmax_element_unsigned_area ( double &  min,
double &  max,
MsqError err 
)

Returns the maximum volume or area out of all the elements in the patch This information is stored in the patch and should not decrease performance when used properly. See also PatchData::clear_computed_info() .

Definition at line 83 of file PatchData.cpp.

References computedInfos, elementArray, have_computed_info(), INTERNAL_ERROR, MAX_UNSIGNED_AREA, MIN_UNSIGNED_AREA, MBMesquite::MSQ_DBL_MAX, MSQ_ERRRTN, MSQ_SETERR, note_have_info(), and num_elements().

{
    if( !have_computed_info( MAX_UNSIGNED_AREA ) || !have_computed_info( MIN_UNSIGNED_AREA ) )
    {
        max          = 0;
        min          = MSQ_DBL_MAX;
        size_t count = num_elements();
        for( size_t i = 0; i < count; ++i )
        {
            double vol;
            assert( i < elementArray.size() );
            vol = elementArray[i].compute_unsigned_area( *this, err );MSQ_ERRRTN( err );
            if( vol > max ) max = vol;
            if( vol < min ) min = vol;
        }
        note_have_info( MAX_UNSIGNED_AREA );
        note_have_info( MIN_UNSIGNED_AREA );
        computedInfos[MAX_UNSIGNED_AREA] = max;
        computedInfos[MIN_UNSIGNED_AREA] = min;
    }
    else
    {
        max = computedInfos[MAX_UNSIGNED_AREA];
        min = computedInfos[MIN_UNSIGNED_AREA];
    }

    if( max <= 0 || min < 0 || min == MSQ_DBL_MAX ) MSQ_SETERR( err )( MsqError::INTERNAL_ERROR );
}
void MBMesquite::PatchData::get_sample_location ( size_t  element_index,
Sample  sample,
Vector3D result,
MsqError err 
) const

Get R^3 coordinates for logical sample location.

Definition at line 1874 of file PatchData.cpp.

References MBMesquite::MappingFunction::coefficients(), conn, MBMesquite::MappingFunction::convert_connectivity_indices(), element_by_index(), MBMesquite::MsqMeshEntity::get_element_type(), get_mapping_function(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MSQ_ERRRTN, MSQ_SETERR, MBMesquite::MsqMeshEntity::node_count(), non_slave_node_set(), MBMesquite::MsqError::UNSUPPORTED_ELEMENT, and vertex_by_index().

{
    const MsqMeshEntity& elem      = element_by_index( element_index );
    const NodeSet ho_bits          = non_slave_node_set( element_index );
    const MappingFunction* const f = get_mapping_function( elem.get_element_type() );
    if( !f )
    {
        MSQ_SETERR( err )( "No mapping function", MsqError::UNSUPPORTED_ELEMENT );
        return;
    }

    double coeff[27];
    size_t num_coeff, index[27];
    f->coefficients( sample, ho_bits, coeff, index, num_coeff, err );MSQ_ERRRTN( err );
    f->convert_connectivity_indices( elem.node_count(), index, num_coeff, err );MSQ_ERRRTN( err );

    const size_t* const conn = elem.get_vertex_index_array();
    assert( num_coeff > 0 );
    result = coeff[0] * vertex_by_index( conn[index[0]] );
    for( unsigned i = 1; i < num_coeff; ++i )
        result += coeff[i] * vertex_by_index( conn[index[i]] );
}
MESQUITE_EXPORT NodeSet MBMesquite::PatchData::get_samples ( size_t  element) const [inline]

Definition at line 597 of file PatchData.hpp.

References get_samples(), and non_slave_node_set().

    {
        return get_samples( element, non_slave_node_set( element ) );
    }
void MBMesquite::PatchData::get_samples ( size_t  element,
std::vector< Sample > &  samples_out,
MsqError err 
) const

Definition at line 1939 of file PatchData.cpp.

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

{
    NodeSet ns = get_samples( element );
    samples.resize( ns.num_nodes() );
    std::vector< Sample >::iterator i = samples.begin();

    unsigned j;
    EntityTopology type = element_by_index( element ).get_element_type();
    for( j = 0; j < TopologyInfo::corners( type ); ++j )
        if( ns.corner_node( j ) ) *( i++ ) = Sample( 0, j );
    for( j = 0; j < TopologyInfo::edges( type ); ++j )
        if( ns.mid_edge_node( j ) ) *( i++ ) = Sample( 1, j );
    if( TopologyInfo::dimension( type ) == 3 )
    {
        for( j = 0; j < TopologyInfo::faces( type ); ++j )
            if( ns.mid_face_node( j ) ) *( i++ ) = Sample( 2, j );
        if( ns.mid_region_node() ) *( i++ ) = Sample( 3, 0 );
    }
    else if( ns.mid_face_node( 0 ) )
        *( i++ ) = Sample( 2, 0 );

    assert( i == samples.end() );
}

Definition at line 555 of file PatchData.hpp.

References mSettings.

    {
        return mSettings;
    }
void MBMesquite::PatchData::get_subpatch ( size_t  center_vertex_index,
unsigned  num_adj_elem_layers,
PatchData pd_to_fill,
MsqError err 
)

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

Definition at line 1009 of file PatchData.cpp.

References MBMesquite::arrptr(), byteArray, elemConnectivityArray, element_by_index(), elementArray, elementHandlesArray, MBMesquite::MsqMeshEntity::get_element_type(), get_vertex_element_adjacencies(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), initialize_data(), MBMesquite::MsqError::INVALID_ARG, mSettings, MSQ_CHKERR, MSQ_ERRRTN, MBMesquite::MsqVertex::MSQ_PATCH_FIXED, MSQ_SETERR, myDomain, myMesh, MBMesquite::MsqMeshEntity::node_count(), notify_new_patch(), notify_sub_patch(), num_free_vertices(), vert_index(), vertexArray, and vertexHandlesArray.

Referenced by MBMesquite::ObjectiveFunction::evaluate_with_gradient(), CachingTargetTest::test_2d_target_subpatch(), CachingTargetTest::test_3d_target_subpatch(), ExtraDataTest::test_notify_new_patch_sub(), ExtraDataTest::test_notify_subpatch(), PatchDataTest::test_sub_patch(), and CachingTargetTest::test_surface_target_subpatch().

{
    // Make sure we're in range
    if( center_vertex_index >= num_free_vertices() )
    {
        MSQ_SETERR( err )( "Invalid index for center vertex", MsqError::INVALID_ARG );
        return;
    }

    // Notify any observers of the existing subpatch that the mesh
    // in the patch is to be changed.
    subpatch.notify_new_patch();

    // Get list of vertices and elements in subpatch.
    // Ultimately, end up with arrays of unique, sorted indices.
    // It is important that the vertex indices be sorted so later
    // a reverse lookup can be done using a binary search (std::lower_bound).
    std::vector< size_t > elements, vertices, offsets;
    vertices.push_back( center_vertex_index );
    for( unsigned i = 0; i < num_adj_elem_layers; ++i )
    {
        elements.clear();
        for( unsigned v = 0; v < vertices.size(); ++v )
        {
            size_t num_elem;
            const size_t* vert_elems = get_vertex_element_adjacencies( vertices[v], num_elem, err );MSQ_ERRRTN( err );
            elements.insert( elements.end(), vert_elems, vert_elems + num_elem );
        }
        std::sort( elements.begin(), elements.end() );
        elements.erase( std::unique( elements.begin(), elements.end() ), elements.end() );

        vertices.clear();
        for( unsigned e = 0; e < elements.size(); ++e )
        {
            MsqMeshEntity& elem      = element_by_index( elements[e] );
            size_t num_vert          = elem.node_count();
            const size_t* elem_verts = elem.get_vertex_index_array();
            vertices.insert( vertices.end(), elem_verts, elem_verts + num_vert );
        }
        std::sort( vertices.begin(), vertices.end() );
        vertices.erase( std::unique( vertices.begin(), vertices.end() ), vertices.end() );
    }

    // Allocate space for element connectivity info.
    size_t num_vert_uses = 0;
    for( unsigned i = 0; i < elements.size(); ++i )
        num_vert_uses += element_by_index( elements[i] ).node_count();
    subpatch.elementArray.resize( elements.size() );
    subpatch.elementHandlesArray.resize( elements.size() );
    subpatch.elemConnectivityArray.resize( num_vert_uses );
    offsets.resize( elements.size() + 1 );

    // Construct element connectivity data in new patch,
    // and copy element type into new patch
    size_t curr_offset = 0;
    for( unsigned i = 0; i < elements.size(); ++i )
    {
        MsqMeshEntity& elem = element_by_index( elements[i] );
        assert( i < elementArray.size() );
        subpatch.elementArray[i].set_element_type( elem.get_element_type() );
        subpatch.elementHandlesArray[i] = elementHandlesArray[elements[i]];
        const size_t* verts             = elem.get_vertex_index_array();
        offsets[i]                      = curr_offset;
        for( unsigned j = 0; j < elem.node_count(); ++j )
        {
            subpatch.elemConnectivityArray[curr_offset++] =
                std::lower_bound( vertices.begin(), vertices.end(), verts[j] ) - vertices.begin();
        }
    }
    offsets[elements.size()] = curr_offset;

    // Store index in this patch in vertex handle array of subpatch
    // so we can determine how vertices were reordered when setting
    // vertex coordinates.
    assert( sizeof( size_t ) == sizeof( void* ) );
    subpatch.vertexHandlesArray.resize( vertices.size() );
    size_t* vert_handles = reinterpret_cast< size_t* >( &subpatch.vertexHandlesArray[0] );
    std::copy( vertices.begin(), vertices.end(), vert_handles );

    // All vertices except vertex at center_vertex_index are fixed.
    subpatch.byteArray.resize( vertices.size() );
    for( size_t pi = 0; pi < vertices.size(); ++pi )
    {
        if( vertices[pi] == center_vertex_index )
            subpatch.byteArray[pi] = vertexArray[vertices[pi]].get_flags() & ~MsqVertex::MSQ_PATCH_FIXED;
        else
            subpatch.byteArray[pi] = vertexArray[vertices[pi]].get_flags() | MsqVertex::MSQ_PATCH_FIXED;
    }

    // Re-order vertices and initialize other data in subpatch
    subpatch.initialize_data( arrptr( offsets ), &subpatch.byteArray[0], err );MSQ_ERRRTN( err );

    // Copy vertex data into subpatch.  subpatch.vertexHandlesArray contains
    // the indices into this PatchData for each vertex, as reordered by the
    // call to initialize_data.
    subpatch.vertexArray.resize( vertices.size() );
    for( unsigned i = 0; i < vertices.size(); ++i )
    {
        size_t vert_index               = ( size_t )( subpatch.vertexHandlesArray[i] );
        vertices[i]                     = vert_index;
        subpatch.vertexHandlesArray[i]  = vertexHandlesArray[vert_index];
        subpatch.vertexArray[i]         = vertexArray[vert_index];
        subpatch.vertexArray[i].flags() = subpatch.byteArray[i];
    }

    subpatch.myMesh    = myMesh;
    subpatch.myDomain  = myDomain;
    subpatch.mSettings = mSettings;

    notify_sub_patch( subpatch, arrptr( vertices ), elements.empty() ? 0 : arrptr( elements ), err );MSQ_CHKERR( err );
}
const MsqVertex * MBMesquite::PatchData::get_vertex_array ( MsqError err) const [inline]

Returns a pointer to the start of the vertex array.

Returns an array of all vertices in the PatchData.

Definition at line 807 of file PatchData.hpp.

References MBMesquite::arrptr(), MBMesquite::MsqError::INVALID_STATE, MSQ_SETERR, and vertexArray.

Referenced by MBMesquite::TerminationCriterion::accumulate_patch(), MBMesquite::MsqMeshEntity::check_element_orientation_corners(), compute_corner_area(), compute_corner_volume(), MBMesquite::MsqMeshEntity::compute_signed_area(), MBMesquite::MsqMeshEntity::compute_unsigned_area(), MBMesquite::TerminationCriterion::cull_vertices_global(), MBMesquite::VertexConditionNumberQualityMetric::evaluate(), MBMesquite::ConditionNumberQualityMetric::evaluate(), MBMesquite::IdealWeightMeanRatio::evaluate(), MBMesquite::UntangleBetaQualityMetric::evaluate(), MBMesquite::IdealWeightInverseMeanRatio::evaluate(), MBMesquite::EdgeLengthQualityMetric::evaluate_common(), MBMesquite::EdgeLengthRangeQualityMetric::evaluate_common(), 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(), MBMesquite::MsqMeshEntity::get_centroid(), QualityMetricTester::get_degenerate_element(), QualityMetricTester::get_inverted_element(), MBMesquite::MsqMeshEntity::get_local_matrix_map_about_vertex(), QualityMetricTester::get_nonideal_element(), QualityMetricTester::get_zero_element(), MBMesquite::NonSmoothDescent::init_max_step_length(), MBMesquite::NonGradient::initialize_mesh_iteration(), MBMesquite::move_vertex(), MBMesquite::SmartLaplacianSmoother::optimize_vertex_positions(), MBMesquite::LaplacianSmoother::optimize_vertex_positions(), MBMesquite::NonGradient::printPatch(), randomize_vertex(), MBMesquite::NonSmoothDescent::step_acceptance(), VtkTest::test_elements(), QualityMetricTester::test_gradient_reflects_quality(), QualityMetricTester::test_measures_quality(), MBMesquite::MeshWriter::Transform2D::Transform2D(), and MBMesquite::NonSmoothDescent::validity_check().

{
    if( vertexArray.empty() ) MSQ_SETERR( err )( "No vertex array defined", MsqError::INVALID_STATE );
    return arrptr( vertexArray );
}

Definition at line 254 of file PatchData.hpp.

References MBMesquite::arrptr(), and vertexArray.

    {
        return arrptr( vertexArray );
    }
void MBMesquite::PatchData::get_vertex_element_indices ( size_t  vertex_index,
std::vector< size_t > &  elem_indices,
MsqError err 
)

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

Definition at line 552 of file PatchData.cpp.

References get_vertex_element_adjacencies().

Referenced by get_adjacent_entities_via_n_dim().

{
    size_t count;
    const size_t* ptr;
    ptr = get_vertex_element_adjacencies( vertex_index, count, err );
    elem_indices.resize( count );
    std::copy( ptr, ptr + count, elem_indices.begin() );
}
void MBMesquite::PatchData::get_vertex_element_indices ( size_t  vertex_index,
unsigned  element_dimension,
std::vector< size_t > &  elem_indices,
MsqError err 
)

Get the indices of elements adjacent to the specified vertex, and having the specified dimension

Definition at line 561 of file PatchData.cpp.

References dim, elementArray, and get_vertex_element_adjacencies().

{
    elem_indices.clear();
    size_t count;
    const size_t* ptr;
    ptr = get_vertex_element_adjacencies( vertex_index, count, err );
    for( const size_t* const end = ptr + count; ptr != end; ++ptr )
    {
        assert( *ptr < elementArray.size() );
        const EntityTopology type = elementArray[*ptr].get_element_type();
        const unsigned dim        = TopologyInfo::dimension( type );
        if( dim == element_dimension ) elem_indices.push_back( *ptr );
    }
}
size_t MBMesquite::PatchData::get_vertex_index ( MsqVertex vertex) [inline]

gets the index of a vertex in the PatchData vertex array, given a pointer to the vertex.

Definition at line 892 of file PatchData.hpp.

References MBMesquite::arrptr(), and vertexArray.

{
    return vertex - arrptr( vertexArray );
}

Definition at line 182 of file PatchData.hpp.

References haveComputedInfos.

Referenced by get_minmax_element_unsigned_area(), and MBMesquite::operator<<().

    {
        return 0 != ( haveComputedInfos & ( 1 << info ) );
    }
void MBMesquite::PatchData::initialize_data ( size_t *  elem_offset_array,
unsigned char *  vertex_flags,
MsqError err 
) [private]

Call after filling vertex handle and connectivity arrays to finish initializing the PatchData. Reorders vertex handles array such that all higher-order nodes are at end of array, updates element connectivity array appropriately, initalizes numCornerVertices, and per-element vertex and node counts.

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

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

Parameters:
elem_offset_arrayOffset into connectivity array for each element

Definition at line 1538 of file PatchData.cpp.

References MBMesquite::arrptr(), elemConnectivityArray, elementArray, MBMesquite::MsqVertex::MSQ_DEPENDENT, MBMesquite::MsqVertex::MSQ_FIXED, normalData, notify_new_patch(), numFreeVertices, numSlaveVertices, swap(), vertAdjacencyArray, vertAdjacencyOffsets, vertexHandlesArray, and vertexNormalIndices.

Referenced by fill(), get_subpatch(), and set_mesh_entities().

{
    // Clear out data specific to patch
    vertexNormalIndices.clear();
    normalData.clear();
    // vertexDomainDOF.clear();

    // Clear any vertex->element adjacency data.  It
    // is probably invalid, and certainly will be by the time
    // this function completes if the mesh contains higher-order
    // elements.
    vertAdjacencyArray.clear();
    vertAdjacencyOffsets.clear();
    size_t i, j;
    for( i = 0; i < elementArray.size(); ++i )
    {
        size_t start    = elem_offset_array[i];
        size_t conn_len = elem_offset_array[i + 1] - start;
        assert( conn_len > 0 );
        elementArray[i].set_connectivity( &elemConnectivityArray[start], conn_len );
    }

    // Use vertAdjacencyOffsets array as temporary storage.
    vertAdjacencyOffsets.resize( vertexHandlesArray.size() + 1 );
    size_t* vertex_index_map = arrptr( vertAdjacencyOffsets );

    // Count number of free vertices and initialize vertex_index_map
    numFreeVertices = 0;
    for( i = 0; i < vertexHandlesArray.size(); ++i )
    {
        if( !( vertex_flags[i] & MsqVertex::MSQ_FIXED ) ) ++numFreeVertices;
        vertex_index_map[i] = i;
    }

    // Re-order vertices such that all free vertices are
    // first in the list.  Construct map from old to new
    // position in list for updating element connectivity.
    i = 0;
    j = numFreeVertices;
    for( ;; ++i, ++j )
    {
        // find next fixed vertex in the range [i,numFreeVertices)
        for( ; i < numFreeVertices && !( vertex_flags[i] & MsqVertex::MSQ_FIXED ); ++i )
            ;
        // if no more fixed vertices in the free vertex range [0,numFreeVertices)
        if( i == numFreeVertices ) break;
        // find the next free vertex in the range [j,num_nodes)
        for( ; vertex_flags[j] & MsqVertex::MSQ_FIXED; ++j )
            ;
        // swap fixed (i) and free (j) vertices
        vertex_index_map[i] = j;
        vertex_index_map[j] = i;
        std::swap( vertexHandlesArray[i], vertexHandlesArray[j] );
        std::swap( vertex_flags[i], vertex_flags[j] );
    }
    assert( i == numFreeVertices );
    assert( j <= vertexHandlesArray.size() );

    // Update element connectivity data for new vertex indices
    for( i = 0; i < elemConnectivityArray.size(); ++i )
        elemConnectivityArray[i] = vertex_index_map[elemConnectivityArray[i]];

    // Reorder vertices such that free, slave vertices
    // occur after free, non-slave vertices in list.
    numSlaveVertices = 0;
    for( i = 0; i < vertexHandlesArray.size(); ++i )
    {
        if( ( vertex_flags[i] & MsqVertex::MSQ_DEPENDENT ) && !( vertex_flags[i] & MsqVertex::MSQ_FIXED ) )
            ++numSlaveVertices;
    }
    numFreeVertices -= numSlaveVertices;

    if( numSlaveVertices )
    {
        // re-initialize vertex index map
        for( i = 0; i < vertexHandlesArray.size(); ++i )
            vertex_index_map[i] = i;

        // Re-order free vertices such that all slave vertices are
        // last in the list.  Construct map from old to new
        // position in list for updating element connectivity.
        i = 0;
        j = numFreeVertices;
        for( ;; ++i, ++j )
        {
            // find next slave vertex in the range [i,numFreeVertices)
            for( ; i < numFreeVertices && !( vertex_flags[i] & MsqVertex::MSQ_DEPENDENT ); ++i )
                ;
            // if no more slave vertices in [0,numFreeVertices), then done.
            if( i == numFreeVertices ) break;
            // find the next free (non-slave) vertex in the range
            //   [numFreeVertices,numFreeVertices+numSlaveVertices)
            for( ; vertex_flags[j] & MsqVertex::MSQ_DEPENDENT; ++j )
                ;
            // swap free (j) and slave (i) vertices
            vertex_index_map[i] = j;
            vertex_index_map[j] = i;
            std::swap( vertexHandlesArray[i], vertexHandlesArray[j] );
            std::swap( vertex_flags[i], vertex_flags[j] );
        }
        assert( i == numFreeVertices );
        assert( j <= numFreeVertices + numSlaveVertices );

        // Update element connectivity data for new vertex indices
        for( i = 0; i < elemConnectivityArray.size(); ++i )
            elemConnectivityArray[i] = vertex_index_map[elemConnectivityArray[i]];
    }

    // Clear temporary data
    vertAdjacencyOffsets.clear();

    notify_new_patch();
}
MESQUITE_EXPORT bool MBMesquite::PatchData::is_vertex_fixed ( size_t  index) const [inline]

Definition at line 243 of file PatchData.hpp.

References numFreeVertices, and numSlaveVertices.

    {
        return index >= numFreeVertices + numSlaveVertices;
    }
MESQUITE_EXPORT bool MBMesquite::PatchData::is_vertex_free ( size_t  index) const [inline]

Definition at line 231 of file PatchData.hpp.

References numFreeVertices.

Referenced by TriTauMetric::evaluate_with_indices().

    {
        return index < numFreeVertices;
    }
MESQUITE_EXPORT bool MBMesquite::PatchData::is_vertex_not_free ( size_t  index) const [inline]

Definition at line 235 of file PatchData.hpp.

References numFreeVertices.

    {
        return index >= numFreeVertices;
    }
MESQUITE_EXPORT bool MBMesquite::PatchData::is_vertex_slave ( size_t  index) const [inline]

Definition at line 239 of file PatchData.hpp.

References numFreeVertices, and numSlaveVertices.

Referenced by update_slave_node_coordinates().

    {
        return index >= numFreeVertices && ( index - numFreeVertices ) < numSlaveVertices;
    }
void MBMesquite::PatchData::make_handles_unique ( Mesh::EntityHandle handles,
size_t &  count,
size_t *  index_map = 0 
) [static, private]

Code common to misc. methods for populating patch data. Remove duplicates from an array of handles.

Parameters:
handlesThe array of handles to uniquify.
countAs input, the lenght of the #handles array. As output, the number of unique handles remaining in the array.
index_mapIf non-null, this must be an array of the same length as the handles array. If this array is passed, the entry cooresponding to each handle in the input #handles array will be set to the index of that handle in the output array.

Definition at line 1753 of file PatchData.cpp.

Referenced by set_mesh_entities().

{
    if( count < 2 ) { return; }
    // save this now, as we'll be changing count later
    const size_t* index_end = index_map + count;

    if( index_map )
    {
        // Copy input handle list into index map as a temporary
        // copy of the input list.
        assert( sizeof( Mesh::EntityHandle ) == sizeof( size_t ) );
        memcpy( index_map, handles, count * sizeof( size_t ) );
    }

    // Make handles a unique list
    std::sort( handles, handles + count );
    Mesh::EntityHandle* end = std::unique( handles, handles + count );
    count                   = end - handles;

    if( index_map )
    {
        // Replace each handle in index_map with the index of
        // its position in the handles array
        Mesh::EntityHandle* pos;
        for( size_t* iter = index_map; iter != index_end; ++iter )
        {
            pos   = std::lower_bound( handles, handles + count, (Mesh::EntityHandle)*iter );
            *iter = pos - handles;
        }
    }
}
void MBMesquite::PatchData::move_free_vertices_constrained ( Vector3D  dk[],
size_t  nb_vtx,
double  step_size,
MsqError err 
)

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

PatchData::move_free_vertices_constrained() moves the free vertices (see MsqVertex::is_free() ) as specified by the search direction (dk) and scale factor (step_size). After being moved, the vertices are projected onto the appropriate geometry. Fixed vertices are not moved regardless of their corresponding dk direction. It is often useful to use the create_coords_momento() function before calling this function. Compile with -DMSQ_DBG3 to check that fixed vertices are not moved with that call.

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

Definition at line 348 of file PatchData.cpp.

References MBMesquite::MsqError::INVALID_ARG, MSQ_CHKERR, MSQ_ERRRTN, MSQ_SETERR, num_free_vertices(), numSlaveVertices, snap_vertex_to_domain(), update_slave_node_coordinates(), and vertexArray.

Referenced by MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::ConjugateGradient::optimize_vertex_positions(), MBMesquite::SteepestDescent::optimize_vertex_positions(), and MBMesquite::FeasibleNewton::optimize_vertex_positions().

{
    if( nb_vtx != num_free_vertices() )
    {
        MSQ_SETERR( err )
        ( "The directional vector must be of length numVertices.", MsqError::INVALID_ARG );
        return;
    }

    size_t i;
    for( i = 0; i < num_free_vertices(); ++i )
    {
        vertexArray[i] += ( step_size * dk[i] );
        snap_vertex_to_domain( i, err );MSQ_ERRRTN( err );
    }

    if( numSlaveVertices )
    {
        update_slave_node_coordinates( err );MSQ_CHKERR( err );
    }
}
void MBMesquite::PatchData::move_vertex ( const Vector3D delta,
size_t  index,
MsqError err 
) [inline]

This function returns a NodeSet indicating which nodes in the specified element are not slaved.

Definition at line 1897 of file PatchData.cpp.

References conn, corners, MBMesquite::edges, element_by_index(), MBMesquite::faces, MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqVertex::MSQ_DEPENDENT, n, MBMesquite::MsqMeshEntity::node_count(), MBMesquite::NodeSet::set_all_corner_nodes(), MBMesquite::NodeSet::set_mid_edge_node(), MBMesquite::NodeSet::set_mid_face_node(), MBMesquite::NodeSet::set_mid_region_node(), and vertex_by_index().

Referenced by MBMesquite::AWQualityMetric::evaluate_internal(), MBMesquite::TQualityMetric::evaluate_internal(), MBMesquite::AWQualityMetric::evaluate_with_gradient(), MBMesquite::TQualityMetric::evaluate_with_gradient(), MBMesquite::TQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian(), MBMesquite::AWQualityMetric::evaluate_with_Hessian_diagonal(), MBMesquite::TQualityMetric::evaluate_with_Hessian_diagonal(), get_sample_location(), get_samples(), MBMesquite::MeshUtil::lambda_distribution(), and update_slave_node_coordinates().

{
    const MsqMeshEntity& elem = element_by_index( element_index );
    EntityTopology type       = elem.get_element_type();
    const size_t* conn        = elem.get_vertex_index_array();
    const size_t n            = elem.node_count();

    MsqError err;
    bool have_midedge, have_midface, have_midelem;
    unsigned num_edge = 0, num_face = 0, num_corner = TopologyInfo::corners( type );
    TopologyInfo::higher_order( type, n, have_midedge, have_midface, have_midelem, err );
    num_edge = TopologyInfo::edges( type );
    if( TopologyInfo::dimension( type ) == 2 )
        num_face = 1;
    else
        num_face = TopologyInfo::faces( type );

    NodeSet result;
    result.set_all_corner_nodes( type );
    if( have_midedge )
    {
        for( unsigned i = 0; i < num_edge; ++i )
        {
            if( !( vertex_by_index( conn[num_corner + i] ).get_flags() & MsqVertex::MSQ_DEPENDENT ) )
                result.set_mid_edge_node( i );
        }
    }
    if( have_midface )
    {
        for( unsigned i = 0; i < num_face; ++i )
        {
            if( !( vertex_by_index( conn[num_corner + num_edge + i] ).get_flags() & MsqVertex::MSQ_DEPENDENT ) )
                result.set_mid_face_node( i );
        }
    }
    if( have_midelem &&
        !( vertex_by_index( conn[num_corner + num_edge + num_face] ).get_flags() & MsqVertex::MSQ_DEPENDENT ) )
        result.set_mid_region_node();

    return result;
}
void MBMesquite::PatchData::note_have_info ( ComputedInfo  info) [inline, private]

Definition at line 676 of file PatchData.hpp.

References haveComputedInfos.

Referenced by get_minmax_element_unsigned_area().

    {
        haveComputedInfos |= ( 1 << info );
    }

notify all attached ExtraData instances that patch contents have changed

Definition at line 2001 of file PatchData.cpp.

References dataList, and MBMesquite::ExtraData::patchNext.

Referenced by get_subpatch(), initialize_data(), and reorder().

{
    for( ExtraData* iter = dataList; iter; iter = iter->patchNext )
        iter->notify_new_patch();
}

notify all attached ExtraData instances that this patch is being destroyed

Definition at line 2016 of file PatchData.cpp.

References dataList, MBMesquite::ExtraData::notify_patch_destroyed(), MBMesquite::ExtraData::patchNext, and MBMesquite::ExtraData::patchPtr.

Referenced by set_domain(), set_mesh(), and ~PatchData().

{
    // Remove all ExtraDatas from list and notify them
    // that they are being destroyed.
    while( dataList )
    {
        ExtraData* dead_data = dataList;
        dataList             = dataList->patchNext;
        dead_data->patchNext = 0;
        dead_data->patchPtr  = 0;
        dead_data->notify_patch_destroyed();
    }
}
void MBMesquite::PatchData::notify_sub_patch ( PatchData sub_patch,
const size_t *  vertex_index_map,
const size_t *  element_index_map,
MsqError err 
) [private]

notify all attached ExtraData instances that a subpatch is being initalized

Parameters:
sub_patchThe new, already populated subpatch
vertex_index_mapFor the i-th vertex in the subpatch, the i-th entry in this list is the corresponding index in this patch.
element_index_mapFor the i-th element in the subpatch, the i-th entry in this list is the corresponding index in this patch.

Definition at line 2007 of file PatchData.cpp.

References dataList, MSQ_ERRRTN, and MBMesquite::ExtraData::patchNext.

Referenced by get_subpatch().

{
    for( ExtraData* iter = dataList; iter; iter = iter->patchNext )
    {
        iter->notify_sub_patch( sub_patch, vertex_map, element_map, err );MSQ_ERRRTN( err );
    }
}

number of element corners (number of vertex uses) in patch

Definition at line 1652 of file PatchData.cpp.

References elementArray.

Referenced by MBMesquite::NonGradient::printPatch().

{
    size_t result = 0;
    for( unsigned i = 0; i < elementArray.size(); ++i )
        result += elementArray[i].vertex_count();
    return result;
}

number of elements in the Patch.

Definition at line 226 of file PatchData.hpp.

References elementArray.

Referenced by PatchDataTest::check_sub_patch(), MBMesquite::TerminationCriterion::count_inverted(), MetricLogger::evaluate(), MBMesquite::ElementQM::get_element_evaluations(), get_element_vertex_coordinates(), FauxMetric< B >::get_evaluations(), get_minmax_edge_length(), get_minmax_element_unsigned_area(), MBMesquite::NonGradient::getPatchDimension(), MBMesquite::NonSmoothDescent::init_max_step_length(), MBMesquite::MsqHessian::initialize(), MBMesquite::TargetWriter::loop_over_mesh(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), MBMesquite::CachingTargetCalculator::notify_sub_patch(), TestExtraData::notify_sub_patch(), MBMesquite::SmartLaplacianSmoother::num_inverted(), MBMesquite::operator<<(), MBMesquite::NonSmoothDescent::optimize_vertex_positions(), MBMesquite::populate_data(), MBMesquite::NonGradient::printPatch(), reorder(), QualityAssessorTest::test_basic_stats_sample(), MsqMeshEntityTest::test_check_element_orientation(), VtkTest::test_elements(), QualityMetricTester::test_get_element_evaluations(), QualityMetricTester::test_get_in_element_evaluations(), QualityMetricTester::test_get_sample_evaluations(), ExtraDataTest::test_notify_subpatch(), PatchDataTest::test_patch_contents(), PatchDataTest::test_quad8_patch(), update_slave_node_coordinates(), MBMesquite::NonSmoothDescent::validity_check(), and MBMesquite::MeshWriter::write_vtk().

    {
        return elementArray.size();
    }

Definition at line 213 of file PatchData.hpp.

References numFreeVertices.

Referenced by MBMesquite::TerminationCriterion::accumulate_inner(), MBMesquite::TerminationCriterion::accumulate_patch(), check_global_patch_slaved(), ObjectiveFunctionTests::compare_diagonal_gradient(), ObjectiveFunctionTests::compare_hessian_diagonal(), ObjectiveFunctionTests::compare_hessian_gradient(), ObjectiveFunctionTests::compare_numerical_gradient(), ObjectiveFunctionTests::compare_numerical_hessian(), MBMesquite::ObjectiveFunction::compute_patch_numerical_gradient(), MBMesquite::ObjectiveFunction::compute_subpatch_numerical_gradient(), NumericalTestOF::evaluate(), MBMesquite::NonGradient::evaluate(), MBMesquite::EdgeLengthMetric::evaluate_with_gradient(), MBMesquite::PatchPowerMeanP::evaluate_with_gradient(), MBMesquite::CompositeOFMultiply::evaluate_with_gradient(), MBMesquite::VarianceTemplate::evaluate_with_gradient(), DummyOF::evaluate_with_gradient(), MBMesquite::CompositeOFAdd::evaluate_with_gradient(), MBMesquite::LPtoPTemplate::evaluate_with_gradient(), MBMesquite::PMeanPTemplate::evaluate_with_gradient(), MBMesquite::ObjectiveFunction::evaluate_with_gradient(), MBMesquite::PatchPowerMeanP::evaluate_with_Hessian(), MBMesquite::CompositeOFAdd::evaluate_with_Hessian(), MBMesquite::LPtoPTemplate::evaluate_with_Hessian(), MBMesquite::PMeanPTemplate::evaluate_with_Hessian(), MBMesquite::CompositeOFScalarMultiply::evaluate_with_Hessian_diagonal(), MBMesquite::CompositeOFMultiply::evaluate_with_Hessian_diagonal(), MBMesquite::VarianceTemplate::evaluate_with_Hessian_diagonal(), MBMesquite::CompositeOFAdd::evaluate_with_Hessian_diagonal(), MBMesquite::LPtoPTemplate::evaluate_with_Hessian_diagonal(), MBMesquite::PMeanPTemplate::evaluate_with_Hessian_diagonal(), MBMesquite::ElementQM::evaluate_with_indices(), MBMesquite::VertexConditionNumberQualityMetric::evaluate_with_indices(), MBMesquite::EdgeLengthQualityMetric::evaluate_with_indices(), MBMesquite::LocalSizeQualityMetric::evaluate_with_indices(), MBMesquite::EdgeLengthRangeQualityMetric::evaluate_with_indices(), MBMesquite::AffineMapMetric::evaluate_with_indices(), MBMesquite::EdgeQM::evaluate_with_indices(), ConstantElementMetric::evaluate_with_indices(), OFTestQM::evaluate_with_indices(), DistTestMetric::evaluate_with_indices(), MBMesquite::QualityMetric::fixed_vertex_bitmap(), MBMesquite::EdgeQM::get_edge_evaluations(), MBMesquite::ElementQM::get_element_evaluations(), get_free_vertex_coordinates(), MBMesquite::ConjugateGradient::get_step(), get_subpatch(), MBMesquite::VertexQM::get_vertex_evaluations(), MBMesquite::MsqHessian::initialize(), MBMesquite::NonGradient::initialize_mesh_iteration(), MBMesquite::MappingFunction2D::jacobian(), MBMesquite::MappingFunction3D::jacobian(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), move_free_vertices_constrained(), MBMesquite::MsqFreeVertexIndexIterator::next(), num_fixed_vertices(), MBMesquite::SmartLaplacianSmoother::optimize_vertex_positions(), UnOptimizer::optimize_vertex_positions(), MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::LaplacianSmoother::optimize_vertex_positions(), MBMesquite::ConjugateGradient::optimize_vertex_positions(), MBMesquite::SteepestDescent::optimize_vertex_positions(), MBMesquite::FeasibleNewton::optimize_vertex_positions(), MBMesquite::NonSmoothDescent::optimize_vertex_positions(), MBMesquite::NonGradient::optimize_vertex_positions(), MBMesquite::NonGradient::printPatch(), project_gradient(), recreate_vertices_memento(), MBMesquite::TerminationCriterion::reset_inner(), set_all_vertices_soft_fixed(), set_free_vertices_constrained(), set_free_vertices_soft_fixed(), set_to_vertices_memento(), tag_patch_slaved(), TerminationCriterionTest::test_absolute_vertex_movement_edge_length(), ObjectiveFunctionTest::test_compute_ana_hessian_tet(), ObjectiveFunctionTest::test_compute_ana_hessian_tet_scaled(), VtkTest::test_elements(), PatchDataTest::test_fixed_by_geom_dim(), QualityMetricTest::test_fixed_vertex_list(), QualityMetricTester::test_get_edge_indices(), QualityMetricTester::test_get_element_indices(), QualityMetricTester::test_get_indices_fixed(), QualityMetricTester::test_get_sample_indices(), QualityMetricTester::test_get_vertex_indices(), TerminationCriterionTest::test_gradient_common(), CompositeOFTest::test_multiply_hess_diagonal(), PatchDataTest::test_patch_contents(), PatchDataTest::test_quad8_patch(), PatchDataTest::test_sub_patch(), TerminationCriterionTest::test_vertex_bound(), TerminationCriterionTest::test_vertex_movement_common(), update_slave_node_coordinates(), and MBMesquite::MeshWriter::write_vtk().

    {
        return numFreeVertices;
    }

number of vertices in the patch.

Definition at line 209 of file PatchData.hpp.

References vertexArray.

Referenced by check_global_patch_slaved(), PatchDataTest::check_higher_order_vertices_slaved(), PatchDataTest::check_sub_patch(), MBMesquite::TerminationCriterion::cull_vertices_global(), MBMesquite::EdgeIterator::EdgeIterator(), NumericalTestOF::evaluate(), generate_vertex_to_element_data(), get_adjacent_vertex_indices(), MBMesquite::EdgeQM::get_edge_evaluations(), TMPQualityMetricTest< AWQualityMetric >::get_nonideal_element(), MBMesquite::VertexQM::get_vertex_evaluations(), MBMesquite::NonSmoothDescent::init_max_step_length(), MBMesquite::EdgeIterator::is_at_end(), MBMesquite::EdgeIterator::mid(), MBMesquite::move_vertex(), TestExtraData::notify_sub_patch(), num_fixed_vertices(), MBMesquite::operator<<(), MBMesquite::NonSmoothDescent::optimize_vertex_positions(), TCTFauxOptimizer::optimize_vertex_positions(), MBMesquite::NonGradient::printPatch(), randomize_vertex(), reorder(), set_all_vertices_soft_free(), set_free_vertices_constrained(), MBMesquite::EdgeIterator::step(), MsqMeshEntityTest::test_check_element_orientation(), QualityMetricTester::test_domain_deviation_quality(), VtkTest::test_elements(), TMPQualityMetricTest< QMType >::test_evaluate_2D(), TMPQualityMetricTest< QMType >::test_evaluate_3D(), TMPQualityMetricTest< QMType >::test_evaluate_surface(), ExtraDataTest::test_notify_subpatch(), PatchDataTest::test_patch_contents(), PatchDataTest::test_quad8_patch(), TerminationCriterionTest::test_vertex_bound(), MBMesquite::MeshWriter::Transform2D::Transform2D(), update_cached_normals(), MBMesquite::MeshWriter::write_vtk(), PatchTranslate::xform(), PatchScale::xform(), and PatchRotate::xform().

    {
        return vertexArray.size();
    }
PatchData& MBMesquite::PatchData::operator= ( const PatchData pd) [private]

Doesn't allow a PatchData object to be assigned to another. Mementos such as PatchDataVerticesMemento should be used when necessary.

void MBMesquite::PatchData::project_gradient ( std::vector< Vector3D > &  gradient,
MsqError err 
)

Project gradient vector terms onto geometric domain.

Definition at line 426 of file PatchData.cpp.

References domain_set(), element_by_index(), MBMesquite::MeshDomain::element_normal_at(), elementHandlesArray, get_domain(), get_vertex_element_adjacencies(), MBMesquite::MsqError::INVALID_ARG, MSQ_ERRRTN, MSQ_SETERR, normalData, num_free_vertices(), MBMesquite::project_to_plane(), update_cached_normals(), vertexArray, vertexDomainDOF, and vertexNormalIndices.

Referenced by MBMesquite::SteepestDescent::optimize_vertex_positions().

{
    if( !domain_set() ) return;

    if( gradient.size() != num_free_vertices() )
    {
        MSQ_SETERR( err )( MsqError::INVALID_ARG );
        return;
    }

    if( normalData.empty() )
    {
        update_cached_normals( err );MSQ_ERRRTN( err );
    }

    Vector3D norm;
    for( size_t i = 0; i < num_free_vertices(); ++i )
    {
        if( vertexNormalIndices.empty() )
        {  // whole mesh on single 2D domain
            norm = normalData[i];
            project_to_plane( gradient[i], norm );
        }
        else if( vertexDomainDOF[i] == 2 )
        {  // vertex on surface
            norm = normalData[vertexNormalIndices[i]];
            project_to_plane( gradient[i], norm );
        }
        else if( vertexDomainDOF[i] == 1 )
        {
            size_t j, num_elem;
            const size_t* elems = get_vertex_element_adjacencies( i, num_elem, err );MSQ_ERRRTN( err );
            for( j = 0; j < num_elem; ++j )
            {
                if( 2 == TopologyInfo::dimension( element_by_index( elems[j] ).get_element_type() ) )
                {
                    norm = vertexArray[i];
                    get_domain()->element_normal_at( elementHandlesArray[elems[j]], norm );
                    project_to_plane( gradient[i], norm );
                }
            }
        }
    }
}

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

This function reuses an existing PatchDataVerticesMemento object. The PatchDataVerticesMemento contains the current state of the PatchData coordinates. It can be used to restore the same PatchData object to those coordinates.

It is the responsibility of the caller to delete the PatchDataVerticesMemento when it is no longer needed.

Definition at line 936 of file PatchData.hpp.

References normalData, MBMesquite::PatchDataVerticesMemento::normalData, num_free_vertices(), num_slave_vertices(), MBMesquite::PatchDataVerticesMemento::originator, vertexArray, vertexNormalIndices, and MBMesquite::PatchDataVerticesMemento::vertices.

Referenced by MBMesquite::TerminationCriterion::accumulate_patch(), create_vertices_memento(), MBMesquite::ConjugateGradient::get_step(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::SteepestDescent::optimize_vertex_positions(), MBMesquite::FeasibleNewton::optimize_vertex_positions(), MBMesquite::TerminationCriterion::reset_inner(), and MBMesquite::TerminationCriterion::reset_patch().

{
    memento->originator = this;

    size_t num_vtx = num_free_vertices() + num_slave_vertices();

    memento->vertices.resize( num_vtx );
    std::copy( vertexArray.begin(), vertexArray.begin() + num_vtx, memento->vertices.begin() );

    int num_normal;
    if( normalData.empty() )
        num_normal = 0;
    else if( vertexNormalIndices.empty() )
        num_normal = num_vtx;
    else
    {
        num_normal = num_vtx;
        while( num_normal != 0 && vertexNormalIndices[--num_normal] >= normalData.size() )
            ;
        if( num_normal == 0 )
        {
            if( vertexNormalIndices[0] < normalData.size() ) num_normal = vertexNormalIndices[0] + 1;
        }
        else
            num_normal = vertexNormalIndices[num_normal] + 1;
    }

    memento->normalData.resize( num_normal );
    std::copy( normalData.begin(), normalData.begin() + num_normal, memento->normalData.begin() );
}

Remove an ExtraData object from this PatchData.

Definition at line 1977 of file PatchData.cpp.

References dataList, MBMesquite::ExtraData::patchNext, and MBMesquite::ExtraData::patchPtr.

Referenced by MBMesquite::ExtraData::~ExtraData().

{
    if( data->patchPtr != this ) return false;

    if( dataList == data )
    {
        dataList        = data->patchNext;
        data->patchNext = 0;
        data->patchPtr  = 0;
        return true;
    }

    for( ExtraData* iter = dataList; iter; iter = iter->patchNext )
        if( iter->patchNext == data )
        {
            iter->patchNext = data->patchNext;
            data->patchNext = 0;
            data->patchPtr  = 0;
            return true;
        }

    return false;
}

Reorders the mesh data.

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

Definition at line 173 of file PatchData.cpp.

References dist(), elementArray, elementHandlesArray, generate_vertex_to_element_data(), normalData, notify_new_patch(), num_elements(), num_nodes(), numFreeVertices, numSlaveVertices, vertAdjacencyArray, vertAdjacencyOffsets, vertexArray, vertexHandlesArray, and vertexNormalIndices.

Referenced by MBMesquite::FeasibleNewton::initialize_mesh_iteration(), PatchDataTest::test_patch_contents(), and PatchDataTest::test_quad8_patch().

{
    size_t i, j;
    const size_t num_vertex = num_nodes();
    const size_t num_elem   = num_elements();

    // Step 1: Clear any cached data that will be invalidated by this
    vertexNormalIndices.clear();
    normalData.clear();
    // vertexDomainDOF.clear();

    // Step 2: Make sure we have vertex-to-element adjacencies
    if( !vertAdjacencyArray.size() ) generate_vertex_to_element_data();

    // Step 3: Do breadth-first search
    std::vector< bool > visited( num_vertex, false );
    std::vector< size_t > vertex_order( num_vertex );
    std::vector< size_t >::iterator q1_beg, q1_end, q2_end;
    q1_beg = q1_end = q2_end = vertex_order.begin();
    // Outer loop will be done once for each disconnected chunk of mesh.
    while( q1_beg != vertex_order.end() )
    {
        // Find vertex furthest from the origin
        double max     = -1.0;
        size_t vtx_idx = num_vertex;
        for( i = 0; i < num_vertex; ++i )
            if( !visited[i] )
            {
                double dist = vertexArray[i].length_squared();
                if( dist > max )
                {
                    max     = dist;
                    vtx_idx = i;
                }
            }
        assert( vtx_idx < num_vertex );

        *q2_end++ = vtx_idx;
        ;
        visited[vtx_idx] = true;
        do
        {
            q1_end = q2_end;
            for( ; q1_beg != q1_end; ++q1_beg )
            {
                size_t vtx_adj_offset = vertAdjacencyOffsets[*q1_beg];
                size_t vtx_adj_end    = vertAdjacencyOffsets[*q1_beg + 1];
                for( i = vtx_adj_offset; i < vtx_adj_end; ++i )
                {
                    size_t elem = vertAdjacencyArray[i];
                    assert( elem < elementArray.size() );
                    size_t num_elem_verts = elementArray[elem].node_count();
                    size_t* elem_verts    = elementArray[elem].get_vertex_index_array();
                    for( j = 0; j < num_elem_verts; ++j )
                    {
                        size_t elem_vert = elem_verts[j];
                        if( !visited[elem_vert] )
                        {
                            *q2_end++ = elem_vert;
                            ;
                            visited[elem_vert] = true;
                        }
                    }
                }
            }
        } while( q2_end != q1_end );
    }

    // Step 4: vertex_order contains the list of current vertex indices
    //         in the opposite of the order that they will occur in the
    //         reorderd patch.  The following code will construct veretx_map
    //         from vertex_order with the following properties
    //         - vertex_map will be indexed by the current vertex index and
    //           contain the new index of that vertex (inverse of vertex_order)
    //         - the vertices will be grouped by their free/slave/fixed flag.
    std::vector< size_t > vertex_map( num_vertex );
    const size_t fixed_vtx_offset = numFreeVertices + numSlaveVertices;
    size_t free_idx = 0, slave_idx = numFreeVertices, fixed_idx = fixed_vtx_offset;
    for( i = 1; i <= num_vertex; ++i )
    {
        size_t vtx_idx = vertex_order[num_vertex - i];
        if( vtx_idx < numFreeVertices )
            vertex_map[vtx_idx] = free_idx++;
        else if( vtx_idx < fixed_vtx_offset )
            vertex_map[vtx_idx] = slave_idx++;
        else
            vertex_map[vtx_idx] = fixed_idx++;
    }
    // make sure everything adds up
    assert( free_idx == numFreeVertices );
    assert( slave_idx == fixed_vtx_offset );
    assert( fixed_idx == num_vertex );

    // Step 5: compute element permutation
    // initialize all to "num_elem" to indicate unvisited
    std::vector< size_t > element_map( num_elem, num_elem );
    size_t elem_idx = 0;
    for( i = 1; i <= num_vertex; ++i )
    {
        size_t vtx_idx        = vertex_order[num_vertex - i];
        size_t vtx_adj_offset = vertAdjacencyOffsets[vtx_idx];
        size_t vtx_adj_end    = vertAdjacencyOffsets[vtx_idx + 1];
        for( j = vtx_adj_offset; j < vtx_adj_end; ++j )
        {
            size_t elem = vertAdjacencyArray[j];
            if( element_map[elem] == num_elem ) element_map[elem] = elem_idx++;
        }
    }
    // make sure everything adds up
    assert( elem_idx == num_elem );

    // Step 6:  Permute the vertices
    std::vector< MsqVertex > new_vertex_array( num_vertex );
    std::vector< Mesh::VertexHandle > new_vtx_handle_array( num_vertex );
    for( i = 0; i < num_vertex; ++i )
    {
        size_t new_idx                = vertex_map[i];
        new_vertex_array[new_idx]     = vertexArray[i];
        new_vtx_handle_array[new_idx] = vertexHandlesArray[i];
    }
    vertexArray.swap( new_vertex_array );
    vertexHandlesArray.swap( new_vtx_handle_array );

    // Step 7: Permute the elements and vertex indices for the elements
    std::vector< MsqMeshEntity > new_elem_array( num_elem );
    std::vector< Mesh::ElementHandle > new_elem_handle_array( num_elem );
    for( i = 0; i < num_elem; ++i )
    {
        assert( i < elementArray.size() );
        size_t vert_count  = elementArray[i].node_count();
        size_t* conn_array = elementArray[i].get_vertex_index_array();
        for( j = 0; j < vert_count; ++j )
        {
            conn_array[j] = vertex_map[conn_array[j]];
        }

        size_t new_idx = element_map[i];
        assert( new_idx < num_elem );
        new_elem_array[new_idx]        = elementArray[i];
        new_elem_handle_array[new_idx] = elementHandlesArray[i];
    }
    elementArray.swap( new_elem_array );
    elementHandlesArray.swap( new_elem_handle_array );

    // Step 8: Clear no-longer-valid vertex-to-element adjacency info.
    if( vertAdjacencyOffsets.size() )
    {
        vertAdjacencyOffsets.clear();
        vertAdjacencyArray.clear();
        generate_vertex_to_element_data();
    }

    notify_new_patch();
}

Add a soft_fixed flag to all vertices in the patch.

Definition at line 493 of file PatchData.cpp.

References num_free_vertices(), and vertexArray.

{
    for( size_t i = 0; i < num_free_vertices(); ++i )
        vertexArray[i].set_soft_fixed_flag();
}

Remove the soft_fixed flag from all vertices in the patch.

Definition at line 511 of file PatchData.cpp.

References num_nodes(), and vertexArray.

Referenced by MBMesquite::TerminationCriterion::cull_vertices().

{
    for( size_t i = 0; i < num_nodes(); ++i )
        vertexArray[i].remove_soft_fixed_flag();
}

Definition at line 1346 of file PatchData.cpp.

References myDomain, normalData, notify_patch_destroyed(), and vertexNormalIndices.

Referenced by MBMesquite::TerminationCriterion::accumulate_outer(), MBMesquite::create_ideal_element_patch(), MBMesquite::create_one_tri_patch(), MBMesquite::create_qm_two_quad_patch_with_domain(), MBMesquite::create_qm_two_tri_patch_with_domain(), MBMesquite::create_six_quads_patch_with_domain(), MBMesquite::create_two_tri_patch(), MBMesquite::TerminationCriterion::cull_vertices_global(), MBMesquite::destroy_patch_with_domain(), QualityMetricTester::get_ideal_element(), QualityMetricTester::get_ideal_quads(), QualityMetricTester::get_ideal_tris(), MBMesquite::PatchPowerMeanP::initialize_block_coordinate_descent(), MBMesquite::TargetWriter::loop_over_mesh(), MBMesquite::VertexMover::loop_over_mesh(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), MBMesquite::TerminationCriterion::reset_outer(), MBMesquite::ShapeImprover::run_wrapper(), QualityAssessorTest::test_basic_stats_sample(), PatchDataTest::test_fixed_by_geom_dim(), TMPQualityMetricTest< QMType >::test_gradient_common(), PatchTranslate::xform(), PatchScale::xform(), and PatchRotate::xform().

{
    myDomain = d;

    // clear all cached data from the previous domain
    vertexNormalIndices.clear();
    normalData.clear();
    // vertexDomainDOF.clear();

    // observers should treat this the same as if the
    // instance of this object wzs being deleted.
    notify_patch_destroyed();
}
void MBMesquite::PatchData::set_free_vertices_constrained ( PatchDataVerticesMemento memento,
Vector3D  dk[],
size_t  nb_vtx,
double  step_size,
MsqError err 
)

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

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

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

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

Definition at line 385 of file PatchData.cpp.

References MBMesquite::MsqError::INVALID_ARG, MBMesquite::length_squared(), MSQ_CHKERR, MSQ_DBG, MSQ_DBGOUT, MSQ_ERRRTN, MSQ_SETERR, num_free_vertices(), num_nodes(), numSlaveVertices, MBMesquite::PatchDataVerticesMemento::originator, snap_vertex_to_domain(), update_slave_node_coordinates(), vertexArray, and MBMesquite::PatchDataVerticesMemento::vertices.

Referenced by MBMesquite::ConjugateGradient::get_step(), UnOptimizer::optimize_vertex_positions(), and MBMesquite::QuasiNewton::optimize_vertex_positions().

{
    if( memento->originator != this || nb_vtx != num_free_vertices() )
    {
        MSQ_SETERR( err )( MsqError::INVALID_ARG );
        return;
    }

    size_t i;
    for( i = 0; i < num_free_vertices(); ++i )
    {
        vertexArray[i] = memento->vertices[i] + ( step_size * dk[i] );
        snap_vertex_to_domain( i, err );MSQ_ERRRTN( err );
    }

    if( numSlaveVertices )
    {
        update_slave_node_coordinates( err );MSQ_CHKERR( err );
    }

    // Checks that moving direction is zero for fixed vertices.
    if( MSQ_DBG( 3 ) )
    {
        for( i = 0; i < num_nodes(); ++i )
        {
            if( dk[i].length_squared() != 0.0 )
            {
                MSQ_DBGOUT( 3 ) << "dk[" << i << "]: " << dk[i] << endl;
                MSQ_DBGOUT( 3 ) << "moving a fixed vertex." << endl;
            }
        }
    }
}

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

Definition at line 501 of file PatchData.cpp.

References num_free_vertices(), and vertexArray.

Referenced by MBMesquite::TerminationCriterion::cull_vertices().

{
    for( size_t i = 0; i < num_free_vertices(); ++i )
    {
        if( vertexArray[i].is_free_vertex() ) vertexArray[i].set_soft_fixed_flag();
    }
}
void MBMesquite::PatchData::set_mesh_entities ( std::vector< Mesh::ElementHandle > &  patch_elems,
std::vector< Mesh::VertexHandle > &  free_vertices,
MsqError err 
)

Definition at line 1795 of file PatchData.cpp.

References MBMesquite::arrptr(), byteArray, clear(), elemConnectivityArray, elementArray, elementHandlesArray, MBMesquite::Mesh::elements_get_attached_vertices(), MBMesquite::Mesh::elements_get_topologies(), get_mesh(), initialize_data(), MBMesquite::MsqError::INVALID_STATE, make_handles_unique(), MBMesquite::MsqVertex::MSQ_DEPENDENT, MSQ_ERRRTN, MBMesquite::MsqVertex::MSQ_PATCH_FIXED, MSQ_SETERR, offsetArray, vertexArray, vertexHandlesArray, MBMesquite::Mesh::vertices_get_byte(), and MBMesquite::Mesh::vertices_get_coordinates().

Referenced by PatchDataTest::check_higher_order_vertices_slaved(), MBMesquite::TerminationCriterion::cull_vertices_global(), MBMesquite::PatchIterator::get_next_patch(), MBMesquite::TargetWriter::loop_over_mesh(), MBMesquite::VertexMover::loop_over_mesh(), MBMesquite::QualityAssessor::loop_over_mesh_internal(), MBMesquite::ShapeImprover::run_wrapper(), QualityAssessorTest::test_basic_stats_sample(), PatchDataTest::test_fixed_by_geom_dim(), and MBMesquite::MeshWriter::write_gnuplot().

{
    Mesh* current_mesh = get_mesh();
    if( !current_mesh )
    {
        MSQ_SETERR( err )( "No Mesh associated with PatchData.", MsqError::INVALID_STATE );
        return;
    }

    if( elements.empty() )
    {
        clear();
        return;
    }

    elementHandlesArray = elements;
    get_mesh()->elements_get_attached_vertices( arrptr( elementHandlesArray ), elementHandlesArray.size(),
                                                vertexHandlesArray, offsetArray, err );MSQ_ERRRTN( err );

    // Construct CSR-rep element connectivity data
    size_t num_vert = vertexHandlesArray.size();
    elemConnectivityArray.resize( num_vert );
    make_handles_unique( arrptr( vertexHandlesArray ), num_vert, arrptr( elemConnectivityArray ) );
    vertexHandlesArray.resize( num_vert );

    // Get element topologies
    std::vector< EntityTopology > elem_topologies( elementHandlesArray.size() );
    get_mesh()->elements_get_topologies( arrptr( elementHandlesArray ), arrptr( elem_topologies ),
                                         elementHandlesArray.size(), err );MSQ_ERRRTN( err );

    // get vertex bits from mesh
    byteArray.resize( vertexHandlesArray.size() );
    get_mesh()->vertices_get_byte( arrptr( vertexHandlesArray ), arrptr( byteArray ), vertexHandlesArray.size(), err );MSQ_ERRRTN( err );

    // if free_vertices is not empty, then we need to mark as
    // fixed any vertices *not* in that list.
    if( free_vertices.size() == 1 )
    {
        for( size_t i = 0; i < vertexHandlesArray.size(); ++i )
            if( vertexHandlesArray[i] == free_vertices.front() )
                byteArray[i] &= ~MsqVertex::MSQ_PATCH_FIXED;
            else
                byteArray[i] |= MsqVertex::MSQ_PATCH_FIXED;
    }
    else if( !free_vertices.empty() )
    {
        // sort and remove duplicates from free_vertices list.
        std::sort( free_vertices.begin(), free_vertices.end() );
        free_vertices.erase( std::unique( free_vertices.begin(), free_vertices.end() ), free_vertices.end() );

        for( size_t i = 0; i < vertexHandlesArray.size(); ++i )
        {
            if( ( byteArray[i] & MsqVertex::MSQ_DEPENDENT ) ||
                std::binary_search( free_vertices.begin(), free_vertices.end(), vertexHandlesArray[i] ) )
                byteArray[i] &= ~MsqVertex::MSQ_PATCH_FIXED;
            else
                byteArray[i] |= MsqVertex::MSQ_PATCH_FIXED;
        }
    }

    // set element types
    elementArray.resize( elementHandlesArray.size() );
    for( size_t i = 0; i < elementHandlesArray.size(); ++i )
        elementArray[i].set_element_type( elem_topologies[i] );

    // get element connectivity, group vertices by free/slave/fixed state
    initialize_data( arrptr( offsetArray ), arrptr( byteArray ), err );MSQ_ERRRTN( err );

    // get vertex coordinates
    vertexArray.resize( vertexHandlesArray.size() );
    get_mesh()->vertices_get_coordinates( arrptr( vertexHandlesArray ), arrptr( vertexArray ),
                                          vertexHandlesArray.size(), err );MSQ_ERRRTN( err );

    // set vertex flags
    for( size_t i = 0; i < vertexArray.size(); ++i )
        vertexArray[i].flags() = byteArray[i];
}

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

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

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

Definition at line 974 of file PatchData.hpp.

References MBMesquite::MsqError::INVALID_ARG, MBMesquite::MsqError::INVALID_STATE, MSQ_SETERR, normalData, MBMesquite::PatchDataVerticesMemento::normalData, num_free_vertices(), num_slave_vertices(), MBMesquite::PatchDataVerticesMemento::originator, vertexArray, and MBMesquite::PatchDataVerticesMemento::vertices.

Referenced by MBMesquite::ConjugateGradient::get_step(), UnOptimizer::optimize_vertex_positions(), MBMesquite::TrustRegion::optimize_vertex_positions(), MBMesquite::QuasiNewton::optimize_vertex_positions(), MBMesquite::SteepestDescent::optimize_vertex_positions(), and MBMesquite::FeasibleNewton::optimize_vertex_positions().

{
    if( memento->originator != this )
    {
        MSQ_SETERR( err )
        ( "Memento may only be used to restore the PatchData "
          "object from which it was created.",
          MsqError::INVALID_ARG );
        return;
    }

    if( memento->vertices.size() != num_free_vertices() + num_slave_vertices() )
    {
        MSQ_SETERR( err )
        ( "Unable to restore patch coordinates.  Number of "
          "vertices in PatchData has changed.",
          MsqError::INVALID_STATE );
        return;
    }

    // copies the memento array into the PatchData array.
    std::copy( memento->vertices.begin(), memento->vertices.end(), vertexArray.begin() );
    std::copy( memento->normalData.begin(), memento->normalData.end(), normalData.begin() );
}
void MBMesquite::PatchData::set_vertex_coordinates ( const Vector3D coords,
size_t  index,
MsqError err 
) [inline]

set the coordinates of the index-th vertex in the raw array

Definition at line 828 of file PatchData.hpp.

References get_vertex_element_adjacencies(), MBMesquite::MsqError::INVALID_ARG, MSQ_ERRRTN, MSQ_SETERR, numSlaveVertices, update_slave_node_coordinates(), and vertexArray.

Referenced by ObjectiveFunctionTests::compare_numerical_hessian(), MBMesquite::NonSmoothDescent::compute_gradient(), MBMesquite::NonGradient::evaluate(), MBMesquite::QualityMetric::evaluate_with_gradient(), MBMesquite::QualityMetric::evaluate_with_Hessian(), QualityMetricTester::get_degenerate_element(), MBMesquite::ObjectiveFunction::get_eps(), QualityMetricTester::get_inverted_element(), QualityMetricTester::get_nonideal_element(), QualityMetricTester::get_zero_element(), MBMesquite::SmartLaplacianSmoother::optimize_vertex_positions(), MBMesquite::LaplacianSmoother::optimize_vertex_positions(), MBMesquite::NonGradient::optimize_vertex_positions(), MBMesquite::NonSmoothDescent::step_acceptance(), MsqMeshEntityTest::test_check_element_orientation(), QualityMetricTester::test_domain_deviation_quality(), TMPQualityMetricTest< QMType >::test_evaluate_2D(), TMPQualityMetricTest< QMType >::test_evaluate_3D(), TMPQualityMetricTest< QMType >::test_evaluate_surface(), QualityMetricTester::test_gradient_reflects_quality(), QualityMetricTester::test_measures_quality(), TerminationCriterionTest::test_untangled_mesh(), TerminationCriterionTest::test_vertex_bound(), PatchScale::xform(), and PatchRotate::xform().

{
    if( index >= vertexArray.size() )
    {
        MSQ_SETERR( err )( "Index bigger than numVertices.", MsqError::INVALID_ARG );
        return;
    }

    vertexArray[index] = coords;

    if( numSlaveVertices )
    {
        size_t num_elem;
        const size_t* indices;
        indices = get_vertex_element_adjacencies( index, num_elem, err );MSQ_ERRRTN( err );
        update_slave_node_coordinates( indices, num_elem, err );MSQ_ERRRTN( err );
    }
}
MESQUITE_EXPORT void MBMesquite::PatchData::set_vertex_culled ( size_t  vtx_index) [inline]

Mark vertex as culled (soft fixed)

Definition at line 489 of file PatchData.hpp.

References MBMesquite::MsqVertex::MSQ_CULLED, and vertexArray.

Referenced by MBMesquite::TerminationCriterion::cull_vertices_global().

    {
        vertexArray[vtx_index].flags() |= MsqVertex::MSQ_CULLED;
    }

Definition at line 81 of file PatchData.hpp.

References mSettings.

    {
        return mSettings;
    }
void MBMesquite::PatchData::snap_vertex_to_domain ( size_t  vertex_index,
MsqError err 
)

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

Adjust the position of the specified vertex so that it lies on its constraining domain. The actual domain constraint is managed by the TSTT mesh implementation

Definition at line 1125 of file PatchData.cpp.

References MBMesquite::MeshDomain::closest_point(), domain_set(), get_domain(), MSQ_ERRRTN, normalData, MBMesquite::MeshDomain::snap_to(), vertexArray, vertexHandlesArray, and vertexNormalIndices.

Referenced by MBMesquite::NonGradient::evaluate(), move_free_vertices_constrained(), MBMesquite::SmartLaplacianSmoother::optimize_vertex_positions(), MBMesquite::LaplacianSmoother::optimize_vertex_positions(), MBMesquite::Randomize::optimize_vertex_positions(), MBMesquite::NonGradient::optimize_vertex_positions(), set_free_vertices_constrained(), and update_slave_node_coordinates().

{
    if( domain_set() )
    {
        // if not doing normal caching or vertex is not on a single surface
        if( normalData.empty() )
        {
            get_domain()->snap_to( vertexHandlesArray[vertex_index], vertexArray[vertex_index] );
        }
        // entire domain is 2-D (all vertices have a single normal)
        else if( vertexNormalIndices.empty() )
        {
            get_domain()->closest_point( vertexHandlesArray[vertex_index], Vector3D( vertexArray[vertex_index] ),
                                         vertexArray[vertex_index], normalData[vertex_index], err );MSQ_ERRRTN( err );
        }
        else if( vertexNormalIndices[vertex_index] < normalData.size() )
        {  // vertex has a unique normal
            get_domain()->closest_point( vertexHandlesArray[vertex_index], Vector3D( vertexArray[vertex_index] ),
                                         vertexArray[vertex_index], normalData[vertexNormalIndices[vertex_index]],
                                         err );MSQ_ERRRTN( err );
        }
        else
        {  // vertex has multiple normals
            get_domain()->snap_to( vertexHandlesArray[vertex_index], vertexArray[vertex_index] );
        }
    }
}

Definition at line 1153 of file PatchData.cpp.

References MBMesquite::arrptr(), MBMesquite::MeshDomain::domain_DoF(), get_domain(), MBMesquite::MsqError::INVALID_STATE, MSQ_ERRRTN, MSQ_SETERR, n, normalData, num_nodes(), MBMesquite::MeshDomain::vertex_normal_at(), vertexArray, vertexDomainDOF, vertexHandlesArray, and vertexNormalIndices.

Referenced by get_domain_normal_at_vertex(), get_domain_normals_at_corners(), and project_gradient().

{
    size_t i;

    MeshDomain* domain = get_domain();
    if( !domain )
    {
        MSQ_SETERR( err )( "No domain constraint set.", MsqError::INVALID_STATE );
        return;
    }

    // Determine which vertices lie on surfaces
    vertexDomainDOF.resize( num_nodes() );
    domain->domain_DoF( arrptr( vertexHandlesArray ), arrptr( vertexDomainDOF ), num_nodes(), err );MSQ_ERRRTN( err );

    // Count how many vertices have a single normal
    // Sun doesn't support partial template specialization, so can't use std::count
    // size_t n = std::count( vertexDomainDOF.begin(), vertexDomainDOF.end(), 2 );
    size_t n = 0;
    std::vector< unsigned short >::iterator k;
    for( k = vertexDomainDOF.begin(); k != vertexDomainDOF.end(); ++k )
        if( *k == 2 ) ++n;

    normalData.resize( n );

    // If all vertices are on a surface, pass in the existing handles array
    // and store a single normal per vertex.
    if( n == num_nodes() )
    {
        std::copy( vertexArray.begin(), vertexArray.end(), normalData.begin() );
        domain->vertex_normal_at( arrptr( vertexHandlesArray ), arrptr( normalData ), num_nodes(), err );
        vertexNormalIndices.clear();
        vertexDomainDOF.clear();MSQ_ERRRTN( err );
    }
    else
    {
        vertexNormalIndices.resize( num_nodes() );
        size_t nn = 0;
        for( i = 0; i < num_nodes(); ++i )
        {
            if( vertexDomainDOF[i] == 2 )
            {
                normalData[nn] = vertexArray[i];
                domain->vertex_normal_at( vertexHandlesArray[i], normalData[nn] );
                vertexNormalIndices[i] = nn;
                ++nn;
            }
            else
            {
                vertexNormalIndices[i] = n + 1;
            }
        }
        assert( nn == n );
    }
}
void MBMesquite::PatchData::update_mesh ( MsqError err,
const TagHandle tag = 0 
)

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

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

Parameters:
tagIf non-null, store vertex coords in tag rather than updating the coords in the mesh database. Used for Jacobi optimizations.

Definition at line 752 of file PatchData.cpp.

References INTERNAL_ERROR, MSQ_ERRRTN, MSQ_SETERR, myMesh, numFreeVertices, numSlaveVertices, MBMesquite::Mesh::tag_set_vertex_data(), MBMesquite::Mesh::vertex_set_byte(), MBMesquite::Mesh::vertex_set_coordinates(), vertexArray, and vertexHandlesArray.

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

{
    if( !myMesh )
    {
        MSQ_SETERR( err )( "Cannot update mesh on temporary patch.\n", MsqError::INTERNAL_ERROR );
        return;
    }

    const size_t not_fixed = numFreeVertices + numSlaveVertices;
    if( tag )
    {
        for( size_t i = 0; i < not_fixed; ++i )
        {
            myMesh->tag_set_vertex_data( *tag, 1, &vertexHandlesArray[i], vertexArray[i].to_array(), err );MSQ_ERRRTN( err );
        }
    }
    else
    {
        for( size_t i = 0; i < not_fixed; ++i )
        {
            myMesh->vertex_set_coordinates( vertexHandlesArray[i], vertexArray[i], err );MSQ_ERRRTN( err );
        }
    }

    for( size_t i = 0; i < vertexArray.size(); ++i )
    {
        myMesh->vertex_set_byte( vertexHandlesArray[i], vertexArray[i].get_flags(), err );MSQ_ERRRTN( err );
    }
}

Calculate new location for all slave higher-order nodes using mapping function. Called by update_mesh().

Definition at line 782 of file PatchData.cpp.

References MBMesquite::MappingFunction::coefficients(), conn, MBMesquite::MappingFunction::convert_connectivity_indices(), domain_set(), element_by_index(), MBMesquite::MsqVertex::flags(), MBMesquite::MsqMeshEntity::get_element_type(), get_mapping_function(), get_vertex_handles_array(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqError::INVALID_MESH, MBMesquite::MsqVertex::is_flag_set(), is_vertex_slave(), MSQ_ERRRTN, MBMesquite::MsqVertex::MSQ_MARK, MSQ_SETERR, MBMesquite::MsqMeshEntity::node_count(), non_slave_node_set(), num_elements(), num_free_vertices(), num_slave_vertices(), snap_vertex_to_domain(), vertex_by_index(), MBMesquite::MsqMeshEntity::vertex_count(), and vertexArray.

Referenced by move_free_vertices_constrained(), move_vertex(), set_free_vertices_constrained(), set_vertex_coordinates(), and PatchDataTest::test_update_slave_node_coords().

{
    // update slave vertices
    if( 0 == num_slave_vertices() ) return;

    // Set a mark on every slave vertex.  We'll clear the marks as we
    // set the vertex coordinates.  This way we can check that all
    // vertices got updated.
    const size_t vert_end = num_free_vertices() + num_slave_vertices();
    for( size_t i = num_free_vertices(); i < vert_end; ++i )
        vertexArray[i].flags() |= MsqVertex::MSQ_MARK;

    // For each element, calculate slave vertex coordinates from
    // mapping function.
    const int ARR_SIZE = 27;
    double coeff[ARR_SIZE];
    size_t index[ARR_SIZE];
    for( size_t i = 0; i < num_elements(); ++i )
    {
        MsqMeshEntity& elem  = element_by_index( i );
        const int num_corner = elem.vertex_count();
        const int num_node   = elem.node_count();
        assert( num_node < ARR_SIZE );

        const EntityTopology type       = elem.get_element_type();
        const MappingFunction* const mf = get_mapping_function( type );
        if( 0 == mf || num_node == num_corner ) continue;

        const size_t* conn = elem.get_vertex_index_array();

        // for each higher-order non-slave node, set bit indicating
        // that mapping function is a function of the non-slave node
        // coordinates
        NodeSet ho_bits = non_slave_node_set( i );

        // for each higher-order slave node
        for( int k = num_corner; k < num_node; ++k )
        {
            if( !is_vertex_slave( conn[k] ) ) continue;

            // check if we already did this one for an adjacent element
            MsqVertex& vert = vertexArray[conn[k]];
            if( !vert.is_flag_set( MsqVertex::MSQ_MARK ) ) continue;

            // what is this node a mid node of (i.e. face 1, edge 2, etc.)
            Sample loc = TopologyInfo::sample_from_node( type, elem.node_count(), k, err );MSQ_ERRRTN( err );

            // evaluate mapping function at logical loction of HO node.
            size_t num_coeff;
            mf->coefficients( loc, ho_bits, coeff, index, num_coeff, err );MSQ_ERRRTN( err );
            mf->convert_connectivity_indices( num_node, index, num_coeff, err );MSQ_ERRRTN( err );

            // calulate new coordinates for slave node
            assert( num_coeff > 0 );
            vert = coeff[0] * vertex_by_index( conn[index[0]] );
            for( size_t j = 1; j < num_coeff; ++j )
                vert += coeff[j] * vertex_by_index( conn[index[j]] );

            // clear mark
            vert.flags() &= ~MsqVertex::MSQ_MARK;
        }
    }

    // make sure we set the coordinates for every slave node
    for( size_t i = num_free_vertices(); i < vert_end; ++i )
    {
        if( vertex_by_index( i ).is_flag_set( MsqVertex::MSQ_MARK ) )
        {
            MSQ_SETERR( err )
            ( MsqError::INVALID_MESH, "No element with mapping function adjacent to slave vertex %lu (%lu)\n",
              (unsigned long)i, (unsigned long)get_vertex_handles_array()[i] );
            // make sure we finish with all marks cleared
            vertexArray[i].flags() &= ~MsqVertex::MSQ_MARK;
        }
    }

    // snap vertices to domain
    if( domain_set() )
    {
        for( size_t i = num_free_vertices(); i < vert_end; ++i )
        {
            snap_vertex_to_domain( i, err );MSQ_ERRRTN( err );
        }
    }
}
void MBMesquite::PatchData::update_slave_node_coordinates ( const size_t *  elem_indices,
size_t  num_elem,
MsqError err 
)

Definition at line 868 of file PatchData.cpp.

References MBMesquite::MappingFunction::coefficients(), conn, MBMesquite::MappingFunction::convert_connectivity_indices(), domain_set(), element_by_index(), MBMesquite::MsqVertex::flags(), MBMesquite::MsqMeshEntity::get_element_type(), get_mapping_function(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MBMesquite::MsqVertex::is_flag_set(), is_vertex_slave(), MSQ_ERRRTN, MBMesquite::MsqVertex::MSQ_MARK, MBMesquite::MsqMeshEntity::node_count(), non_slave_node_set(), num_slave_vertices(), snap_vertex_to_domain(), vertex_by_index(), MBMesquite::MsqMeshEntity::vertex_count(), and vertexArray.

{
    // update slave vertices
    if( 0 == num_slave_vertices() ) return;

    // set a mark on each vertex so we don't update shared
    // vertices more than once.
    for( size_t i = 0; i < num_elems; ++i )
    {
        MsqMeshEntity& elem  = element_by_index( elements[i] );
        const int num_corner = elem.vertex_count();
        const int num_node   = elem.node_count();
        const size_t* conn   = elem.get_vertex_index_array();
        for( int j = num_corner; j < num_node; ++j )
            vertexArray[conn[j]].flags() |= MsqVertex::MSQ_MARK;
    }

    // For each element, calculate slave vertex coordinates from
    // mapping function.
    const int ARR_SIZE = 27;
    double coeff[ARR_SIZE];
    size_t index[ARR_SIZE];
    for( size_t i = 0; i < num_elems; ++i )
    {
        MsqMeshEntity& elem  = element_by_index( elements[i] );
        const int num_corner = elem.vertex_count();
        const int num_node   = elem.node_count();
        assert( num_node < ARR_SIZE );

        const EntityTopology type       = elem.get_element_type();
        const MappingFunction* const mf = get_mapping_function( type );
        if( 0 == mf || num_node == num_corner ) continue;

        const size_t* conn = elem.get_vertex_index_array();

        // for each higher-order non-slave node, set bit indicating
        // that mapping function is a function of the non-slave node
        // coordinates
        NodeSet ho_bits = non_slave_node_set( i );

        // for each higher-order slave node
        for( int k = num_corner; k < num_node; ++k )
        {
            if( !is_vertex_slave( conn[k] ) ) continue;

            // check if we already did this one for an adjacent element
            MsqVertex& vert = vertexArray[conn[k]];
            if( !vert.is_flag_set( MsqVertex::MSQ_MARK ) ) continue;

            // what is this node a mid node of (i.e. face 1, edge 2, etc.)
            Sample loc = TopologyInfo::sample_from_node( type, elem.node_count(), k, err );MSQ_ERRRTN( err );

            // evaluate mapping function at logical loction of HO node.
            size_t num_coeff;
            mf->coefficients( loc, ho_bits, coeff, index, num_coeff, err );MSQ_ERRRTN( err );
            mf->convert_connectivity_indices( num_node, index, num_coeff, err );MSQ_ERRRTN( err );

            // calulate new coordinates for slave node
            assert( num_coeff > 0 );
            vert = coeff[0] * vertex_by_index( conn[index[0]] );
            for( size_t j = 1; j < num_coeff; ++j )
                vert += coeff[j] * vertex_by_index( conn[index[j]] );

            // snap vertices to domain
            if( domain_set() )
            {
                snap_vertex_to_domain( conn[k], err );MSQ_ERRRTN( err );
            }

            // clear mark
            vert.flags() &= ~MsqVertex::MSQ_MARK;
        }
    }
}
const MsqVertex & MBMesquite::PatchData::vertex_by_index ( size_t  index) const [inline]

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

Definition at line 872 of file PatchData.hpp.

References vertexArray.

Referenced by PatchDataTest::check_higher_order_vertices_slaved(), PatchDataTest::check_sub_patch(), ObjectiveFunctionTests::compare_numerical_hessian(), MBMesquite::MsqMeshEntity::compute_corner_normals(), MBMesquite::NonSmoothDescent::compute_gradient(), MBMesquite::EdgeIterator::end(), MBMesquite::EdgeLengthMetric::evaluate(), MBMesquite::AffineMapMetric::evaluate(), NumericalTestOF::evaluate(), MBMesquite::NonGradient::evaluate(), LinearVertexMetric::evaluate(), ParabolicVertexMetric::evaluate(), DistTestMetric::evaluate(), MBMesquite::EdgeLengthMetric::evaluate_with_gradient(), MBMesquite::QualityMetric::evaluate_with_gradient(), MBMesquite::QualityMetric::evaluate_with_Hessian(), LinearVertexMetric::evaluate_with_indices(), ParabolicVertexMetric::evaluate_with_indices(), DistTestMetric::evaluate_with_indices(), MBMesquite::get_delta_C(), get_domain_normal_at_mid_edge(), MBMesquite::EdgeQM::get_edge_evaluations(), MBMesquite::ObjectiveFunction::get_eps(), get_minmax_edge_length(), TMPQualityMetricTest< AWQualityMetric >::get_nonideal_element(), get_sample_location(), MBMesquite::VertexQM::get_vertex_evaluations(), MBMesquite::MappingFunction2D::jacobian(), MBMesquite::MappingFunction3D::jacobian(), TriTauMetric::matrix(), MBMesquite::EdgeIterator::mid(), MBMesquite::MsqFreeVertexIndexIterator::next(), non_slave_node_set(), UnOptimizer::optimize_vertex_positions(), MBMesquite::EdgeIterator::start(), MsqMeshEntityTest::test_check_element_orientation(), QualityMetricTester::test_domain_deviation_quality(), TMPQualityMetricTest< QMType >::test_evaluate_2D(), TMPQualityMetricTest< QMType >::test_evaluate_3D(), TMPQualityMetricTest< QMType >::test_evaluate_surface(), MappingFunctionTest::test_jacobian_2d(), MappingFunctionTest::test_jacobian_3d(), PatchDataTest::test_patch_contents(), PatchDataTest::test_quad8_patch(), TerminationCriterionTest::test_untangled_mesh(), PatchDataTest::test_update_slave_node_coords(), TerminationCriterionTest::test_vertex_bound(), update_slave_node_coordinates(), MBMesquite::MeshWriter::write_vtk(), PatchScale::xform(), and PatchRotate::xform().

{
    assert( index < vertexArray.size() );
    return vertexArray[index];
}

Friends And Related Function Documentation

friend class MBMesquite::ExtraData [friend]

Definition at line 610 of file PatchData.hpp.

std::ostream& operator<< ( std::ostream &  ,
const PatchData  
) [friend]

Display the coordinates and connectivity information.


Member Data Documentation

std::vector< bool > MBMesquite::PatchData::bitMap [mutable, private]

Definition at line 744 of file PatchData.hpp.

Referenced by get_adjacent_vertex_indices().

std::vector< unsigned char > MBMesquite::PatchData::byteArray [private]

Definition at line 743 of file PatchData.hpp.

Referenced by fill(), get_subpatch(), and set_mesh_entities().

Definition at line 755 of file PatchData.hpp.

std::vector< size_t > MBMesquite::PatchData::elemConnectivityArray [private]

Element connectivity data. The concatenation of the connectivity list of each element in PatchData::elementArray. Each element in PatchData::elementArray has a pointer into this array at the correct offset for that element's connectivity data.

Definition at line 714 of file PatchData.hpp.

Referenced by clear(), enslave_higher_order_nodes(), fill(), generate_vertex_to_element_data(), get_connectivity_array(), get_subpatch(), initialize_data(), and set_mesh_entities().

The geometric domain of the mesh [may be NULL].

Definition at line 685 of file PatchData.hpp.

Referenced by clear(), domain_set(), get_domain(), get_subpatch(), MBMesquite::operator<<(), and set_domain().

The Mesh used to fill this PatchData [may be NULL].

Definition at line 684 of file PatchData.hpp.

Referenced by clear(), get_mesh(), get_subpatch(), MBMesquite::operator<<(), set_mesh(), and update_mesh().

std::vector< Vector3D > MBMesquite::PatchData::normalData [private]

Storage space for cached domain normal data. Pointers in PatchData::vertexNormalPointers point into this list.

Definition at line 733 of file PatchData.hpp.

Referenced by clear(), get_domain_normal_at_vertex(), get_domain_normals_at_corners(), initialize_data(), project_gradient(), recreate_vertices_memento(), reorder(), set_domain(), set_to_vertices_memento(), snap_vertex_to_domain(), and update_cached_normals().

The number of vertices in PatchData::vertexArray that are free vertices. The vertex array is sorted such that free vertices are first in the array. This value is therefore the offset at which slave vertices begin in the array.

Definition at line 698 of file PatchData.hpp.

Referenced by clear(), fill(), initialize_data(), is_vertex_fixed(), is_vertex_free(), is_vertex_not_free(), is_vertex_slave(), num_free_vertices(), reorder(), and update_mesh().

The number of slave vertices in vertexArray. The vertices are ordered such that all fixed vertices occur after the slave vertices. Therefore the offset at which the fixed vertices begin is numFreeVertices+numSlaveVertices

Definition at line 703 of file PatchData.hpp.

Referenced by clear(), fill(), initialize_data(), is_vertex_fixed(), is_vertex_slave(), move_free_vertices_constrained(), move_vertex(), num_slave_vertices(), reorder(), set_free_vertices_constrained(), set_vertex_coordinates(), and update_mesh().

std::vector< size_t > MBMesquite::PatchData::offsetArray [private]

Definition at line 742 of file PatchData.hpp.

Referenced by set_mesh_entities().

std::vector< size_t > MBMesquite::PatchData::vertAdjacencyArray [private]

The concatenation of the adjacency lists of all the vertices in PatchData::vertexArray. Each value in the array is an index into PatchData::elementArray indicating that the corresponding element uses the vertex. May be empty if vertex adjacency data has not been requested.

Definition at line 720 of file PatchData.hpp.

Referenced by clear(), generate_vertex_to_element_data(), get_vertex_element_adjacencies(), initialize_data(), MBMesquite::operator<<(), and reorder().

std::vector< size_t > MBMesquite::PatchData::vertAdjacencyOffsets [private]

This array is indexed by vertex indices and specifies the offset in at which the adjacency list for the corresponding vertex begins. May be empty if vertex adjacency data has not been requested.

Definition at line 725 of file PatchData.hpp.

Referenced by clear(), generate_vertex_to_element_data(), get_vertex_element_adjacencies(), initialize_data(), MBMesquite::operator<<(), and reorder().

std::vector< unsigned short > MBMesquite::PatchData::vertexDomainDOF [private]

Storage space for cached domain DOF for vertices. IF a domain exists and PatchData::normalData is not empty, but this array is, it may be assumed that all vertices have have a DOF == 2.

Definition at line 738 of file PatchData.hpp.

Referenced by project_gradient(), and update_cached_normals().

std::vector< unsigned > MBMesquite::PatchData::vertexNormalIndices [private]

Index into normalData at which the normal for the corresponding vertex index is located. Only vertices constrained to a single domain with a topological dimension of 2 have a unique domain normal.

Definition at line 730 of file PatchData.hpp.

Referenced by clear(), get_domain_normal_at_vertex(), get_domain_normals_at_corners(), initialize_data(), project_gradient(), recreate_vertices_memento(), reorder(), set_domain(), snap_vertex_to_domain(), and update_cached_normals().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines