COVISE Core
coSimpleModule.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8//
9// coSimpleModule --- by Lars Frenzel
10//
11// 09/22/1999 - started working
12// 11/18/1999 - redesigned to be api 2.0 compatible
13// 06/03/2001 - COVER interaction
14
15#if !defined(__CO_SIMPLE_MODULE)
16#define __CO_SIMPLE_MODULE
17
18#include <appl/ApplInterface.h>
19#include "coModule.h"
20
21namespace covise
22{
23
24class coSimpleModule;
25
27{
28private:
31
33
34 // sl
36
39 int numInPorts, numOutPorts;
40
41 void swapObjects(coInputPort **inPorts, coOutputPort **outPorts);
42
43 // return CONTINUE_PIPELINE or STOP_PIPELINE on error
44 int handleObjects(coInputPort **inPorts, coOutputPort **outPorts);
45
46 // COVER interaction
47 char INTattribute[300];
48 int cover_interaction_flag; // 0: turned off, 1: turned on
49
50 // information if object is part of a set
52
53 // currently within a block of multiblock data?
55
56 // currently within a timestep?
58
59 // number of current element in each currently traversed level of set hierarchy
60 std::vector<int> element_counter;
61
62 // number of elements in each currently traversed level of set hierarchy
63 std::vector<int> num_elements;
64
65protected:
66 virtual void localCompute(void *callbackData);
67
68 // sl: from which input object are the attributes of
69 // the i-th output object copied? The default
70 // assumption that it is from the i-th input object
71 // may have to be modified by many a module
72 virtual void copyAttributesToOutObj(coInputPort **, coOutputPort **, int);
73
74 // sl: Ergaenzung fuer IsoSurfaceP
75 // und vielleicht auch angebracht fuer andere Module
76
77 // called once before running across the tree
78 virtual void preHandleObjects(coInputPort **){};
79
80 // called before a level with sets is opened
81 virtual void setIterator(coInputPort **, int){};
82
83 // called for each set level : overload it
84 virtual int compute(const char *port)
85 {
86 (void)port;
87 return CONTINUE_PIPELINE;
88 }
89
90 // called once after running across the tree
91 virtual void postHandleObjects(coOutputPort **){};
92
93 int portLeader; // which input port is inspected in handleObjects
94 // when deciding whether there is anything to compute
95
96 // get current level in object hierarchy, only call from compute()
97 int getObjectLevel() const;
98
99 // get number of current set element at level, only call from compute()
100 int getElementNumber(int level = -1) const;
101
102 // get total number of set elements at level, only call from compute()
103 int getNumberOfElements(int level = -1) const;
104
105
106 // current timestep number
108
109public:
110 coSimpleModule(int argc, char *argv[], const char *desc = NULL, bool propagate = false);
111
112 // are we currently handling multiblock data?
114 {
115 return multiblock_flag;
116 }
117
118 // are we currently handling timestep data?
120 {
121 return (timestep_flag != 0);
122 }
123
126 {
127 return (object_level > 0);
128 }
129
131 void setInteraction(const char *string)
132 {
133 strcpy(INTattribute, string);
134 cover_interaction_flag = 1;
135 }
136
138 void setComputeTimesteps(const int v)
139 {
140 compute_timesteps = v;
141 return;
142 };
143
145 void setComputeMultiblock(const int v)
146 {
147 compute_multiblock = v;
148 return;
149 };
150
152 void copyAttributes(coDistributedObject *tgt, const coDistributedObject *src) const;
153
155 void setCopyAttributes(const int v)
156 {
157 copy_attributes_flag = v;
158 return;
159 };
160
164 {
165 copy_attributes_non_set_flag = v;
166 return;
167 };
168};
169}
170#endif // __CO_SIMPLE_MODULE
#define APIEXPORT
Definition: coExport.h:275
#define NULL
Definition: covise_list.h:22
GLenum src
Definition: khronos-glext.h:7031
GLint level
Definition: khronos-glext.h:6344
const GLdouble * v
Definition: khronos-glext.h:6442
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
list of all chemical elements
Definition: coConfig.h:27
Definition: coDistributedObject.h:296
Data input Port.
Definition: coInputPort.h:28
Definition: coModule.h:48
Definition: coOutputPort.h:27
Definition: coSimpleModule.h:27
int multiblock_flag
Definition: coSimpleModule.h:54
void setComputeMultiblock(const int v)
set this if you need to handle multiblock yourself (default=0)
Definition: coSimpleModule.h:145
virtual void preHandleObjects(coInputPort **)
Definition: coSimpleModule.h:78
virtual void postHandleObjects(coOutputPort **)
Definition: coSimpleModule.h:91
bool timestep_flag
Definition: coSimpleModule.h:57
virtual int compute(const char *port)
called for every EXEC callback: Overload it with your own compute routine
Definition: coSimpleModule.h:84
int numInPorts
Definition: coSimpleModule.h:39
int copy_attributes_non_set_flag
Definition: coSimpleModule.h:35
int currentTimestep
Definition: coSimpleModule.h:107
void setInteraction(const char *string)
set this if you want to add an FEEDBACK attribute string to the highest set level
Definition: coSimpleModule.h:131
int object_level
Definition: coSimpleModule.h:51
coInputPort ** originalInPorts
Definition: coSimpleModule.h:37
void setCopyNonSetAttributes(const int v)
Definition: coSimpleModule.h:163
virtual void setIterator(coInputPort **, int)
Definition: coSimpleModule.h:81
void setCopyAttributes(const int v)
set if you dont want to keep track of attributes yourself (default=1)
Definition: coSimpleModule.h:155
int isPartOfMultiblock()
Definition: coSimpleModule.h:113
void setComputeTimesteps(const int v)
set this if you need to handle timesteps yourself (default=0)
Definition: coSimpleModule.h:138
int portLeader
Definition: coSimpleModule.h:91
int isPartOfSet()
whether object is part of a set or not
Definition: coSimpleModule.h:125
int copy_attributes_flag
Definition: coSimpleModule.h:32
bool isTimestep()
Definition: coSimpleModule.h:119
coOutputPort ** originalOutPorts
Definition: coSimpleModule.h:38
int compute_timesteps
Definition: coSimpleModule.h:29
std::vector< int > element_counter
Definition: coSimpleModule.h:60
std::vector< int > num_elements
Definition: coSimpleModule.h:63
int cover_interaction_flag
Definition: coSimpleModule.h:48
int compute_multiblock
Definition: coSimpleModule.h:30