SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VirtualMeshFacade.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2013 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 /// @todo Documentation Core/Datatypes/Mesh/VirtualMeshFacade.h
30 
31 #ifndef CORE_DATATYPES_MESH_VIRTUALMESHFACADE_H
32 #define CORE_DATATYPES_MESH_VIRTUALMESHFACADE_H
33 
36 
37 namespace SCIRun {
38 namespace Core {
39 namespace Datatypes {
40 
41  template <class VirtualMeshType>
42  class VirtualMeshFacade : public MeshFacade<VirtualMeshType>
43  {
44  public:
46 
47  explicit VirtualMeshFacade(boost::shared_ptr<VirtualMeshType> vmesh) : vmesh_(vmesh)
48  {
49  /// @todo: necessary? interface to vmesh
50  //if (! vmesh->is_latvolmesh()
51  // && ! vmesh->is_trisurfmesh()
52  // && ! vmesh->is_tetvolmesh())
53  // THROW_INVALID_ARGUMENT("Incorrect mesh type for this facade type.");
54  }
55 
56  virtual typename my_base::Edges edges() const
57  {
58  return typename my_base::Edges(typename SmartEdgeIterator<VirtualMeshType>::Type(vmesh_.get()), typename SmartEdgeIterator<VirtualMeshType>::Type(vmesh_.get(), true));
59  }
60 
61  virtual typename my_base::Faces faces() const
62  {
63  return typename my_base::Faces(typename SmartFaceIterator<VirtualMeshType>::Type(vmesh_.get()), typename SmartFaceIterator<VirtualMeshType>::Type(vmesh_.get(), true));
64  }
65 
66  virtual typename my_base::Nodes nodes() const
67  {
68  return typename my_base::Nodes(typename SmartNodeIterator<VirtualMeshType>::Type(vmesh_.get()), typename SmartNodeIterator<VirtualMeshType>::Type(vmesh_.get(), true));
69  }
70 
71  virtual size_t numNodes() const
72  {
73  return vmesh_->num_nodes();
74  }
75 
76  virtual size_t numEdges() const
77  {
78  /// @todo: need to split out that Synchronize enum
79  vmesh_->synchronize(/*Mesh5::EDGES_E*/ 2);
80  return vmesh_->num_edges();
81  }
82 
83  virtual size_t numFaces() const
84  {
85  return vmesh_->num_faces();
86  }
87 
88  virtual size_t numElements() const
89  {
90  return vmesh_->num_elems();
91  }
92  private:
93  boost::shared_ptr<VirtualMeshType> vmesh_;
94  };
95 
96 }}}
97 
98 #endif
99 
virtual size_t numElements() const
Definition: VirtualMeshFacade.h:88
virtual size_t numNodes() const
Definition: VirtualMeshFacade.h:71
std::pair< typename SmartFaceIterator< VirtualMeshType >::Type, typename SmartFaceIterator< VirtualMeshType >::Type > Faces
Definition: MeshFacade.h:50
std::pair< typename SmartNodeIterator< VirtualMeshType >::Type, typename SmartNodeIterator< VirtualMeshType >::Type > Nodes
Definition: MeshFacade.h:48
std::pair< typename SmartEdgeIterator< VirtualMeshType >::Type, typename SmartEdgeIterator< VirtualMeshType >::Type > Edges
Definition: MeshFacade.h:49
VirtualMeshFacade(boost::shared_ptr< VirtualMeshType > vmesh)
Definition: VirtualMeshFacade.h:47
Definition: VirtualMeshFacade.h:42
virtual my_base::Nodes nodes() const
Definition: VirtualMeshFacade.h:66
virtual my_base::Faces faces() const
Definition: VirtualMeshFacade.h:61
virtual my_base::Edges edges() const
Definition: VirtualMeshFacade.h:56
Definition: MeshFacadeIterators.h:57
virtual size_t numEdges() const
Definition: VirtualMeshFacade.h:76
virtual size_t numFaces() const
Definition: VirtualMeshFacade.h:83
Definition: MeshFacade.h:42
MeshFacade< VirtualMeshType > my_base
Definition: VirtualMeshFacade.h:45