MeshKit  1.0
CESets.hpp
Go to the documentation of this file.
00001 #ifndef MESHKIT_CD_SETS_HPP
00002 #define MESHKIT_CD_SETS_HPP
00003 
00004 #include "meshkitalgs_export.hpp"
00005 
00006 #include <set>
00007 #include <string>
00008 #include <vector>
00009 
00010 #include "meshkit/MKCore.hpp"
00011 
00012 #include <iBase.h>
00013 #include <iMesh.h>
00014 
00015 namespace MeshKit {
00016 
00017 class MESHKITALGS_EXPORT CESets
00018 {
00019 public:
00020   struct tag_data
00021   {
00022     tag_data(iMesh::TagHandle tag, char *value)
00023       : tag(tag), value(value)
00024     {}
00025 
00026     iMesh::TagHandle tag;
00027     char *value;
00028   };
00029 
00030   typedef std::vector<tag_data> tag_type;
00031   typedef std::set<iMesh::EntitySetHandle> set_type;
00032   typedef tag_type::iterator       tag_iterator;
00033   typedef tag_type::const_iterator const_tag_iterator;
00034   typedef set_type::iterator       set_iterator;
00035   typedef set_type::const_iterator const_set_iterator;
00036 
00037   CESets(MKCore *mkcore) : mesh_(mkcore->imesh_instance())
00038   {}
00039 
00040   ~CESets();
00041 
00042   iMesh * imesh_instance() const { return mesh_; }
00043 
00044   void add_set(iMesh::EntitySetHandle set)
00045   {
00046     sets_.insert(set);
00047   }
00048 
00049   template <typename T>
00050   void add_sets(T begin, T end)
00051   {
00052     sets_.insert(begin, end);
00053   }
00054 
00055   void add_tag(iMesh::TagHandle tag_handle, const char *value = NULL);
00056   void add_tag(const std::string &tag_name, const char *value = NULL);
00057   void update_tagged_sets();
00058 
00059   void clear()
00060   {
00061     sets_.clear();
00062   }
00063 
00064   tag_type & tags()             { return tags_; }
00065   const tag_type & tags() const { return tags_; }
00066   set_type & sets()             { return sets_; }
00067   const set_type & sets() const { return sets_; }
00068 
00069   tag_iterator tbegin()             { return tags_.begin(); }
00070   const_tag_iterator tbegin() const { return tags_.begin(); }
00071   tag_iterator tend()               { return tags_.end(); }
00072   const_tag_iterator tend() const   { return tags_.end(); }
00073   set_iterator sbegin()             { return sets_.begin(); }
00074   const_set_iterator sbegin() const { return sets_.begin(); }
00075   set_iterator send()               { return sets_.end(); }
00076   const_set_iterator send() const   { return sets_.end(); }
00077 
00078 private:
00079   iMesh *mesh_;
00080   tag_type tags_;
00081   set_type sets_;
00082 };
00083 
00086 void MESHKITALGS_EXPORT link_expand_sets(const CESets &ce_sets, iMesh::TagHandle local_tag);
00087 
00097 void MESHKITALGS_EXPORT process_ce_sets(iMesh *mesh,
00098                      const std::set<iMesh::EntitySetHandle> &cesets,
00099                      iMesh::TagHandle local_tag);
00100 
00113 void MESHKITALGS_EXPORT tag_copy_sets(iMesh *mesh, iMesh::TagHandle copyTag,
00114                    const std::set<iMesh::EntitySetHandle> &copySets,
00115                    iMesh::TagHandle tag, const char *tag_val);
00116 
00127 void MESHKITALGS_EXPORT tag_copy_sets(const CESets &ce_sets, iMesh::TagHandle local_tag,
00128                    iMesh::TagHandle copy_tag);
00129 
00130 } // namespace MeshKit
00131 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines