constrain.h

Go to the documentation of this file.
00001 /*
00002  * $Id: constrain.h,v 1.4 2004/06/24 18:32:35 joaoluiz Exp $
00003  * (C) COPYRIGHT 2004, Joao Luiz Elias Campos.
00004  * All Rights Reserved
00005  * Duplication of this program or any part thereof without the express
00006  * written consent of the author is prohibited
00007  *
00008  *   Modified:    25-Aug-05    Alexandre A. Del Savio
00009  *     Adicionado o tipo globalParametric, na estrutura sConstClass
00010  *     e o respectivo define ConstToGlobalParametric.
00011  *
00012  *   Modified:    23-Fev-06    Juan Pablo Ibañez
00013  *     modificada a definicão de ConstToLocal, ConstToGlobal e 
00014  *     ConstToGlobalParametric, que passam a retornar um valor (int).
00015  *
00016  *  Modified:    29-Mar-06    Juan Pablo Ibañez
00017  *     Modificada a funcão ConstNew que passa mais um parametro "i".
00018  *
00019  *  Modified:    12-Jun-06    Juan Pablo Ibañez
00020  *     Criada a enumeracao eConstMode para definicao do tipo de analise.
00021  *
00022  *  Modified:    21-Jun-06    Alexandre A. Del Savio
00023  *     Added the RAIL constant in eConstMode, for the move on rail mode.
00024  *     Added the ContNumConstrainRead variable to control the read of
00025  *     constrain globally.
00026  *     Removed the first parameter "int" of the ConstNew.
00027  *
00028  *  Modified:   05-set-06     Juan Pablo Ibanez 
00029  *     Eliminada a lista de tipos eConstMode e acrescentado o tipo
00030  *     de restricao SHOT para o caso de apoio inclinado.
00031  *
00032  *  Modified:   05-set-06     Juan Pablo Ibanez
00033  *     Criada a variavel shotVector que guarda o vetor unitario shot.
00034  *
00035  *  Modified:   18-set-06     Márcio & Gisele & Juan Pablo
00036  *     When renamed GlobalParametric methods to Slide and changed API methods.
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  * Public functions:
00154  */
00155 void ConstrainInit(void);
00156 void ConstrainFree(void);
00157 void ConstrainBuild(void);
00158 
00159 #endif
00160 
00161 

Generated on Tue Oct 23 11:23:29 2007 for Relax by  doxygen 1.5.3