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