-
Notifications
You must be signed in to change notification settings - Fork 14
/
SvalinnPlugin.cpp
77 lines (59 loc) · 1.61 KB
/
SvalinnPlugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "SvalinnPlugin.hpp"
#include <sstream>
#include "CubitInterface.hpp"
#include "CubitMessageHandler.hpp"
//Not including this when you aren't building the DAGMC export means you don't need to have MakeWatertight.hpp
#ifdef BUILD_DAGMC_EXPORT
#include "export_dagmc_cmd/DAGMCExportCommand.hpp"
#endif
#ifdef BUILD_MCNP_IMPORT
#include "import_mcnp_cmd/MCNPImp.hpp"
#endif
#ifdef BUILD_IGEOM_TESTS
#include "iGeom/tests/iGeom_test.hpp"
#endif
SvalinnPlugin::SvalinnPlugin()
{
CubitMessageHandler* console = CubitInterface::get_cubit_message_handler();
if (console) {
std::ostringstream load_message;
load_message.str("");
load_message << "Loaded Svalinn plugin." << std::endl;
console->print_error(load_message.str().c_str());
}
}
SvalinnPlugin::~SvalinnPlugin()
{}
std::vector<std::string> SvalinnPlugin::get_keys()
{
std::vector<std::string> keys;
#ifdef BUILD_DAGMC_EXPORT
keys.push_back("DAGMCExportCommand");
#endif
#ifdef BUILD_IGEOM_TESTS
keys.push_back("iGeom_test");
#endif
#ifdef BUILD_MCNP_IMPORT
keys.push_back("MCNPImp");
#endif
return keys;
}
CubitCommand* SvalinnPlugin::create_command(const std::string &key)
{
// NOTE: The internals of Cubit will take owernship of the command,
// and delete it when it is time to clean up.
// Cubit will crash if included keys haven't been built.
#ifdef BUILD_DAGMC_EXPORT
if(key == "DAGMCExportCommand")
return new DAGMCExportCommand();
#endif
#ifdef BUILD_IGEOM_TESTS
if(key == "iGeom_test")
return new iGeom_test();
#endif
#ifdef BUILD_MCNP_IMPORT
if(key == "MCNPImp")
return new MCNPImp();
#endif
return NULL;
}