00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00046 #ifndef __constrain_h
00047 #define __constrain_h
00048
00049 #include <stdio.h>
00050 #include "node.h"
00051 #include "elm.h"
00052
00053 #ifndef MIN
00054 #define MIN(a,b) ((a<b)?a:b)
00055 #endif
00056
00057 #ifndef MAX
00058 #define MAX(a,b) ((a>b)?a:b)
00059 #endif
00060
00061 #ifndef ABS
00062 #define ABS(a) ((a>=0)?a:-a)
00063 #endif
00064
00067 typedef enum _consttype
00068 {
00069 CURVE,
00070 SHOT,
00071 SURFACE,
00072 NumConstTypes
00073 } eConstType;
00074
00078 typedef struct _constrain
00079 {
00080 eConstType type;
00081 int label;
00082 int numNodes;
00083 int numElems;
00084 int slope;
00085 sNode *nodes;
00086 sElement **elems;
00087 void *data;
00088 } sConstrain;
00089
00093 typedef struct _constclass
00094 {
00095 void (*init) ( void );
00096 void (*new) ( int, int, int, sConstrain **, sConstrain **);
00097 void (*free) ( sConstrain * );
00098 void (*read) ( sConstrain * );
00099 void (*build) ( sConstrain * );
00100 int (*local) ( sConstrain *, sCoord *, void **, double *, double * );
00101 int (*global) ( sConstrain *, sCoord *, void **, double *, double * );
00102 int (*slide) ( sConstrain *, sCoord *, void **, sCoord *, double *,
00103 double*, sCoord * );
00104 } sConstClass;
00105
00106 extern sConstClass ConstClass[NumConstTypes];
00107
00108 extern sConstrain **ConstList;
00109
00110 extern int ContNumConstrainRead;
00111
00112 extern int NumConstrains;
00113
00114 extern sCoord* shotVector;
00115
00116 #define ConstInit(type) \
00117 if(ConstClass[type].init != 0L) \
00118 (*ConstClass[type].init)()
00119
00120 #define ConstNew(type,label,nn,ne,c,l) \
00121 if(ConstClass[type].new != 0L) \
00122 (*ConstClass[type].new)(label,nn,ne,c,l)
00123
00124 #define ConstFree(c) \
00125 if(ConstClass[c->type].free != 0L) \
00126 (*ConstClass[c->type].free)(c)
00127
00128 #define ConstRead(c) \
00129 if(ConstClass[c->type].read != 0L) \
00130 (*ConstClass[c->type].read)(c)
00131
00132 #define ConstBuild(c) \
00133 if(ConstClass[c->type].build != 0L) \
00134 (*ConstClass[c->type].build)(c)
00135
00136 #define ConstToLocal(c,p,e,g,l) \
00137 ((ConstClass[c->type].local != 0L) ? \
00138 (*ConstClass[c->type].local)(c,p,e,g,l) :\
00139 0)
00140
00141 #define ConstToGlobal(c,p,e,l,g) \
00142 ((ConstClass[c->type].global != 0L) ? \
00143 (*ConstClass[c->type].global)(c,p,e,l,g) :\
00144 0)
00145
00146 #define ConstSlide(c,p,e,d,l,g,pl) \
00147 ((ConstClass[c->type].slide != 0L) ? \
00148 (*ConstClass[c->type].slide)(c,p,e,d,l,g,pl) :\
00149 0)
00150
00151
00152
00153
00154
00155 void ConstrainInit(void);
00156 void ConstrainFree(void);
00157 void ConstrainBuild(void);
00158
00159 #endif
00160
00161