escript
Revision_
|
00001 00002 /***************************************************************************** 00003 * 00004 * Copyright (c) 2003-2014 by University of Queensland 00005 * http://www.uq.edu.au 00006 * 00007 * Primary Business: Queensland, Australia 00008 * Licensed under the Open Software License version 3.0 00009 * http://www.opensource.org/licenses/osl-3.0.php 00010 * 00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 00012 * Development 2012-2013 by School of Earth Sciences 00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp) 00014 * 00015 *****************************************************************************/ 00016 00017 #ifndef INC_DUDLEY_ELEMENTFILE 00018 #define INC_DUDLEY_ELEMENTFILE 00019 00020 #include "Dudley.h" 00021 #include "NodeFile.h" 00022 #include "ElementType.h" 00023 #include "escript/DataC.h" 00024 00025 #ifdef ESYS_MPI 00026 #include "esysUtils/Esys_MPI.h" 00027 #endif 00028 00029 typedef struct { 00030 Dudley_Status_t status; /* status of mesh when jacobeans where updated last time */ 00031 dim_t numDim; /* spatial dimension */ 00032 dim_t numQuad; /* number of quadrature nodes used to calculate jacobeans */ 00033 dim_t numShapes; /* number of shape functions */ 00034 dim_t numElements; /* number of elements */ 00035 double *absD; /* used to compute volume */ 00036 double quadweight; /* used to compute volume */ 00037 double *DSDX; /* derivatives of shape functions in global coordinates at quadrature points */ 00038 } Dudley_ElementFile_Jacobeans; 00039 00040 struct Dudley_ElementFile { 00041 Esys_MPIInfo *MPIInfo; 00042 Esys_MPI_rank *Owner; 00043 00044 dim_t numElements; /* number of elements. */ 00045 00046 index_t *Id; /* Id[i] is the id nmber of 00047 node i. this number is not 00048 used but useful when 00049 elements are resorted. in 00050 the entire code the term 00051 'element id' refers to i 00052 but nor to Id[i] if not 00053 explicitly stated 00054 otherwise. */ 00055 00056 index_t *Tag; /* Tag[i] is the tag of element i. */ 00057 00058 index_t *tagsInUse; /* array of tags which are actually used */ 00059 dim_t numTagsInUse; /* number of tags used */ 00060 00061 dim_t numNodes; /* number of nodes per element */ 00062 index_t *Nodes; /* Nodes[INDEX(k, i, numNodes)] 00063 is the k-the node in the 00064 i-the element. note that 00065 in the way the nodes are 00066 ordered Nodes[INDEX(k, i, numNodes) 00067 is k-the node of element i 00068 when refering to the 00069 linear version of the 00070 mesh. */ 00071 index_t minColor; /* minimum color */ 00072 index_t maxColor; /* maximum color */ 00073 index_t *Color; /* assigns each element a color. elements with the same color 00074 are don't share a node so they can be processed simultaneously 00075 at anytime Color must provide a valid value. In any case one can set 00076 Color[e]=e for all e */ 00077 00078 Dudley_ElementFile_Jacobeans *jacobeans; /* jacobeans of the shape function used for solution approximation */ 00079 Dudley_ElementFile_Jacobeans *jacobeans_reducedQ; /* jacobeans of the shape function used for solution approximation for reduced integration order */ 00080 dim_t numDim; /* spatial dimension of the domain */ 00081 dim_t numLocalDim; /* dimension of the element eg 2 for A line in 2D or 3D */ 00082 Dudley_ElementTypeId etype; /* element type */ 00083 const char *ename; /* name of element type */ 00084 dim_t numShapes; /* number of shape functions */ 00085 }; 00086 00087 typedef struct Dudley_ElementFile Dudley_ElementFile; 00088 Dudley_ElementFile *Dudley_ElementFile_alloc(Dudley_ElementTypeId etype, Esys_MPIInfo * MPIInfo); 00089 void Dudley_ElementFile_free(Dudley_ElementFile *); 00090 void Dudley_ElementFile_allocTable(Dudley_ElementFile *, dim_t); 00091 void Dudley_ElementFile_freeTable(Dudley_ElementFile *); 00092 void Dudley_ElementFile_setElementDistribution(Dudley_ElementFile * in, dim_t * distribution); 00093 dim_t Dudley_ElementFile_getGlobalNumElements(Dudley_ElementFile * in); 00094 dim_t Dudley_ElementFile_getMyNumElements(Dudley_ElementFile * in); 00095 index_t Dudley_ElementFile_getFirstElement(Dudley_ElementFile * in); 00096 void Dudley_ElementFile_distributeByRankOfDOF(Dudley_ElementFile * self, Esys_MPI_rank * mpiRankOfDOF, index_t * Id); 00097 00098 void Dudley_ElementFile_createColoring(Dudley_ElementFile * in, dim_t numNodes, dim_t * degreeOfFreedom); 00099 void Dudley_ElementFile_optimizeOrdering(Dudley_ElementFile ** in); 00100 void Dudley_ElementFile_setNodeRange(dim_t *, dim_t *, Dudley_ElementFile *); 00101 void Dudley_ElementFile_relableNodes(dim_t *, dim_t, Dudley_ElementFile *); 00102 void Dudley_ElementFile_markNodes(dim_t *, dim_t, dim_t, Dudley_ElementFile *, bool); 00103 void Dudley_ElementFile_scatter(dim_t *, Dudley_ElementFile *, Dudley_ElementFile *); 00104 void Dudley_ElementFile_gather(dim_t *, Dudley_ElementFile *, Dudley_ElementFile *); 00105 void Dudley_ElementFile_copyTable(dim_t, Dudley_ElementFile *, dim_t, dim_t, Dudley_ElementFile *); 00106 void Dudley_ElementFile_markDOFsConnectedToRange(index_t * mask, index_t offset, index_t marker, index_t firstDOF, 00107 index_t lastDOF, index_t * dofIndex, Dudley_ElementFile * in, 00108 bool useLinear); 00109 00110 void Dudley_ElementFile_setTags(Dudley_ElementFile *, const int, escriptDataC *); 00111 Dudley_ElementFile_Jacobeans *Dudley_ElementFile_Jacobeans_alloc(void); 00112 void Dudley_ElementFile_Jacobeans_dealloc(Dudley_ElementFile_Jacobeans *); 00113 Dudley_ElementFile_Jacobeans *Dudley_ElementFile_borrowJacobeans(Dudley_ElementFile *, Dudley_NodeFile *, bool); 00114 void Dudley_ElementFile_setTagsInUse(Dudley_ElementFile * in); 00115 00116 #endif /* #ifndef INC_DUDLEY_ELEMENTFILE */