MOAB: Mesh Oriented datABase  (version 5.4.1)
domain.cpp File Reference
#include "MeshDomain1D.hpp"
#include "PlanarDomain.hpp"
#include "CylinderDomain.hpp"
#include "ConicDomain.hpp"
#include "SphericalDomain.hpp"
#include "DomainClassifier.hpp"
#include "MeshImpl.hpp"
#include "CLArgs.hpp"
#include "MsqError.hpp"
#include "TopologyInfo.hpp"
#include "domain.hpp"
#include <iostream>
#include <algorithm>
#include <cstdlib>
+ Include dependency graph for domain.cpp:

Go to the source code of this file.

Classes

class  SphereDomainArg
class  ConicDomainArg
class  CylinderDomainArg
class  PlanarDomainArg
class  LineDomainArg
class  CircleDomainArg
class  PointDomainArg

Functions

void add_domain_args (CLArgs &args)
MeshDomainprocess_domain_args (MeshImpl *mesh)

Variables

std::vector< MeshDomain * > domains
std::vector< int > domain_dims
SphereDomainArg sphere_arg (domains, domain_dims)
ConicDomainArg conic_arg (domains, domain_dims)
CylinderDomainArg cylinder_arg (domains, domain_dims)
PlanarDomainArg plane_arg (domains, domain_dims)
CircleDomainArg circle_arg (domains, domain_dims)
LineDomainArg line_arg (domains, domain_dims)
PointDomainArg point_arg (domains, domain_dims)
CLArgs::ToggleArg skin_mesh (false)
const char * SPHERE_VALUES [] = { "rad", "x", "y", "z" }
const char * CYLINDER_VALUES [] = { "rad", "i", "j", "k", "x", "y", "z" }
const char * CONE_VALUES [] = { "rad", "h", "i", "j", "k", "x", "y", "z" }

Function Documentation

void add_domain_args ( CLArgs args)

Definition at line 212 of file domain.cpp.

References circle_arg, CIRCLE_FLAG, CONE_FLAG, CONE_VALUES, conic_arg, cylinder_arg, CYLINDER_FLAG, CYLINDER_VALUES, CLArgs::double_list_flag(), CLArgs::limit_list_flag(), line_arg, LINE_FLAG, plane_arg, PLANE_FLAG, point_arg, POINT_FLAG, SKIN_FLAG, skin_mesh, sphere_arg, SPHERE_FLAG, SPHERE_VALUES, and CLArgs::toggle_flag().

Referenced by main().

{
    args.toggle_flag( SKIN_FLAG, "Mark boundary vertices as fixed (default if no domain specified)", &skin_mesh );
    args.double_list_flag( SPHERE_FLAG, "Spherical domain as center and radius", &sphere_arg );
    args.limit_list_flag( SPHERE_FLAG, 4, SPHERE_VALUES );
    args.limit_list_flag( SPHERE_FLAG, 1, SPHERE_VALUES );
    args.double_list_flag( PLANE_FLAG, "Planar domain as normal and point", &plane_arg );
    args.limit_list_flag( PLANE_FLAG, 3, CYLINDER_VALUES + 1 );
    args.limit_list_flag( PLANE_FLAG, 6, CYLINDER_VALUES + 1 );
    args.double_list_flag( CYLINDER_FLAG, "Cylindrical radius, axis, and point", &cylinder_arg );
    args.limit_list_flag( CYLINDER_FLAG, 4, CYLINDER_VALUES );
    args.limit_list_flag( CYLINDER_FLAG, 7, CYLINDER_VALUES );
    args.double_list_flag( CONE_FLAG, "Conic domain as base radius, height, axis, and base center", &conic_arg );
    args.limit_list_flag( CONE_FLAG, 2, CONE_VALUES );
    args.limit_list_flag( CONE_FLAG, 5, CONE_VALUES );
    args.limit_list_flag( CONE_FLAG, 8, CONE_VALUES );
    args.double_list_flag( LINE_FLAG, "Linear domain as direction and point", &line_arg );
    args.limit_list_flag( LINE_FLAG, 3, CYLINDER_VALUES + 1 );
    args.limit_list_flag( LINE_FLAG, 6, CYLINDER_VALUES + 1 );
    args.double_list_flag( CIRCLE_FLAG, "Circular domain as radius, normal, and center", &circle_arg );
    args.limit_list_flag( CIRCLE_FLAG, 4, CYLINDER_VALUES );
    args.limit_list_flag( CIRCLE_FLAG, 7, CYLINDER_VALUES );
    args.double_list_flag( POINT_FLAG, "Point domain", &point_arg );
    args.limit_list_flag( POINT_FLAG, 3, SPHERE_VALUES + 1 );
}

Definition at line 238 of file domain.cpp.

References MBMesquite::arrptr(), MBMesquite::DomainClassifier::classify_geometrically(), MBMesquite::DomainClassifier::classify_skin_geometrically(), domain_dims, domains, MBMesquite::MeshImpl::elements_get_topologies(), MBMesquite::MeshImpl::get_all_elements(), MBMesquite::MeshImpl::mark_skin_fixed(), skin_mesh, and CLArgs::ArgTemplate< T >::value().

Referenced by main().

{
    MsqPrintError err( std::cerr );
    MeshDomain* rval = 0;

    if( !domains.empty() )
    {
        int max_domain_dim = *std::max_element( domain_dims.begin(), domain_dims.end() );
        std::vector< Mesh::ElementHandle > elems;
        mesh->get_all_elements( elems, err );
        std::vector< EntityTopology > types( elems.size() );
        mesh->elements_get_topologies( arrptr( elems ), arrptr( types ), elems.size(), err );
        EntityTopology max_type = *std::max_element( types.begin(), types.end() );
        int max_elem_dim        = TopologyInfo::dimension( max_type );

        if( max_domain_dim == max_elem_dim && domains.size() == 1 )
        {
            rval = domains.front();
        }
        else
        {
            DomainClassifier* result = new DomainClassifier();
            if( max_domain_dim < max_elem_dim )
            {
                DomainClassifier::classify_skin_geometrically( *result, mesh, 1e-4, arrptr( domains ),
                                                               arrptr( domain_dims ), domains.size(), err );
            }
            else
            {
                DomainClassifier::classify_geometrically( *result, mesh, 1e-4, arrptr( domains ), arrptr( domain_dims ),
                                                          domains.size(), err );
            }
            rval = result;
        }
    }
    if( skin_mesh.value() )
    {
        mesh->mark_skin_fixed( err, false );
    }
    if( err )
    {
        std::cerr << err << std::endl;
        exit( 3 );
    }

    return rval;
}

Variable Documentation

const char* CONE_VALUES[] = { "rad", "h", "i", "j", "k", "x", "y", "z" }

Definition at line 210 of file domain.cpp.

Referenced by add_domain_args().

const char* CYLINDER_VALUES[] = { "rad", "i", "j", "k", "x", "y", "z" }

Definition at line 209 of file domain.cpp.

Referenced by add_domain_args().

std::vector< int > domain_dims

Definition at line 198 of file domain.cpp.

Referenced by process_domain_args().

const char* SPHERE_VALUES[] = { "rad", "x", "y", "z" }

Definition at line 208 of file domain.cpp.

Referenced by add_domain_args().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines