![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 /*
00002 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003 * storing and accessing finite element mesh data.
00004 *
00005 * Copyright 2004 Sandia Corporation. Under the terms of Contract
00006 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007 * retains certain rights in this software.
00008 *
00009 * This library is free software; you can redistribute it and/or
00010 * modify it under the terms of the GNU Lesser General Public
00011 * License as published by the Free Software Foundation; either
00012 * version 2.1 of the License, or (at your option) any later version.
00013 *
00014 */
00015
00016 #ifndef MOAB_REFINER_TAG_MANAGER_HPP
00017 #define MOAB_REFINER_TAG_MANAGER_HPP
00018
00019 #include "moab/Types.hpp" // for MB_DLL_EXPORT
00020
00021 #include "ProcessSet.hpp"
00022
00023 #include
00024
00025 namespace moab
00026 {
00027
00028 class Interface;
00029
00030 /**
00031 * This a class that manages which tags an edge refiner should include
00032 * on output vertices created during mesh refinement.
00033 * The
00034 *
00035 * \author David Thompson
00036 *
00037 * \date 12 June 2008
00038 */
00039 class RefinerTagManager
00040 {
00041 public:
00042 RefinerTagManager( Interface* in_mesh, Interface* out_mesh );
00043 virtual ~RefinerTagManager();
00044
00045 void reset_vertex_tags();
00046 int add_vertex_tag( Tag tag_handle );
00047 int get_vertex_tag_size() const
00048 {
00049 return this->vertex_size;
00050 }
00051 int get_number_of_vertex_tags() const
00052 {
00053 return this->input_vertex_tags.size();
00054 }
00055
00056 void reset_element_tags();
00057 int add_element_tag( Tag tag_handle );
00058 int get_element_tag_size() const
00059 {
00060 return this->element_size;
00061 }
00062 int get_number_of_element_tags() const
00063 {
00064 return this->input_element_tags.size();
00065 }
00066
00067 void create_output_tags();
00068
00069 void get_input_vertex_tag( int i, Tag& tag, int& byte_offset );
00070 void get_output_vertex_tag( int i, Tag& tag, int& byte_offset );
00071
00072 void get_input_element_tag( int i, Tag& tag, int& byte_offset );
00073 void get_output_element_tag( int i, Tag& tag, int& byte_offset );
00074
00075 Interface* get_input_mesh()
00076 {
00077 return this->input_mesh;
00078 }
00079 Interface* get_output_mesh()
00080 {
00081 return this->output_mesh;
00082 }
00083
00084 Tag input_parallel_status()
00085 {
00086 return this->tag_ipstatus;
00087 }
00088 Tag input_shared_proc()
00089 {
00090 return this->tag_ipsproc;
00091 }
00092 Tag input_shared_procs()
00093 {
00094 return this->tag_ipsprocs;
00095 }
00096
00097 int get_input_gids( int n, const EntityHandle* ents, std::vector< int >& gids );
00098 int get_output_gids( int n, const EntityHandle* ents, std::vector< int >& gids );
00099 int set_gid( EntityHandle ent, int gid );
00100 int copy_gid( EntityHandle ent_input, EntityHandle ent_output );
00101
00102 void set_sharing( EntityHandle ent_handle, ProcessSet& procs );
00103 void get_common_processes( int num,
00104 const EntityHandle* src,
00105 ProcessSet& common_shared_procs,
00106 bool on_output_mesh = true );
00107
00108 void set_element_tags_from_ent( EntityHandle ent_input );
00109 void assign_element_tags( EntityHandle ent_output );
00110
00111 void set_element_procs_from_ent( EntityHandle ent_input )
00112 {
00113 this->get_common_processes( 1, &ent_input, this->current_element_procs, false );
00114 }
00115 ProcessSet& get_element_procs()
00116 {
00117 return this->current_element_procs;
00118 }
00119 void set_element_sharing( EntityHandle ent_output )
00120 {
00121 this->set_sharing( ent_output, this->current_element_procs );
00122 }
00123
00124 protected:
00125 void create_tag_internal( Tag, int );
00126
00127 std::vector< std::pair< Tag, int > > input_vertex_tags;
00128 std::vector< std::pair< Tag, int > > output_vertex_tags;
00129 std::vector< std::pair< Tag, int > > input_element_tags;
00130 std::vector< std::pair< Tag, int > > output_element_tags;
00131 int vertex_size;
00132 int element_size;
00133 Interface* input_mesh;
00134 Interface* output_mesh;
00135 Tag tag_ipstatus; // Handle for PARALLEL_STATUS on mesh_in
00136 Tag tag_ipsprocs; // Handle for PARALLEL_SHARED_PROCS on mesh_in
00137 Tag tag_ipsproc; // Handle for PARALLEL_SHARED_PROC on mesh_in
00138 Tag tag_ipshands; // Handle for PARALLEL_SHARED_HANDLES on mesh_in
00139 Tag tag_ipshand; // Handle for PARALLEL_SHARED_HANDLE on mesh_in
00140 Tag tag_igid; // Handle for global IDs on mesh_in
00141 Tag tag_opstatus; // Handle for PARALLEL_STATUS on mesh_out
00142 Tag tag_opsprocs; // Handle for PARALLEL_SHARED_PROCS on mesh_out
00143 Tag tag_opsproc; // Handle for PARALLEL_SHARED_PROC on mesh_out
00144 Tag tag_opshands; // Handle for PARALLEL_SHARED_HANDLES on mesh_out
00145 Tag tag_opshand; // Handle for PARALLEL_SHARED_HANDLE on mesh_out
00146 Tag tag_ogid; // Handle for global IDs on mesh_out
00147 int rank;
00148 std::vector< int > shared_procs_in; // Used to hold procs sharing an input vert.
00149 std::vector< int > shared_procs_out; // Used to hold procs sharing an output entity.
00150 ProcessSet current_shared_procs; // Holds process list as it is being accumulated
00151 ProcessSet current_element_procs; // The list of processes which should share an output element.
00152 std::vector< char > element_tag_data; // Holds tag data for per-element tags
00153 };
00154
00155 } // namespace moab
00156
00157 #endif // MOAB_REFINER_TAG_MANAGER_HPP