COVISE Core
coSimClient.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#ifndef _CO_SIMLIB_H_
9#define _CO_SIMLIB_H_
10
11/* these includes should be here and not in coSimClient.c!*/
12#if !(defined(WIN32) || defined(WIN64))
13#include <unistd.h>
14#include <signal.h>
15#include <sys/time.h>
16#include <sys/types.h>
17#include <netinet/in.h>
18#include <arpa/inet.h>
19#include <sys/socket.h>
20#include <netdb.h>
21#include <arpa/inet.h>
22#include <sys/fcntl.h>
23#else
24#include <winsock2.h>
25#include <windows.h>
26#include <io.h>
27#include <fcntl.h>
28#endif
29
30/**************************************************************************\
31 ** (C)1999 RUS **
32 ** **
33 ** Description: Covise Simulation Library, Simulation side **
34 ** **
35 ** When linking C++, C or FORTRAN simulations with Covise, this **
36 ** File describes the functionality available to the Simulation. **
37 ** **
38 ** Author: Andreas Werner **
39 ** Computing Center University of Stuttgart **
40 ** Allmandring 30a **
41 ** 70550 Stuttgart **
42 ** **
43 ** Date: 08.06.99 V1.0 **
44\**************************************************************************/
45
46/* Set CO_SIMLIB_VERBOSE to one of the following to switch verbose levels:
47 * 0: no messages (default)
48 * 1: low message level
49 * 2: high message level
50 * 3: ultra-high message level, data verbose
51 */
52
53/* To be specified in covise.config:
54 * <Modulname>
55 * {
56 * PORTS <first>-<last> # allowed ports range, default: 31000-31999
57 * SERVER Module|Simulation # who is TCP server, default: Module
58 * LOCAL <address> # use this local address, default: gethostname()
59 * TIMEOUT <seconds> # timeout for network, default: 60 sec
60 * STARTUP string to start application, can use:
61 * %e -> replaced by contents of CO_SIMLIB_CONN
62 * %h -> replaced by target host, default localhost
63 * %1, %2, ... -> user-definable targets
64 * %% -> the '%' char
65 * }
66 * example:
67 *
68 * Star
69 * {
70 * PORT 31000 31999
71 * SERVER Module
72 * Startup rsh -l %1 %h "env CO_SIMLIB_CONN=%e ; cd %2 ; echo %3 | star"
73 * }
74 */
75
76#ifdef __cplusplus
77extern "C" {
78#endif
79
80/* All commands return an exit code: =0 ok, =1 error ****/
81
82/* Startup : read connectivity parameters but do NOT connect
83 return -1 on Error, 0 if ok */
84int coInitConnect(); /* Fortran 77: COVINI() */
85
86/* Check, whether we are still connected: <0 if non- */
87int coNotConnected(); /* Fortran 77: CONOCO() */
88
89/* Logic send/receive calls ******/
90
91/* Read a slider Parameter of the module */
92int coGetParaSlider(const char *name, float *min, float *max, float *val);
93
94/* Read a scalar Parameter of the module */
95/* Fortran 77: COGPFL() */
96int coGetParaFloatScalar(const char *name, float *data);
97
98/* Read a 3D vector Parameter of the module */
99/* Fortran 77: COGVFL() */
100int coGetParaFloatVector(const char *name, float *data);
101
102/* Read a String Parameter of the module */
103/* Fortran 77: COGPIN() */
104int coGetParaIntScalar(const char *name, int *data);
105
106/* Read a choice Parameter of the module */
107/* Fortran 77: COGPCH() */
108int coGetParaChoice(const char *name, int *data);
109
110/* Read a Boolean Parameter of the module */
111int coGetParaBool(const char *name, int *data); /* Fortran 77: COGPBO() */
112
113/* Read a Boolean Parameter of the module */
114/* Fortran 77: COGPTX() */
115int coGetParaText(const char *name, char *data);
116
117/* Read a Filename Parameter of the module */
118int coGetParaFile(const char *name, int *data); /* Fortran 77: COGPFI() */
119
120/* Send an Unstructured Grid, Covise format */
121int coSendUSG(const char *portName,
122 int numElem, int numConn, int numCoord, /* Fortran 77: COSUGC */
123 int *elemList, int *connList,
124 float *xCoord, float *yCoord, float *zCoord);
125
126/* Send a structured Grid, Covise format */
127int coSendUSG(const char *portName,
128 int numElem, int numConn, int numCoord, /* Fortran 77: COSUGC */
129 int *elemList, int *connList,
130 float *xCoord, float *yCoord, float *zCoord);
131
132/* Send an Unstructured Grid, xyz coordinate fields,
133 8-elem conn List with multiple point for non-hex elements (e.g. STAR) */
134int coSendUSGhex(const char *portName,
135 int numElem, int numCoord, /* Fortran 77: COSUSG */
136 int *elemList, float *coord);
137
138/* Send an USG scalar data field */
139int coSend1Data(const char *portName, int numElem,
140 float *data); /* Fortran 77: COSU1D */
141
142/* Send an USG vector data field */
143int coSend3Data(const char *portName, int numElem, float *data0,
144 float *data1, float *data2); /* Fortran 77: COSU3D */
145
146/* Attach attribute to object at port */
147int coAddAttribute(const char *portName, /* Fortran 77: COATTR */
148 const char *attrName,
149 const char *attrVal);
150
151/* Execute the Covise Module now : required for continuously running simulations*/
152int coExecModule(); /* Fortran 77: COEXEC */
153
154/* End Server in module and let pipeline run */
155int coFinished(); /* Fortran 77: COFINI */
156
157/* detach and attach covise to running simulation */
158int coDetach(void); /* Fortran 77: DETACH */
159int coAttach(void); /* Fortran 77: ATTACH */
160
161/* Send a message (up to 64 char) to covise message output */
162
163/* ++++++++++++++++ Parallel Simulation support ++++++++++++++++ */
164
165/* Begin Parallel Ports definition F77: COPAIN */
166int coParallelInit(int numParts, int numPorts);
167
168/* Declare this port as parallel output port F77: COPAPO */
169/* and tell whether this is cell- or vertex-based data */
170int coParallelPort(const char *portname, int isCellData);
171
172/* Send a cell mapping local -> global F77: COPACM */
173int coParallelCellMap(int node, int numCells, const int *localToGlobal);
174
175/* Send a vertex mapping local -> global F77: COPAVM */
176int coParallelVertexMap(int node, int numCells, const int *localToGlobal);
177
178/* Next data sent is from node # F77: COPANO */
179/* WARNING: Covise always expects nodes 0..numParts-1 */
180int coParallelNode(int node);
181
182int coSendParaDone();
183
184/******************************************************************
185 ***** *****
186 ***** Binary send/receive: use this only if NOT using logics *****
187 ***** *****
188 ******************************************************************/
189
190/* Send a certain amount of data to the module F77: COSEND */
191int sendData(const void *buffer, size_t length);
192
193/* Receive a certain amount of data from the module F77: CORECV */
194int recvData(void *buffer, size_t length);
195
196/******************************************************************
197 ******************************************************************/
198
199/* get the verbose level F77: COVERB */
200int getVerboseLevel();
201
202struct in_addr ip;
204
206
207#ifdef __cplusplus
208} // extern "C" {
209#endif
210#endif
GLuint buffer
Definition: khronos-glext.h:6606
GLuint coord
Definition: khronos-glext.h:10486
GLuint GLfloat * val
Definition: khronos-glext.h:7898
GLuint const GLchar * name
Definition: khronos-glext.h:6722
GLenum GLuint GLenum GLsizei length
Definition: khronos-glext.h:6279
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: khronos-glext.h:6354
int coInitConnect()
Definition: coSimClient.c:228
int coParallelInit(int numParts, int numPorts)
Definition: coSimClient.c:1031
int coAddAttribute(const char *portName, const char *attrName, const char *attrVal)
Definition: coSimClient.c:1329
int coExecModule()
Definition: coSimClient.c:1007
int coParallelPort(const char *portname, int isCellData)
Definition: coSimClient.c:1074
int coSendUSG(const char *portName, int numElem, int numConn, int numCoord, int *elemList, int *connList, float *xCoord, float *yCoord, float *zCoord)
int isServer
Definition: coSimClient.h:205
int coSendUSGhex(const char *portName, int numElem, int numCoord, int *elemList, float *coord)
Definition: coSimClient.c:899
int coParallelNode(int node)
Definition: coSimClient.c:1402
int coParallelVertexMap(int node, int numCells, const int *localToGlobal)
Definition: coSimClient.c:1390
int coAttach(void)
Definition: coSimClient.c:1189
int coGetParaBool(const char *name, int *data)
Definition: coSimClient.c:767
int coGetParaFile(const char *name, int *data)
Definition: coSimClient.c:835
int coFinished()
Definition: coSimClient.c:992
int maxPort
Definition: coSimClient.h:203
int recvData(void *buffer, size_t length)
Definition: coSimClient.c:1500
int coGetParaIntScalar(const char *name, int *data)
Definition: coSimClient.c:677
int coDetach(void)
Definition: coSimClient.c:1136
int minPort
Definition: coSimClient.h:203
int coSend3Data(const char *portName, int numElem, float *data0, float *data1, float *data2)
Definition: coSimClient.c:978
int coGetParaChoice(const char *name, int *data)
Definition: coSimClient.c:722
int coGetParaFloatVector(const char *name, float *data)
Definition: coSimClient.c:632
int coGetParaText(const char *name, char *data)
Definition: coSimClient.c:778
struct in_addr ip
Definition: coSimClient.h:202
int coSendParaDone()
Definition: coSimClient.c:482
int sendData(const void *buffer, size_t length)
Definition: coSimClient.c:1432
int coGetParaFloatScalar(const char *name, float *data)
Definition: coSimClient.c:583
int coGetParaSlider(const char *name, float *min, float *max, float *val)
Definition: coSimClient.c:535
int getVerboseLevel()
Definition: coSimClient.c:1746
int coNotConnected()
Definition: coSimClient.c:406
int coParallelCellMap(int node, int numCells, const int *localToGlobal)
Definition: coSimClient.c:1379
int coSend1Data(const char *portName, int numElem, float *data)
Definition: coSimClient.c:939
int min(int a, int b)
Definition: cutil_math.h:60
int max(int a, int b)
Definition: cutil_math.h:55