MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::MeshRefiner Class Reference

Refine a mesh using a streaming operation. More...

#include <MeshRefiner.hpp>

+ Collaboration diagram for moab::MeshRefiner:

Public Member Functions

 MeshRefiner (Interface *imesh, Interface *omesh)
 Construct a mesh refiner. The input and output mesh pointers may be identical. Existing elements will not be removed from the input mesh as they are refined, so the adjacencies for entitities may appear strange after refinement.
virtual ~MeshRefiner ()
 Destroy a mesh refiner.
bool set_entity_refiner (EntityRefiner *)
 Specify which techniqe will be used to refine entities in the mesh. The entity refiner object you specify is ``owned'' by the mesh refiner after this call; the entity refiner will be deleted when this mesh refiner is destroyed. You should not delete the entity refiner yourself.
EntityRefinerget_entity_refiner ()
bool set_comm (ParallelComm *c)
ParallelCommget_comm ()
RefinerTagManagerget_tag_manager ()
const RefinerTagManagerget_tag_manager () const
void reset_vertex_tags ()
 A convenience method to reset the list of tags to be copied to output vertices. This simply calls the method of the same name on the tag manager.
int add_vertex_tag (Tag tag_handle)
 A convenience method to add a tag to be copied/interpolated from input vertices to output vertices. This simply calls the method of the same name on the tag manager.
virtual bool refine (Range &)
 Refine entities in a mesh set. This will recursively descend any mesh sets contained in the range. It returns false when not able to refine (because no entity refiner is set or no edge size evaluator has been set on the entity refiner) and true otherwise.

Protected Attributes

Interfacemesh_in
Interfacemesh_out
EntityRefinerentity_refiner
RefinerTagManagertag_manager
MeshOutputFunctoroutput_functor
ParallelCommcomm

Detailed Description

Refine a mesh using a streaming operation.

This is an class that contains the method used for mesh refinement.

Author:
Philippe Pebay
David Thompson
Date:
19 November 2007

Definition at line 44 of file MeshRefiner.hpp.


Constructor & Destructor Documentation

Construct a mesh refiner. The input and output mesh pointers may be identical. Existing elements will not be removed from the input mesh as they are refined, so the adjacencies for entitities may appear strange after refinement.

Definition at line 25 of file MeshRefiner.cpp.

References comm, entity_refiner, moab::ParallelComm::get_pcomm(), mesh_in, mesh_out, output_functor, and tag_manager.

{
    this->mesh_in        = imesh;
    this->mesh_out       = omesh;
    this->tag_manager    = new RefinerTagManager( this->mesh_in, this->mesh_out );
    this->output_functor = new MeshOutputFunctor( this->tag_manager );
    this->entity_refiner = 0;
    this->comm           = ParallelComm::get_pcomm( this->mesh_out, 0 );
}

Destroy a mesh refiner.

Note that any EntityRefiner object associated with the mesh refiner will be deleted inside this destructor. Destruction is virtual so subclasses may clean up after refinement.

Definition at line 40 of file MeshRefiner.cpp.

References entity_refiner, output_functor, and tag_manager.

{
    delete this->tag_manager;
    delete this->output_functor;
    if( this->entity_refiner ) delete this->entity_refiner;
}

Member Function Documentation

A convenience method to add a tag to be copied/interpolated from input vertices to output vertices. This simply calls the method of the same name on the tag manager.

Definition at line 71 of file MeshRefiner.cpp.

References moab::RefinerTagManager::add_vertex_tag(), and tag_manager.

{
    return this->tag_manager->add_vertex_tag( tag_handle );
}

Definition at line 62 of file MeshRefiner.hpp.

References comm.

    {
        return this->comm;
    }

Definition at line 51 of file MeshRefiner.hpp.

References entity_refiner.

    {
        return this->entity_refiner;
    }

Definition at line 67 of file MeshRefiner.hpp.

References tag_manager.

    {
        return this->tag_manager;
    }

Definition at line 71 of file MeshRefiner.hpp.

References tag_manager.

    {
        return this->tag_manager;
    }
bool moab::MeshRefiner::refine ( Range range) [virtual]

Refine entities in a mesh set. This will recursively descend any mesh sets contained in the range. It returns false when not able to refine (because no entity refiner is set or no edge size evaluator has been set on the entity refiner) and true otherwise.

