OpenWalnut  1.5.0dev
WMWriteField.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2017 OpenWalnut Community
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMWRITEFIELD_H
26 #define WMWRITEFIELD_H
27 
28 #include <string>
29 
30 #include <osg/Geode>
31 
32 #include "core/kernel/WModule.h"
33 #include "core/kernel/WModuleInputData.h"
34 #include "core/kernel/WModuleOutputData.h"
35 
36 #include "core/dataHandler/WDataSetScalar.h"
37 
38 /**
39  * Someone should add some documentation here.
40  * Probably the best person would be the module's
41  * creator, i.e. "wiebel".
42  *
43  * This is only an empty template for a new module. For
44  * an example module containing many interesting concepts
45  * and extensive documentation have a look at "src/modules/template"
46  *
47  * \ingroup modules
48  */
49 class WMWriteField: public WModule
50 {
51 public:
52  /**
53  *
54  */
55  WMWriteField();
56 
57  /**
58  *
59  */
60  virtual ~WMWriteField();
61 
62  /**
63  * Gives back the name of this module.
64  * \return the module's name.
65  */
66  virtual const std::string getName() const;
67 
68  /**
69  * Gives back a description of this module.
70  * \return description to module.
71  */
72  virtual const std::string getDescription() const;
73 
74  /**
75  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
76  * should never be initialized or modified in some other way. A simple new instance is required.
77  *
78  * \return the prototype used to create every module in OpenWalnut.
79  */
80  virtual boost::shared_ptr< WModule > factory() const;
81 
82 protected:
83  /**
84  * Entry point after loading the module. Runs in separate thread.
85  */
86  virtual void moduleMain();
87 
88  /**
89  * Initialize the connectors this module is using.
90  */
91  virtual void connectors();
92 
93  /**
94  * Initialize the properties for this module.
95  */
96  virtual void properties();
97 
98  /**
99  * Initialize requirements for this module.
100  */
101  virtual void requirements();
102 
103 
104 private:
105  /**
106  * Store the field in legacy vtk file format.
107  *
108  * \return true if successful.
109  */
110  bool saveVTKASCII() const;
111 
112  boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_field; //!< Input connector required by this module.
113  boost::shared_ptr< WCondition > m_propCondition; //!< A condition used to notify about changes in several properties.
114  WPropTrigger m_saveTriggerProp; //!< This property triggers the actual writing,
115  WPropFilename m_outputFile; //!< The field will be written to this file.
116 };
117 
118 #endif // WMWRITEFIELD_H
Someone should add some documentation here.
Definition: WMWriteField.h:50
virtual void moduleMain()
Entry point after loading the module.
boost::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
Definition: WMWriteField.h:113
virtual void connectors()
Initialize the connectors this module is using.
virtual boost::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_field
Input connector required by this module.
Definition: WMWriteField.h:112
bool saveVTKASCII() const
Store the field in legacy vtk file format.
virtual void requirements()
Initialize requirements for this module.
virtual void properties()
Initialize the properties for this module.
WPropTrigger m_saveTriggerProp
This property triggers the actual writing,.
Definition: WMWriteField.h:114
WPropFilename m_outputFile
The field will be written to this file.
Definition: WMWriteField.h:115
virtual const std::string getName() const
Gives back the name of this module.
virtual const std::string getDescription() const
Gives back a description of this module.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72