SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshFactory.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) 2009 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/MeshFactory.h
30 
31 #ifndef CORE_DATATYPES_MESHFACTORY_H
32 #define CORE_DATATYPES_MESHFACTORY_H
33 
34 #include <boost/noncopyable.hpp>
35 #include <Core/Utils/Singleton.h>
36 #include <Core/Utils/TypeIDTable.h>
39 //#include <Core/Datatypes/Mesh/Mesh.h>
42 
43 namespace SCIRun {
44 namespace Core {
45 namespace Datatypes {
46 
48  {
49  size_type x_, y_, z_;
51 
53  };
54 
57 
58  /// @todo: yucky double-singleton to separate registration from construction.
59 
60  class SCISHARE MeshFactory : boost::noncopyable
61  {
63 
64  public:
65  //MeshHandle CreateMesh(const FieldInformation& info, const MeshConstructionParameters& params);
66  //MeshHandle CreateMesh(const FieldInformation& info);
67  MeshHandle CreateMesh(const std::string& type);
68 
69  private:
70  MeshFactory();
71  MeshHandle CreateMesh(const std::string& type, const MeshConstructionParameters& params);
72  class MeshRegistry& registry_;
73  };
74 
75  class SCISHARE MeshRegistry : boost::noncopyable
76  {
78  public:
79 
81  {
82  MeshTypeID();
83  MeshTypeID(const std::string& type, MeshDefaultConstructor defCtor, MeshConstructor ctor = 0);
84 
85  std::string type_;
88 
89  bool operator==(const MeshTypeID& other) const;
90  bool operator!=(const MeshTypeID& other) const;
91 
92  friend class MeshRegistry;
93  };
94 
95  friend class MeshFactory;
96  private:
97  MeshRegistry();
99  };
100 
101 }}}
102 
103 #endif
Definition: MeshFactory.h:60
SCISHARE MeshHandle CreateMesh(const std::string &type)
Definition: Mesh.cc:421
Geometry::Point min_
Definition: MeshFactory.h:50
bool operator!=(const DenseMatrixGeneric< T > &lhs, const DenseMatrixGeneric< T > &rhs)
Definition: MatrixComparison.h:64
Definition: Point.h:49
#define SCISHARE
Definition: share.h:39
boost::shared_ptr< Mesh > MeshHandle
Definition: DatatypeFwd.h:67
Definition: MeshFactory.h:75
MeshHandle(* MeshDefaultConstructor)()
Definition: MeshFactory.h:55
Definition: ParallelLinearAlgebraTests.cc:358
A thread-safe map used for constructor lookup in Mesh/Field factories.
Definition: TypeIDTable.h:47
long long size_type
Definition: Types.h:40
#define CORE_SINGLETON(name)
Definition: Singleton.h:59
MeshConstructor ctor_
Definition: MeshFactory.h:87
MeshDefaultConstructor defCtor_
Definition: MeshFactory.h:86
std::string type_
Definition: MeshFactory.h:85
bool operator==(const DenseMatrixGeneric< T > &lhs, const DenseMatrixGeneric< T > &rhs)
Definition: MatrixComparison.h:44
MeshHandle(* MeshConstructor)(const MeshConstructionParameters &)
Definition: MeshFactory.h:56
size_type z_
Definition: MeshFactory.h:49