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_MESH 00018 #define INC_DUDLEY_MESH 00019 00020 /************************************************************************************/ 00021 00022 /* Dudley: Mesh */ 00023 00024 /* A mesh is built from nodes and elements which are describing the 00025 domain, the surface and point sources. (the latter are needed to 00026 establish links with other codes, in particular to particle 00027 codes). The nodes are stored a Dudley_NodeFile and elements in a 00028 Dudley_ElementFile. A Dudley_NodeFile and three Dudley_ElementFile 00029 containing the elements describing the domain, surface and point 00030 sources respectively. Notice that the surface elements do not 00031 necessaryly cover the entire surface of the domain. */ 00032 00033 /* The element type is fixed by the reference element, see 00034 ReferenceElement.h. The numbering of the nodes starts with 0. */ 00035 00036 /* Important: it is assumed that every node is appearing in at least 00037 one element or surface element and that any node used in an 00038 element, surface element or as a point is specified in the 00039 Dudley_Node, see also Dudley_resolveNodeIds. */ 00040 00041 /* In some cases it is useful to refer to a mesh entirly built from 00042 order 1 (=linear) elements. The linear version of the mesh can be 00043 accessed by referning to the first few nodes of each element 00044 (thanks to the way the nodes are ordered). As the numbering of 00045 these nodes is not continuous a relabeling vectors are introduced 00046 in the Dudley_NodeFile. This feature is not fully implemented 00047 yet. */ 00048 00049 /* allnodes and elements are tagged. the tag allows to group nodes and 00050 elements. A typical application is to mark surface elements on a 00051 certain portion of the domain with the same tag. All these surface 00052 elements can then assigned the same value eg. for the pressure. */ 00053 00054 /* Thespacial dimension is determined by the type of elements 00055 used. The spacial dimension should be accessed by the function 00056 Dudley_Mesh_getDim. Notice that the element type also determines 00057 the type of surface elements to be used. */ 00058 00059 /************************************************************************************/ 00060 00061 #include "Dudley.h" 00062 #include "NodeFile.h" 00063 #include "ElementFile.h" 00064 #include "TagMap.h" 00065 #include "Util.h" 00066 #include "paso/SystemMatrixPattern.h" 00067 #include "escript/DataC.h" 00068 00069 #ifdef ESYS_MPI 00070 #include "esysUtils/Esys_MPI.h" 00071 #endif 00072 00073 /************************************************************************************/ 00074 00075 /* this struct holds a mesh: */ 00076 00077 struct Dudley_Mesh { 00078 char *Name; /* the name of the mesh */ 00079 dim_t reference_counter; /* counts the number of references to the mesh; */ 00080 dim_t approximationOrder; 00081 dim_t reducedApproximationOrder; 00082 dim_t integrationOrder; 00083 dim_t reducedIntegrationOrder; 00084 Dudley_NodeFile *Nodes; /* the table of the nodes */ 00085 Dudley_ElementFile *Elements; /* the table of the elements */ 00086 Dudley_ElementFile *FaceElements; /* the table of the face elements */ 00087 Dudley_ElementFile *Points; /* the table of points (treated as elements of dimension 0) */ 00088 Dudley_TagMap *TagMap; /* the tag map mapping names to tag keys */ 00089 00090 /* pointer to the sparse matrix pattern */ 00091 00092 paso::SystemMatrixPattern_ptr FullFullPattern; 00093 paso::SystemMatrixPattern_ptr FullReducedPattern; 00094 paso::SystemMatrixPattern_ptr ReducedFullPattern; 00095 paso::SystemMatrixPattern_ptr ReducedReducedPattern; 00096 Esys_MPIInfo *MPIInfo; 00097 }; 00098 00099 typedef struct Dudley_Mesh Dudley_Mesh; 00100 00101 /* these structures are used for matching surfaces elements: */ 00102 00103 struct Dudley_Mesh_findMatchingFaces_center { 00104 index_t refId; 00105 double x[MAX_numDim]; 00106 }; 00107 typedef struct Dudley_Mesh_findMatchingFaces_center Dudley_Mesh_findMatchingFaces_center; 00108 00109 /************************************************************************************/ 00110 00111 /* interfaces: */ 00112 Dudley_Mesh *Dudley_Mesh_alloc(char *name, dim_t numDim, Esys_MPIInfo * mpi_info); 00113 Dudley_Mesh *Dudley_Mesh_reference(Dudley_Mesh *); 00114 dim_t Dudley_Mesh_getDim(Dudley_Mesh *); 00115 void Dudley_Mesh_free(Dudley_Mesh *); 00116 00117 void Dudley_Mesh_addTagMap(Dudley_Mesh * mesh_p, const char *name, index_t tag_key); 00118 index_t Dudley_Mesh_getTag(Dudley_Mesh * mesh_p, const char *name); 00119 bool Dudley_Mesh_isValidTagName(Dudley_Mesh * mesh_p, const char *name); 00120 void Dudley_Mesh_distributeByRankOfDOF(Dudley_Mesh * in, dim_t * distribution); 00121 paso::SystemMatrixPattern_ptr Dudley_getPattern(Dudley_Mesh * mesh, bool reduce_row_order, bool reduce_col_order); 00122 paso::SystemMatrixPattern_ptr Dudley_makePattern(Dudley_Mesh * mesh, bool reduce_row_order, bool reduce_col_order); 00123 void Dudley_Mesh_write(Dudley_Mesh *, char *); 00124 void Dudley_Mesh_dump(Dudley_Mesh * in, char *fname); 00125 void Dudley_PrintMesh_Info(Dudley_Mesh *, bool); 00126 Dudley_Mesh *Dudley_Mesh_load(char *fname); 00127 Dudley_Mesh *Dudley_Mesh_read(char *, index_t, index_t, bool); 00128 Dudley_Mesh *Dudley_Mesh_readGmsh(char *, index_t, index_t, index_t, bool, bool); 00129 void Dudley_Mesh_setOrders(Dudley_Mesh * in); 00130 00131 void Dudley_Mesh_setCoordinates(Dudley_Mesh *, escriptDataC *); 00132 void Dudley_Mesh_setElements(Dudley_Mesh * self, Dudley_ElementFile * elements); 00133 void Dudley_Mesh_setFaceElements(Dudley_Mesh * self, Dudley_ElementFile * elements); 00134 void Dudley_Mesh_setPoints(Dudley_Mesh * self, Dudley_ElementFile * elements); 00135 00136 void Dudley_Mesh_optimizeDOFDistribution(Dudley_Mesh * in, dim_t * distribution); 00137 void Dudley_Mesh_prepare(Dudley_Mesh * in, bool optimize); 00138 void Dudley_Mesh_createColoring(Dudley_Mesh * in, index_t * node_localDOF_map); 00139 void Dudley_Mesh_optimizeElementOrdering(Dudley_Mesh * in); 00140 void Dudley_Mesh_resolveNodeIds(Dudley_Mesh *); 00141 void Dudley_Mesh_createMappings(Dudley_Mesh * in, index_t * dof_distribution, index_t * node_distribution); 00142 void Dudley_Mesh_createNodeFileMappings(Dudley_Mesh * in, dim_t numReducedNodes, index_t * indexReducedNodes, 00143 index_t * dof_first_component, index_t * nodes_first_component); 00144 void Dudley_Mesh_markDOFsConnectedToRange(index_t * mask, index_t offset, index_t marker, index_t firstDOF, 00145 index_t lastDOF, Dudley_Mesh * in, bool useLinear); 00146 00147 void Dudley_Mesh_optimizeDOFLabeling(Dudley_Mesh *, dim_t *); 00148 00149 Dudley_Mesh *Dudley_Mesh_merge(dim_t, Dudley_Mesh **); 00150 00151 void Dudley_Mesh_relableElementNodes(int *, int, Dudley_Mesh *); 00152 void Dudley_Mesh_markNodes(int *, int, Dudley_Mesh *, bool); 00153 00154 void Dudley_Mesh_glueFaces(Dudley_Mesh * self, double safety_factor, double tolerance, bool); 00155 void Dudley_Mesh_joinFaces(Dudley_Mesh * self, double safety_factor, double tolerance, bool); 00156 00157 int Dudley_Mesh_findMatchingFaces_compar(const void *, const void *); 00158 void Dudley_Mesh_findMatchingFaces(Dudley_NodeFile *, Dudley_ElementFile *, double, double, int *, int *, int *, int *); 00159 void Dudley_Mesh_print(Dudley_Mesh * in); 00160 void Dudley_Mesh_optimizeNodeLabeling(Dudley_Mesh * mesh_p); 00161 dim_t Dudley_Mesh_FindMinDegreeNode(paso::SystemMatrixPattern_ptr pattern_p, index_t * available, index_t indicator); 00162 index_t Dudley_Mesh_getDegree(paso::SystemMatrixPattern_ptr pattern_p, index_t * label); 00163 void Dudley_Mesh_setTagsInUse(Dudley_Mesh * in); 00164 int Dudley_Mesh_getStatus(Dudley_Mesh * in); 00165 00166 #endif /* #ifndef INC_DUDLEY_MESH */