Branch data Line data Source code
1 : :
2 : : /**\file RegisterMeshOp.hpp
3 : : * Declare \c RegisterMeshOp and requisite utility templates
4 : : */
5 : :
6 : : #ifndef MESHKIT_REGISTER_MESH_OP_HPP
7 : : #define MESHKIT_REGISTER_MESH_OP_HPP
8 : :
9 : : #include "meshkit/MeshOpProxy.hpp"
10 : : #include "meshkit/MKCore.hpp"
11 : :
12 : : namespace MeshKit {
13 : :
14 : : /**\brief Utility class for registering MeshOps with MKCore
15 : : *
16 : : * This template class provides two related functionalities:
17 : : * - It provides an implementation of MKCore::MeshOpProxy for the class
18 : : * - It handles registration with MKCore
19 : : *
20 : : * To use this class, simply declare a global variable templated
21 : : * with the type of the MeshOp to be registered.
22 : : *
23 : : *\param TYPE The MeshOp sub-class to register
24 : : */
25 : : template <class TYPE>
26 : : class RegisterMeshOp : public MeshOpProxy
27 : : {
28 : : public:
29 : :
30 : : /** \brief Register a new MeshOp factory
31 : : */
32 : 1054 : RegisterMeshOp()
33 : 1054 : { MKCore::register_meshop(this); }
34 : :
35 : : /**\brief Implementation of factory method */
36 : 135 : MeshOp* create( MKCore* core, const MEntVector& vec )
37 [ + - ][ + - ]: 135 : { TYPE *t = new TYPE(core, vec); t->set_name(name()); return t;}
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ # # ][ # # ]
[ # # ][ # # ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
38 : :
39 : : /**\brief Call TYPE::name() to get name for class */
40 : 15966 : const char* name() const
41 : 15966 : { return TYPE::name(); }
42 : :
43 : : /**\brief Call TYPE::output_types
44 : : *
45 : : * Returns an array of \c MOAB::EntityType values, terminated
46 : : * by a value of \c MOAB::MBMAXTYPE .
47 : : */
48 : 1095 : const moab::EntityType* output_types() const
49 : 1095 : { return TYPE::output_types(); }
50 : :
51 : : /**\brief Call TYPE::can_mesh(iBase_EntityType)
52 : : *
53 : : * Ask if the class is capable of meshing an entity of the
54 : : * specified dimension.
55 : : */
56 : 4324 : bool can_mesh( iBase_EntityType dimension ) const
57 : 4324 : { return TYPE::can_mesh(dimension); }
58 : :
59 : : /**\brief Implementation of can_mesh() method for proxy of \c TYPE
60 : : *
61 : : *\return \c TYPE::can_mesh() if \c HAVE_CAN_MESH is true.
62 : : * \c default MeshOpProxy::can_mesh() value if \c HAVE_CAN_MESH is false.
63 : : */
64 : 0 : bool can_mesh( ModelEnt* entity ) const
65 : 0 : { return TYPE::can_mesh(entity); }
66 : : };
67 : :
68 : : } // namespace MeshKit
69 : :
70 : : #endif
71 : :
|