whitney.h

00001 // copyright by benedikt oswald, all rights reserved, 2002-2006.
00002 // project - aqhdes2003
00003 // file name - whitney.h
00004 // file type - C include file
00005 // objective - povide Whitney base functionality
00006 // creation - 2003 feb 03 ~ 18:12:00 by benedikt oswald
00007 // modified - 2004 feb 12 ~ 15:15:00 by benedikt oswald, transferred functions into auxiliary.h
00008 // required software - UG 3.1 or higher
00009 // file id -
00010 // feature - provides types, macros and functions definitions required
00011 // feature - to implement finite element base functions of the Whitney 1-forms
00012 // feature - and also Whitney 2-forms
00013 
00014 #ifndef AQ_WHITNEY_ELEMENT_BASE_FUNCTIONS
00015 #define AQ_WHITNEY_ELEMENT_BASE_FUNCTIONS
00016 
00017 #ifndef __COMPILER__
00018 #include "compiler.h" /* compiler specific data type definitions */
00019 #endif
00020 
00021 /* include standars C header files */
00022 #include <stddef.h>
00023 #include <math.h>
00024 #include <stdlib.h>
00025 #include <stdio.h>
00026 #include <string.h>
00027 
00028 /* include UG related header files */
00029 #include "gm.h"          /* inserted as is from osterz          */
00030 #include "parallel.h"
00031 #include "evm.h"         /* inserted as is from osterz          */
00032 #include "shapes.h"      /* inserted as is from osterz          */
00033 #include "misc.h"        /* inserted as is from osterz          */
00034 #include "ugdevices.h"   /* inserted as is from osterz          */
00035 #include "np.h"          /* inserted as is from osterz          */            
00036 #include "assemble.h"    /* inserted as is from osterz          */
00037 #include "disctools.h"   /* inserted as is from osterz          */
00038 #include "general.h"     /* inserted as is from osterz          */
00039 #include "ugstruct.h"    /* inserted as is from osterz          */
00040 #include "quadrature.h"  /* include Gaussian quadrature routine */
00041 #include "udm.h"         /* contains VECDATA_DESC data structure */
00042 #include "compiler.h"
00043 #include "namespace.h"
00044 
00045 
00046 /* include our own header files */
00047 #include "aqhdPhysicoMath.h"
00048 #include "disconst.h"
00049 
00050 
00051 USING_UG_NAMESPACE
00052 USING_UGDIM_NAMESPACE
00053 
00054 
00055 /* PUBLIC CONSTANT DECLARATION */
00056 
00057 /* define numerical constants */
00058 
00059 #define WHITNEY1ST 0
00060 #define WHITNEY2ND 1
00061 
00062 #define NUM_WHITNEY_ELEM_NODES (DIM+1)
00063 #define NUM_WHITNEY_ELEM_EDGES (3*(DIM-1))
00064 #define NUM_WHITNEY_ELEM_FACETS (DIM+1)
00065 
00066 #define NUM_WHITNEY_ELEM_EDGE_COEFFS NUM_WHITNEY_ELEM_EDGES
00067 #define NUM_WHITNEY_ELEM_FACET_COEFFS NUM_WHITNEY_ELEM_FACETS
00068 
00069 #define WHITNEY_FE_OK 0
00070 
00071 #define THREE 3
00072 
00073 /* define function constants */
00074 
00075 #define KP3D(k,x,y)    k[0]=(x[1]*y[2]) - (x[2]*y[1]); k[1]=-((x[0]*y[2]) - (x[2]*y[0])); k[2]=(x[0]*y[1]) - (x[1]*y[0]) /* 3D cross product */
00076 //
00077 //#define DOTPRODUCT2D(s,a,b) s=a[0]*b[0] + a[1]*b[1]
00078 #define DOTPRODUCT3D(s,a,b) s=a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
00079 //
00080 //#define VECLEN2D(l,x)       l=sqrt(x[0]*x[0] + x[1]*x[1]); /* 2D vector length */
00081 #define VECLEN3D(l,x)       l=sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]); /* 3D vector length */
00082 //
00083 //#define VECSCALE2D(v,x,s)   v[0]=x[0]*s;v[1]=x[1]*s /* scale 2D vector by factor s */ 
00084 #define VECSCALE3D(v,x,s)   v[0]=x[0]*s;v[1]=x[1]*s; v[2]=x[2]*s /* scale 3D vector by factor s */ 
00085 //
00086 #define ELEMID(t)           (t)->ge.id
00087 //#define NODEID(t)           (t)->id
00088 
00089 /* PUBLIC VARIABLE DECLARATION */
00090 
00091 
00092 /* PUBLIC FUNCTION DECLARATIONS */
00093 
00094 /* integrate Whitney 1st kind of edge e along edge ae using quadrature formula provided by UG      */
00095 DOUBLE ConsistencyW1(const ELEMENT *t, /* for which element                                        */
00096                      INT e,            /* Whitney 1st kind of edge e                               */
00097                      INT ae            /* along edge which we want to integrate Whitney 1st kind   */
00098     );
00099 
00100 /* integrate Whitney function of the 2nd kind on facet (l,m,n) of element t along edge with corners i and j */
00101 DOUBLE IntegrateAlongEdge(
00102     const ELEMENT *t,
00103     INT eos,      /* Whitney function of edge e or facet s        */
00104     INT e,        /* edge along which element shall be integrated */
00105     INT whichkind /* which Whitney function: 1st or 2nd kind      */
00106     );
00107 
00108 /* integrate Whitney function of the 2nd kind on facet (l,m,n) of element t along edge with corners i and j */
00109 DOUBLE IntegrateOverFacet(
00110     const ELEMENT *t,
00111     INT eos,      /* Whitney function of edge e or facet s        */
00112     INT f,        /* facet over which base function shall be integrated */
00113     INT whichkind /* which Whitney function: 1st or 2nd kind      */
00114     );
00115 
00116 /* function returns barycentric coordinates of a point specified in 3D cartesian coordinates */
00117 void BarycentricCoordinates(
00118     const ELEMENT *t,
00119     const DOUBLE *cartcoords,
00120     DOUBLE *barycoords
00121     );
00122 
00123 /*
00124   function calculates gradient that belongs to barycentric coordinate attached
00125   to corner c === side s with respect to the numbering scheme within the element t
00126 */
00127 
00128 void BarycentricGradient(
00129     const ELEMENT *t,
00130     const INT s,
00131     DOUBLE *gradient
00132     );
00133 
00134 /* function computes the value of the whitney function of the 1st kind along the edge with corners c0 and c1 */
00135 
00136 void Whitney1(
00137     ELEMENT *t,
00138     INT e,
00139     const DOUBLE *localcoords,
00140     DOUBLE *w1
00141     );
00142 
00143 /* function computes the curl of the Whitney 1st aling edge e, expressed in terms of the respective gradients */
00144 
00145 void CurlWhitney1(ELEMENT *t,
00146                   const INT e,
00147                   DOUBLE *curl
00148     );
00149 
00150 /* function computes the value of the whitney function of the 2nd kind */
00151 
00152 /* void Whitney2( */
00153 /*     ELEMENT *t, */
00154 /*     const INT s, */
00155 /*     const DOUBLE *cartcoords, */
00156 /*     DOUBLE *whitney2 */
00157 /*     ); */
00158 
00159 #endif
00160 

Generated on Fri Oct 26 14:04:29 2007 for acheron3d by  doxygen 1.4.7