ESYS13  Revision_
ElementFile.h
Go to the documentation of this file.
00001 
00002 /*******************************************************
00003 *
00004 * Copyright (c) 2003-2012 by University of Queensland
00005 * Earth Systems Science Computational Center (ESSCC)
00006 * http://www.uq.edu.au/esscc
00007 *
00008 * Primary Business: Queensland, Australia
00009 * Licensed under the Open Software License version 3.0
00010 * http://www.opensource.org/licenses/osl-3.0.php
00011 *
00012 *******************************************************/
00013 
00014 
00015 #ifndef INC_FINLEY_ELEMENTFILE
00016 #define INC_FINLEY_ELEMENTFILE
00017 
00018 #include "Finley.h"
00019 #include "NodeFile.h"
00020 #include "ReferenceElementSets.h"
00021 #include "escript/DataC.h"
00022 
00023 #ifdef ESYS_MPI
00024 #include "esysUtils/Esys_MPI.h"
00025 #endif
00026 
00027 
00028 struct Finley_ElementFile_Jacobeans {
00029   Finley_Status_t status;               /* status of mesh when jacobians were updated last time */
00030   dim_t numDim;                         /* spatial dimension */
00031   Finley_ShapeFunction* BasisFunctions; /* basis function used */
00032   dim_t numQuadTotal;           /* total number of quadrature nodes used to calculate jacobians = numSub * BasisFunctions->numQuadNodes*/
00033   dim_t numSides;                   /* number of sides (=1 normal, =2 contact) */
00034   index_t* offsets;         /* offset to sides (borrowed reference) */
00035   dim_t numSub;         /* number of subelements        */
00036   dim_t numShapesTotal;         /* total number of shape functions =  BasisFunctions->numShapes * numSides */
00037   index_t* node_selection;      /* local node selection list of length numSub * numShapesTotal  (borrowed reference)  */
00038   dim_t numElements;            /* number of elements */
00039   double* volume;                       /* local volume */
00040   double* DSDX;                         /* derivatives of shape functions in global coordinates at quadrature points*/
00041 };
00042 
00043 typedef struct Finley_ElementFile_Jacobeans Finley_ElementFile_Jacobeans;
00044 
00045 struct Finley_ElementFile {
00046   Esys_MPIInfo *MPIInfo;
00047   Esys_MPI_rank *Owner;
00048 
00049   Finley_ReferenceElementSet *referenceElementSet; /* the reference element to be used */
00050 
00051   dim_t numElements;                             /* number of elements. */
00052   
00053   index_t *Id;                                 /* Id[i] is the id number of
00054                                                 node i. this number is not
00055                                                 used but useful when
00056                                                 elements are resorted. In
00057                                                 the entire code the term
00058                                                 'element id' refers to i
00059                                                 and not to Id[i] unless
00060                                                 explicitly stated
00061                                                 otherwise. */
00062 
00063   index_t *Tag;                                /* Tag[i] is the tag of element i. */
00064 
00065   index_t *tagsInUse;                  /* array of tags which are actually used */
00066   dim_t     numTagsInUse;               /* number of tags used */
00067 
00068 
00069   dim_t numNodes;                              /* number of nodes per element */
00070   index_t *Nodes;                              /* Nodes[INDEX(k, i, numNodes)]
00071                                                 is the k-the node in the
00072                                                 i-the element. Note that
00073                                                 in the way the nodes are
00074                                                 ordered Nodes[INDEX(k, i, numNodes)
00075                                                 is the k-th node of element i
00076                                                 when referring to the
00077                                                 linear version of the mesh. */
00078   index_t minColor;                           /* minimum color */
00079   index_t maxColor;                           /* maximum color */
00080   index_t *Color;                             /* assigns each element a color. Elements with the same color     
00081                                                  don't share a node so they can be processed simultaneously.
00082                                                  At anytime Color must provide a valid value. In any case one can set  
00083                                                  Color[e]=e for all e */
00084 
00085   Finley_ElementFile_Jacobeans* jacobeans;           /* jacobians of the shape function used for solution approximation */
00086   Finley_ElementFile_Jacobeans* jacobeans_reducedS;  /* jacobians of the shape function used for solution approximation for reduced order of shape function*/
00087   Finley_ElementFile_Jacobeans* jacobeans_reducedQ;  /* jacobians of the shape function used for solution approximation for reduced integration order*/
00088   Finley_ElementFile_Jacobeans* jacobeans_reducedS_reducedQ;  /* jacobians of the shape function used for solution approximation for reduced integration order and reduced order of shape function*/
00089 
00090 };
00091 
00092 typedef struct Finley_ElementFile Finley_ElementFile;
00093 Finley_ElementFile* Finley_ElementFile_alloc(Finley_ReferenceElementSet* referenceElementSet, Esys_MPIInfo *MPIInfo);
00094 void Finley_ElementFile_free(Finley_ElementFile*);
00095 void Finley_ElementFile_allocTable(Finley_ElementFile*,dim_t);
00096 void Finley_ElementFile_freeTable(Finley_ElementFile*);
00097 void Finley_ElementFile_setElementDistribution(Finley_ElementFile* in, dim_t* distribution);
00098 dim_t Finley_ElementFile_getGlobalNumElements(Finley_ElementFile* in);
00099 dim_t Finley_ElementFile_getMyNumElements(Finley_ElementFile* in);
00100 index_t Finley_ElementFile_getFirstElement(Finley_ElementFile* in); 
00101 void Finley_ElementFile_distributeByRankOfDOF(Finley_ElementFile* self, Esys_MPI_rank* mpiRankOfDOF, index_t *Id);
00102 
00103 void Finley_ElementFile_createColoring(Finley_ElementFile* in,dim_t numNodes,dim_t* degreeOfFreedom);
00104 void Finley_ElementFile_optimizeOrdering(Finley_ElementFile** in);
00105 void Finley_ElementFile_setNodeRange(dim_t*,dim_t*,Finley_ElementFile*);
00106 void Finley_ElementFile_relableNodes(dim_t*,dim_t,Finley_ElementFile*);
00107 void Finley_ElementFile_markNodes(dim_t*,dim_t,dim_t,Finley_ElementFile*,dim_t);
00108 void Finley_ElementFile_scatter(dim_t*,Finley_ElementFile*,Finley_ElementFile*);
00109 void Finley_ElementFile_gather(dim_t*,Finley_ElementFile*,Finley_ElementFile*);
00110 void Finley_ElementFile_copyTable(dim_t,Finley_ElementFile*,dim_t,dim_t,Finley_ElementFile*);
00111 void Finley_ElementFile_markDOFsConnectedToRange(index_t* mask,index_t offset,index_t marker,index_t firstDOF,index_t lastDOF,index_t *dofIndex,Finley_ElementFile*in ,bool_t useLinear);
00112 
00113 void Finley_ElementFile_setTags(Finley_ElementFile* ,const int, escriptDataC*);
00114 Finley_ElementFile_Jacobeans* Finley_ElementFile_Jacobeans_alloc(Finley_ShapeFunction* );
00115 void Finley_ElementFile_Jacobeans_dealloc(Finley_ElementFile_Jacobeans*);
00116 Finley_ElementFile_Jacobeans* Finley_ElementFile_borrowJacobeans(Finley_ElementFile*, Finley_NodeFile*, bool_t, bool_t);
00117 void Finley_ElementFile_setTagsInUse(Finley_ElementFile* in);
00118 
00119 
00120 #endif /* #ifndef INC_FINLEY_ELEMENTFILE */
00121