Definition at line 88 of file MeshRefiner.cpp.

References moab::RefinerTagManager::assign_element_tags(), moab::MeshOutputFunctor::assign_global_ids(), moab::Range::begin(), comm, moab::RefinerTagManager::copy_gid(), moab::Interface::create_meshset(), moab::RefinerTagManager::create_output_tags(), moab::MeshOutputFunctor::destination_set, moab::MeshRefinerIterator::destination_set, moab::Range::end(), entity_refiner, moab::Interface::get_entities_by_handle(), moab::Interface::get_meshset_options(), MB_SUCCESS, MBENTITYSET, mesh_in, mesh_out, output_functor, moab::EntityRefiner::prepare(), moab::EntityRefiner::refine_entity(), moab::RefinerTagManager::set_element_procs_from_ent(), moab::RefinerTagManager::set_element_tags_from_ent(), moab::MeshRefinerIterator::subset, tag_manager, and moab::Interface::type_from_handle().

Referenced by TestMeshRefiner().

{
    this->tag_manager->create_output_tags();
    if( !this->entity_refiner->prepare( this->tag_manager, this->output_functor ) )
    {  // Oops, perhaps the edge_size_evaluator was not set?
        return false;
    }

    MeshRefinerIterator entry;
    std::vector< MeshRefinerIterator > work;

    entry.subset          = range;
    entry.destination_set = 0;
    work.push_back( entry );

    while( !work.empty() )
    {
        entry = work.back();
        work.pop_back();
        this->output_functor->destination_set = entry.destination_set;
        for( Range::const_iterator it = entry.subset.begin(); it != entry.subset.end(); ++it )
        {
            EntityType etyp = this->mesh_in->type_from_handle( *it );
            if( etyp == MBENTITYSET )
            {
                Range set_ents;
                if( this->mesh_in->get_entities_by_handle( *it, set_ents, false ) == MB_SUCCESS )
                {
                    // Create a matching set on the output mesh.
                    MeshRefinerIterator set_work;
                    unsigned int set_work_opts;
                    this->mesh_in->get_meshset_options( *it, set_work_opts );
                    this->mesh_out->create_meshset( set_work_opts, set_work.destination_set );
                    set_work.subset = set_ents;
                    work.push_back( set_work );
                    // Copy any per-element tag values the user has requested to the output set.
                    this->tag_manager->set_element_tags_from_ent( *it );
                    this->tag_manager->assign_element_tags( set_work.destination_set );
                    // Copy the global ID to the new set (assuming it exists).
                    this->tag_manager->copy_gid( *it, set_work.destination_set );
                }
            }
            else
            {
                this->tag_manager->set_element_tags_from_ent( *it );
                this->tag_manager->set_element_procs_from_ent( *it );
                this->entity_refiner->refine_entity( etyp, *it );
            }
        }
    }
    this->output_functor->assign_global_ids( this->comm );

    return true;
}

A convenience method to reset the list of tags to be copied to output vertices. This simply calls the method of the same name on the tag manager.

Definition at line 63 of file MeshRefiner.cpp.

References moab::RefinerTagManager::reset_vertex_tags(), and tag_manager.

bool moab::MeshRefiner::set_comm ( ParallelComm c) [inline]

Definition at line 56 of file MeshRefiner.hpp.

References comm.

    {
        if( !c || this->comm == c ) return false;
        this->comm = c;
        return true;
    }

Specify which techniqe will be used to refine entities in the mesh. The entity refiner object you specify is ``owned'' by the mesh refiner after this call; the entity refiner will be deleted when this mesh refiner is destroyed. You should not delete the entity refiner yourself.

Definition at line 52 of file MeshRefiner.cpp.

References entity_refiner.

Referenced by TestMeshRefiner().

{
    if( !er || er == this->entity_refiner ) return false;

    this->entity_refiner = er;
    return true;
}

Member Data Documentation

Definition at line 86 of file MeshRefiner.hpp.

Referenced by get_comm(), MeshRefiner(), refine(), and set_comm().

Definition at line 81 of file MeshRefiner.hpp.

Referenced by MeshRefiner(), and refine().

Definition at line 82 of file MeshRefiner.hpp.

Referenced by MeshRefiner(), and refine().

Definition at line 85 of file MeshRefiner.hpp.

Referenced by MeshRefiner(), refine(), and ~MeshRefiner().

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