MeshKit  1.0
CopyMesh.hpp
Go to the documentation of this file.
00001 #ifndef MESHKIT_COPY_MESH_HPP
00002 #define MESHKIT_COPY_MESH_HPP
00003 
00004 #include <vector>
00005 #include <set>
00006 
00007 #include "meshkit/Types.hpp"
00008 #include "meshkit/Error.hpp"
00009 #include "meshkit/MeshScheme.hpp"
00010 #include "meshkit/ModelEnt.hpp"
00011 
00012 #include "CESets.hpp"
00013 #include "meshkit/LocalTag.hpp"
00014 #include "Transform.hpp"
00015 
00016 #include "meshkit/iMesh.hpp"
00017 
00018 namespace MeshKit {
00019 
00020   class MKCore;
00021 
00022 
00038   class CopyMesh : public MeshScheme
00039   {
00040   public:
00042     CopyMesh(MKCore *mkcore, const MEntVector &me_vec);
00043 
00045     virtual ~CopyMesh();
00046 
00048     static const char* name();
00049 
00054     static bool can_mesh(iBase_EntityType dim);
00055 
00062     static bool can_mesh(ModelEnt *me);
00063 
00067     static const moab::EntityType* output_types();
00068 
00072     virtual const moab::EntityType* mesh_types_arr() const;
00073 
00077     virtual bool add_modelent(ModelEnt *model_ent);
00078 
00080     virtual void setup_this();
00081 
00083     virtual void execute_this();
00084 
00085     // CopyMesh function local //////////////////
00086 
00087     /* \brief Return the copyTag used to indicate set copies
00088      */
00089     iBase_TagHandle copy_tag();
00090 
00091     void set_transform(const Copy::Transform &transform);
00092 
00093     void update_sets();
00094 
00095     /* \brief Reset the copy and expand set lists
00096      */
00097     void reset_sets();
00098 
00099     /* \brief Return reference to copy sets
00100      */
00101     CESets &copy_sets();
00102 
00103     /* \brief Return reference to expand sets
00104      */
00105     CESets &expand_sets();
00106 
00107     /* \brief Tag copied sets with indicated tag from original set
00108      */
00109     void tag_copied_sets(const char **tag_names, const char **tag_vals,
00110                          const int num_tags);
00111 
00112     /* \brief Tag copied sets with indicated tag from original set
00113      */
00114     void tag_copied_sets(iMesh::TagHandle *tags, const char **tag_vals,
00115                          const int num_tags);
00116 
00117     bool flag_process_ce_set;
00118 
00119   private:
00120     void do_copy(iMesh::EntitySetHandle set_handle);
00121 
00122     //- get the copy/expand sets based on copy/expand tags
00123     void get_copy_expand_sets(iMesh::EntitySetHandle *&copy_sets,
00124                               int &num_copy_sets,
00125                               iMesh::EntitySetHandle *&expand_sets,
00126                               int &num_expand_sets);
00127 
00128     //- get the sets tagged with the given vector of tags/values
00129     void get_tagged_sets(iMesh::EntitySetHandle from_set,
00130                          iMesh::TagHandle *tag_handles,
00131                          const char **tag_vals,
00132                          int num_tags,
00133                          iMesh::EntitySetHandle *&tagged_sets,
00134                          int &num_tagged_sets);
00135 
00136     // - get structure
00137     int getStructure(iMesh_Instance instance,
00138                      iBase_EntitySetHandle set,
00139                      std::vector<iBase_EntityHandle> &ents,
00140                      std::vector<iBase_EntityHandle> &unique_adj,
00141                      std::vector<int> &indices,
00142                      std::vector<int> &offsets);
00143 
00144     iMesh *mesh;                // mesh instance
00145     LocalTag copyTag;           // tag storing copy-to tag
00146     Copy::Transform *transform; // transform function for copy-move
00147 
00148     CESets copySets;
00149     CESets expandSets;
00150   };
00151 
00166   void connect_the_dots(iMesh *mesh, iBase_TagHandle local_tag,
00167                         const std::vector<iBase_EntityHandle> &ents,
00168                         const std::vector<int> &indices,
00169                         const std::vector<int> &offsets,
00170                         const std::vector<iBase_EntityHandle> &verts);
00171 
00172   inline const char* CopyMesh::name()
00173   {
00174     return "CopyMesh";
00175   }
00176 
00177   inline bool CopyMesh::can_mesh(iBase_EntityType)
00178   {
00179     // Given just a dimension, CopyMesh can't do anything since it doesn't know
00180     // what to copy.
00181     return false;
00182   }
00183 
00184   inline bool CopyMesh::can_mesh(ModelEnt *)
00185   {
00186     return true;
00187   }
00188 
00189   inline const moab::EntityType* CopyMesh::mesh_types_arr() const
00190   {
00191     return output_types();
00192   }
00193 
00194   inline void CopyMesh::set_transform(const Copy::Transform &trans)
00195   {
00196     delete transform;
00197     transform = trans.clone();
00198   }
00199 
00200   inline iBase_TagHandle CopyMesh::copy_tag()
00201   {
00202     return copyTag;
00203   }
00204 
00205   inline void CopyMesh::reset_sets()
00206   {
00207     copySets.clear();
00208     expandSets.clear();
00209   }
00210 
00211   inline CESets &CopyMesh::copy_sets()
00212   {
00213     return copySets;
00214   }
00215 
00216   inline CESets &CopyMesh::expand_sets()
00217   {
00218     return expandSets;
00219   }
00220 } // namespace MeshKit
00221 #endif
00222 
00223 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines