COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 
21 namespace covise
22 {
23 
24 class coSimpleModule;
25 
27 {
28 private:
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 
65 protected:
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 public:
106  coSimpleModule(int argc, char *argv[], const char *desc = NULL, bool propagate = false);
107 
108  // are we currently handling multiblock data?
110  {
111  return multiblock_flag;
112  }
113 
114  // are we currently handling timestep data?
115  bool isTimestep()
116  {
117  return (timestep_flag != 0);
118  }
119 
122  {
123  return (object_level > 0);
124  }
125 
127  void setInteraction(const char *string)
128  {
129  strcpy(INTattribute, string);
130  cover_interaction_flag = 1;
131  }
132 
134  void setComputeTimesteps(const int v)
135  {
136  compute_timesteps = v;
137  return;
138  };
139 
141  void setComputeMultiblock(const int v)
142  {
143  compute_multiblock = v;
144  return;
145  };
146 
148  void copyAttributes(coDistributedObject *tgt, const coDistributedObject *src) const;
149 
151  void setCopyAttributes(const int v)
152  {
153  copy_attributes_flag = v;
154  return;
155  };
156 
159  void setCopyNonSetAttributes(const int v)
160  {
161  copy_attributes_non_set_flag = v;
162  return;
163  };
164 };
165 }
166 #endif // __CO_SIMPLE_MODULE
virtual void setIterator(coInputPort **, int)
Definition: coSimpleModule.h:81
std::vector< int > num_elements
Definition: coSimpleModule.h:63
GLenum src
Definition: khronos-glext.h:7031
Definition: coOutputPort.h:26
int cover_interaction_flag
Definition: coSimpleModule.h:48
Definition: coModule.h:47
int compute_timesteps
Definition: coSimpleModule.h:29
coOutputPort ** originalOutPorts
Definition: coSimpleModule.h:38
int copy_attributes_flag
Definition: coSimpleModule.h:32
int multiblock_flag
Definition: coSimpleModule.h:54
int copy_attributes_non_set_flag
Definition: coSimpleModule.h:35
#define NULL
Definition: covise_list.h:22
Data input Port.
Definition: coInputPort.h:27
const GLdouble * v
Definition: khronos-glext.h:6442
void setComputeTimesteps(const int v)
set this if you need to handle timesteps yourself (default=0)
Definition: coSimpleModule.h:134
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
void setComputeMultiblock(const int v)
set this if you need to handle multiblock yourself (default=0)
Definition: coSimpleModule.h:141
int isPartOfMultiblock()
Definition: coSimpleModule.h:109
int compute_multiblock
Definition: coSimpleModule.h:30
virtual void postHandleObjects(coOutputPort **)
Definition: coSimpleModule.h:91
bool isTimestep()
Definition: coSimpleModule.h:115
bool timestep_flag
Definition: coSimpleModule.h:57
void setCopyAttributes(const int v)
set if you dont want to keep track of attributes yourself (default=1)
Definition: coSimpleModule.h:151
coInputPort ** originalInPorts
Definition: coSimpleModule.h:37
int numOutPorts
Definition: coSimpleModule.h:39
virtual int compute(const char *port)
called for every EXEC callback: Overload it with your own compute routine
Definition: coSimpleModule.h:84
Definition: coSimpleModule.h:26
#define APIEXPORT
Definition: coExport.h:251
int isPartOfSet()
whether object is part of a set or not
Definition: coSimpleModule.h:121
void setCopyNonSetAttributes(const int v)
Definition: coSimpleModule.h:159
void setInteraction(const char *string)
set this if you want to add an FEEDBACK attribute string to the highest set level ...
Definition: coSimpleModule.h:127
Definition: coDistributedObject.h:294
int object_level
Definition: coSimpleModule.h:51
virtual void preHandleObjects(coInputPort **)
Definition: coSimpleModule.h:78
std::vector< int > element_counter
Definition: coSimpleModule.h:60
GLint level
Definition: khronos-glext.h:6344