MOAB: Mesh Oriented datABase  (version 5.2.1)
MBMesquite::MeshDomainAssoc Class Reference

#include <MeshInterface.hpp>

+ Collaboration diagram for MBMesquite::MeshDomainAssoc:

Public Member Functions

 MeshDomainAssoc (MBMesquite::Mesh *mesh, MBMesquite::MeshDomain *domain, bool full_compatibility_check=false, bool proceed=false, bool skip_compatibility_check=false)
 Constructor.
 ~MeshDomainAssoc ()
MBMesquite::Meshget_mesh ()
 get associated mesh
MBMesquite::MeshDomainget_domain ()
 get associated domain
bool are_compatible ()

Private Attributes

MBMesquite::MeshmMesh
MBMesquite::MeshDomainmMeshDomain
bool mesh_and_domain_are_compatible

Detailed Description

The MeshDomainAssoc class provides an association of a Mesh instance with a MeshDomain instance. The mesh is checked to verify that it is compatibile with the associated MeshDomain. If the two are not compatible, the MeshDomainAssoc instace is not created.

Definition at line 439 of file MeshInterface.hpp.


Constructor & Destructor Documentation

MBMesquite::MeshDomainAssoc::MeshDomainAssoc ( MBMesquite::Mesh mesh,
MBMesquite::MeshDomain domain,
bool  full_compatibility_check = false,
bool  proceed = false,
bool  skip_compatibility_check = false 
) [inline]

Constructor.

Parameters:
meshThe mesh instance being associated param domain The domain being associated param full_compatibility_check Controls how many vertices will be checked for compatibility with the associated domain. When false, only the first vertex of the mesh is checked for compatibility. When true, all vertices of the mesh are checked. param proceed Controls what Mesquite will do if the compatibility check fails. When false, mesquite terminates i execution. When true, execution continues. param skip_compatibility_checki when true, does not perform the compatibility check. When false, the check is performed.

Definition at line 456 of file MeshInterface.hpp.

References MBMesquite::Vector3D::distance_between(), and tolerance.

        : mMesh( mesh ), mMeshDomain( domain ), mesh_and_domain_are_compatible( false )
    {
        // check for real instance.  If either value is NULL then it's just an
        // instance created to facilitate passing of just a mesh or domain
        // also, check if skipping the compatibility check was requested
        if( mesh && domain && !skip_compatibility_check )
        {
            MsqError err;
            double tolerance = 1.0e-3;

            std::vector< Mesh::VertexHandle > vert_handles;
            mMesh->get_all_vertices( vert_handles, err );

            MsqVertex mesh_vertex, domain_vertex;
            Vector3D normal;

            double distance;
            std::vector< int >::size_type i, times_to_loop;
            if( full_compatibility_check )
                times_to_loop = vert_handles.size();
            else
                times_to_loop = 1;
            mesh_and_domain_are_compatible = true;
            for( i = 0; i < times_to_loop; ++i )
            {
                mMesh->vertices_get_coordinates( &vert_handles[i], &mesh_vertex, 1, err );
                mMeshDomain->closest_point( vert_handles[i], Vector3D( mesh_vertex ), domain_vertex, normal, err );

                distance = Vector3D::distance_between( mesh_vertex, domain_vertex );
                if( distance > tolerance )
                {
                    mesh_and_domain_are_compatible = false;
                    std::cout << "Warning: Mesh and Domain are not compatibile" << std::endl;
                    if( !proceed )
                    {
                        std::cout << "Terminating due to Mesh/Domain incompatibility" << std::endl;
                        throw "Terminating due to Mesh/Domain incompatibility";
                    }
                    break;  // exits for loop when not compatbile but should not terminate
                }
            }
        }
    }

Definition at line 502 of file MeshInterface.hpp.

{};

Member Function Documentation

Definition at line 528 of file MeshInterface.hpp.


Member Data Documentation

List of all members.


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