43 #include "OpenVolumeMeshProperty.hh" 44 #include "PropertyHandles.hh" 45 #include "ForwardDeclarations.hh" 60 template <
class PropT,
class HandleT>
friend class PropertyPtr;
96 template <
typename PropIterator,
typename Handle>
97 void swap_property_elements(PropIterator _begin, PropIterator _end, Handle _h1, Handle _h2)
99 PropIterator p_iter = _begin;
100 for (; p_iter != _end; ++p_iter)
101 (*p_iter)->swap_elements(_h1.idx(), _h2.idx());
107 void clear_vertex_props() { clearVec(vertex_props_); }
109 void clear_edge_props() { clearVec(edge_props_); }
111 void clear_halfedge_props() { clearVec(halfedge_props_); }
113 void clear_face_props() { clearVec(face_props_); }
115 void clear_halfface_props() { clearVec(halfface_props_); }
117 void clear_cell_props() { clearVec(cell_props_); }
119 void clear_mesh_props() { clearVec(mesh_props_); }
124 virtual size_t n_edges()
const = 0;
128 virtual size_t n_faces()
const = 0;
132 virtual size_t n_cells()
const = 0;
134 template<
class T>
VertexPropertyT<T> request_vertex_property(
const std::string& _name = std::string(),
const T _def = T());
136 template<
class T>
EdgePropertyT<T> request_edge_property(
const std::string& _name = std::string(),
const T _def = T());
138 template<
class T>
HalfEdgePropertyT<T> request_halfedge_property(
const std::string& _name = std::string(),
const T _def = T());
140 template<
class T>
FacePropertyT<T> request_face_property(
const std::string& _name = std::string(),
const T _def = T());
142 template<
class T>
HalfFacePropertyT<T> request_halfface_property(
const std::string& _name = std::string(),
const T _def = T());
144 template<
class T>
CellPropertyT<T> request_cell_property(
const std::string& _name = std::string(),
const T _def = T());
146 template<
class T>
MeshPropertyT<T> request_mesh_property(
const std::string& _name = std::string(),
const T _def = T());
166 size_t n_vertex_props()
const {
return vertex_props_.size(); }
168 size_t n_edge_props()
const {
return edge_props_.size(); }
170 size_t n_halfedge_props()
const {
return halfedge_props_.size(); }
172 size_t n_face_props()
const {
return face_props_.size(); }
174 size_t n_halfface_props()
const {
return halfface_props_.size(); }
176 size_t n_cell_props()
const {
return cell_props_.size(); }
178 size_t n_mesh_props()
const {
return mesh_props_.size(); }
182 template<
class T>
void set_persistent(
EdgePropertyT<T>& _prop,
bool _flag =
true);
186 template<
class T>
void set_persistent(
FacePropertyT<T>& _prop,
bool _flag =
true);
190 template<
class T>
void set_persistent(
CellPropertyT<T>& _prop,
bool _flag =
true);
192 template<
class T>
void set_persistent(
MeshPropertyT<T>& _prop,
bool _flag =
true);
194 typedef std::vector<BaseProperty*> Properties;
196 Properties::const_iterator vertex_props_begin()
const {
return vertex_props_.begin(); }
198 Properties::const_iterator vertex_props_end()
const {
return vertex_props_.end(); }
200 Properties::const_iterator edge_props_begin()
const {
return edge_props_.begin(); }
202 Properties::const_iterator edge_props_end()
const {
return edge_props_.end(); }
204 Properties::const_iterator halfedge_props_begin()
const {
return halfedge_props_.begin(); }
206 Properties::const_iterator halfedge_props_end()
const {
return halfedge_props_.end(); }
208 Properties::const_iterator face_props_begin()
const {
return face_props_.begin(); }
210 Properties::const_iterator face_props_end()
const {
return face_props_.end(); }
212 Properties::const_iterator halfface_props_begin()
const {
return halfface_props_.begin(); }
214 Properties::const_iterator halfface_props_end()
const {
return halfface_props_.end(); }
216 Properties::const_iterator cell_props_begin()
const {
return cell_props_.begin(); }
218 Properties::const_iterator cell_props_end()
const {
return cell_props_.end(); }
220 Properties::const_iterator mesh_props_begin()
const {
return mesh_props_.begin(); }
222 Properties::const_iterator mesh_props_end()
const {
return mesh_props_.end(); }
226 template <
class FullPropT,
class PropIterT>
227 bool property_exists(
const PropIterT& _begin,
const PropIterT& _end,
const std::string& _name)
const {
231 std::cerr <<
"property_exists(): Checking for the existence of anonymous properties is" << std::endl;
232 std::cerr <<
"ambiguous!" << std::endl;
237 PropIterT it = _begin;
238 for(; it != _end; ++it)
240 if((*it)->name() == _name )
242 #if OVM_FORCE_STATIC_CAST 245 if(dynamic_cast<FullPropT*>(*it) != NULL)
257 template <
class PropT>
258 bool vertex_property_exists(
const std::string& _name)
const {
259 return property_exists<VertexPropertyT<PropT> >(vertex_props_begin(), vertex_props_end(), _name);
262 template <
class PropT>
263 bool edge_property_exists(
const std::string& _name)
const {
264 return property_exists<EdgePropertyT<PropT> >(edge_props_begin(), edge_props_end(), _name);
267 template <
class PropT>
268 bool halfedge_property_exists(
const std::string& _name)
const {
269 return property_exists<HalfEdgePropertyT<PropT> >(halfedge_props_begin(), halfedge_props_end(), _name);
272 template <
class PropT>
273 bool face_property_exists(
const std::string& _name)
const {
274 return property_exists<FacePropertyT<PropT> >(face_props_begin(), face_props_end(), _name);
277 template <
class PropT>
278 bool halfface_property_exists(
const std::string& _name)
const {
279 return property_exists<HalfFacePropertyT<PropT> >(halfface_props_begin(), halfface_props_end(), _name);
282 template <
class PropT>
283 bool cell_property_exists(
const std::string& _name)
const {
284 return property_exists<CellPropertyT<PropT> >(cell_props_begin(), cell_props_end(), _name);
287 template <
class PropT>
288 bool mesh_property_exists(
const std::string& _name)
const {
289 return property_exists<MeshPropertyT<PropT> >(mesh_props_begin(), mesh_props_end(), _name);
294 void delete_multiple_vertex_props(
const std::vector<bool>& _tags);
296 void delete_multiple_edge_props(
const std::vector<bool>& _tags);
298 void delete_multiple_face_props(
const std::vector<bool>& _tags);
300 void delete_multiple_cell_props(
const std::vector<bool>& _tags);
304 template<
class StdVecT>
305 void resize_props(StdVecT& _vec,
size_t _n);
307 template<
class StdVecT>
310 template<
class StdVecT>
311 void remove_property(StdVecT& _vec,
size_t _idx);
313 template<
class StdVecT,
class PropT,
class HandleT,
class T>
314 PropT request_property(StdVecT& _vec,
const std::string& _name,
size_t _size,
const T _def = T());
316 template<
class PropT>
317 void set_persistentT(PropT& _prop,
bool _flag);
319 template<
class StdVecT>
320 void clearVec(StdVecT& _vec);
322 Properties vertex_props_;
324 Properties edge_props_;
326 Properties halfedge_props_;
328 Properties face_props_;
330 Properties halfface_props_;
332 Properties cell_props_;
334 Properties mesh_props_;
339 #if defined(INCLUDE_TEMPLATES) && !defined(RESOURCEMANAGERT_CC) 340 #include "ResourceManagerT_impl.hh" void resize_cprops(size_t _nc)
Change size of stored cell properties.
virtual size_t n_cells() const =0
Get number of cells in mesh.
void resize_eprops(size_t _ne)
Change size of stored edge properties.
void resize_vprops(size_t _nv)
Change size of stored vertex properties.
virtual size_t n_vertices() const =0
Get number of vertices in mesh.
void resize_fprops(size_t _nf)
Change size of stored face properties.
virtual size_t n_halfedges() const =0
Get number of halfedges in mesh.
virtual size_t n_faces() const =0
Get number of faces in mesh.
virtual size_t n_edges() const =0
Get number of edges in mesh.
virtual size_t n_halffaces() const =0
Get number of halffaces in mesh.