COVISE Core
CoviseAppModule.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// basic ApplicationModule - class for COVISE
9// by Lars Frenzel
10//
11// history: 01/16/1998 started working
12// 11/18/1998 added multiprocessing support for __sgi
13//
14
15#if !defined(__COVISE_APP_MODULE_H)
16#define __COVISE_APP_MODULE_H
17
18#include <covise/covise.h>
19#include "ApplInterface.h"
20
21#if defined(__sgi)
22#include <ulocks.h>
23#endif
24
25namespace covise
26{
27
29{
30private:
31 // callbacks
32 static void computeCallback(void *, void *);
33 void nonstaticComputeCallback();
34
35 // doing all the work
36 void preHandleObjects(const coDistributedObject **obj_in);
37
38 // names of ports (NULL for none / unused)
43
44 // should we copy set-attributes or not ?
47
48 // is Multiprocessing supported by the module ?
52
53 // should we compute timesteps/multiblock
56
57protected:
58 // get a coDistributedObject by giving the port-name
59 const coDistributedObject *getUnknown(char *name, int &errflag);
60
61public:
62 // basic stuff
64 virtual ~CoviseAppModule();
65
66 // handling attributes
68 {
69 copy_attributes_flag = val;
70 return;
71 };
73 {
74 or_copy_addAttributes_flag = val;
75 return;
76 }
77 void copyAttributes(const coDistributedObject *, coDistributedObject *);
78
79 // setting the port-names
80 void setPortNames(const char **, const char **);
81
82 // setting up the callback-functions
83 void setCallbacks();
84
85 // set, if the module is multiprocessing-aware
87 {
88 multiprocessing_flag = val;
89 };
91 {
92 pre_multiprocessing_flag = val;
93 };
94
95 // set what type of data to compute
97 {
98 compute_timesteps = val;
99 return;
100 };
102 {
103 compute_multiblock = val;
104 return;
105 };
106
107 // we may require information about the current level
109 {
110 return (current_level);
111 };
112
113 // required for multiprocessing
114 void lockNewObjects();
115 void unlockNewObjects();
116#if defined(__sgi)
117 barrier_t *thisGroupsBarrier;
118 ulock_t *thisGroupsMutex;
119#endif
120
121 // virtual stuff - may be provided by programmer
122 virtual void preCompute(const coDistributedObject **){};
124 {
125 return NULL;
126 };
128
129 // doing all the work (has to be public in order for multiprocessing to work)
130 void handleObjects(const coDistributedObject **obj_in, char **obj_out_names,
131 coDistributedObject ***obj_set_out = NULL, int set_id = 0, int num_proc_wait = 1);
132};
133
134#if defined(__sgi)
135
136struct CoviseAppModuleInfo
137{
138 // SMP stuff
139 barrier_t *barrier;
140 int first, max, step;
141 int num;
142
143 // the module
144 CoviseAppModule *mod;
145
146 // and the parameters
147 coDistributedObject ***obj_in;
148 char ***obj_out_names;
149 coDistributedObject ***obj_set_out;
150};
151
152void scMultiProcCoviseAppModule(void *p, size_t qwery = 0);
153#endif
154}
155#endif // __COVISE_APP_MODULE_H
#define APPLEXPORT
Definition: coExport.h:57
#define NULL
Definition: covise_list.h:22
const GLint * first
Definition: khronos-glext.h:6529
GLuint GLfloat * val
Definition: khronos-glext.h:7898
GLfloat GLfloat p
Definition: khronos-glext.h:9861
GLuint const GLchar * name
Definition: khronos-glext.h:6722
GLuint GLuint num
Definition: khronos-glext.h:10593
int max(int a, int b)
Definition: cutil_math.h:55
list of all chemical elements
Definition: coConfig.h:27
Definition: CoviseAppModule.h:29
void setCopySetAttributesFlag(int val)
Definition: CoviseAppModule.h:72
void setCopyAttributes(int val)
Definition: CoviseAppModule.h:67
int compute_timesteps
Definition: CoviseAppModule.h:54
char ** inport_names
Definition: CoviseAppModule.h:39
bool multiprocessing_flag
Definition: CoviseAppModule.h:49
int copy_attributes_flag
Definition: CoviseAppModule.h:45
void setComputeMultiblock(int val)
Definition: CoviseAppModule.h:101
void setPreMultiprocessing(bool val)
Definition: CoviseAppModule.h:90
char ** outport_names
Definition: CoviseAppModule.h:40
int getLevel()
Definition: CoviseAppModule.h:108
int num_inports
Definition: CoviseAppModule.h:41
int current_level
Definition: CoviseAppModule.h:50
void setComputeTimesteps(int val)
Definition: CoviseAppModule.h:96
virtual void preCompute(const coDistributedObject **)
Definition: CoviseAppModule.h:122
int num_outports
Definition: CoviseAppModule.h:42
void setMultiprocessing(bool val)
Definition: CoviseAppModule.h:86
virtual void postCompute(const coDistributedObject **, coDistributedObject **)
Definition: CoviseAppModule.h:127
int compute_multiblock
Definition: CoviseAppModule.h:55
bool pre_multiprocessing_flag
Definition: CoviseAppModule.h:51
virtual coDistributedObject ** compute(const coDistributedObject **, char **)
Definition: CoviseAppModule.h:123
int or_copy_addAttributes_flag
Definition: CoviseAppModule.h:46
Definition: coDistributedObject.h:296