/[escript]/trunk/dudley/src/Mesh.h
ViewVC logotype

Contents of /trunk/dudley/src/Mesh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4114 - (show annotations)
Fri Dec 14 04:24:46 2012 UTC (6 years, 8 months ago) by caltinay
File MIME type: text/plain
File size: 7589 byte(s)
Time to remove deprecated saveVTK/DX methods from Data and Domain.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2012 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16 #ifndef INC_DUDLEY_MESH
17 #define INC_DUDLEY_MESH
18
19 /************************************************************************************/
20
21 /* Dudley: Mesh */
22
23 /* A mesh is built from nodes and elements which are describing the
24 domain, the surface and point sources. (the latter are needed to
25 establish links with other codes, in particular to particle
26 codes). The nodes are stored a Dudley_NodeFile and elements in a
27 Dudley_ElementFile. A Dudley_NodeFile and three Dudley_ElementFile
28 containing the elements describing the domain, surface and point
29 sources respectively. Notice that the surface elements do not
30 necessaryly cover the entire surface of the domain. */
31
32 /* The element type is fixed by the reference element, see
33 ReferenceElement.h. The numbering of the nodes starts with 0. */
34
35 /* Important: it is assumed that every node is appearing in at least
36 one element or surface element and that any node used in an
37 element, surface element or as a point is specified in the
38 Dudley_Node, see also Dudley_resolveNodeIds. */
39
40 /* In some cases it is useful to refer to a mesh entirly built from
41 order 1 (=linear) elements. The linear version of the mesh can be
42 accessed by referning to the first few nodes of each element
43 (thanks to the way the nodes are ordered). As the numbering of
44 these nodes is not continuous a relabeling vectors are introduced
45 in the Dudley_NodeFile. This feature is not fully implemented
46 yet. */
47
48 /* allnodes and elements are tagged. the tag allows to group nodes and
49 elements. A typical application is to mark surface elements on a
50 certain portion of the domain with the same tag. All these surface
51 elements can then assigned the same value eg. for the pressure. */
52
53 /* Thespacial dimension is determined by the type of elements
54 used. The spacial dimension should be accessed by the function
55 Dudley_Mesh_getDim. Notice that the element type also determines
56 the type of surface elements to be used. */
57
58 /************************************************************************************/
59
60 #include "Dudley.h"
61 #include "NodeFile.h"
62 #include "ElementFile.h"
63 #include "TagMap.h"
64 #include "Util.h"
65 #include "paso/SystemMatrixPattern.h"
66 #include "escript/DataC.h"
67
68 #ifdef ESYS_MPI
69 #include "esysUtils/Esys_MPI.h"
70 #endif
71
72 /************************************************************************************/
73
74 /* this struct holds a mesh: */
75
76 struct Dudley_Mesh {
77 char *Name; /* the name of the mesh */
78 dim_t reference_counter; /* counts the number of references to the mesh; */
79 dim_t approximationOrder;
80 dim_t reducedApproximationOrder;
81 dim_t integrationOrder;
82 dim_t reducedIntegrationOrder;
83 Dudley_NodeFile *Nodes; /* the table of the nodes */
84 Dudley_ElementFile *Elements; /* the table of the elements */
85 Dudley_ElementFile *FaceElements; /* the table of the face elements */
86 Dudley_ElementFile *Points; /* the table of points (treated as elements of dimension 0) */
87 Dudley_TagMap *TagMap; /* the tag map mapping names to tag keys */
88
89 /* pointer to the sparse matrix pattern */
90
91 Paso_SystemMatrixPattern *FullFullPattern;
92 Paso_SystemMatrixPattern *FullReducedPattern;
93 Paso_SystemMatrixPattern *ReducedFullPattern;
94 Paso_SystemMatrixPattern *ReducedReducedPattern;
95 Esys_MPIInfo *MPIInfo;
96 };
97
98 typedef struct Dudley_Mesh Dudley_Mesh;
99
100 /* these structures are used for matching surfaces elements: */
101
102 struct Dudley_Mesh_findMatchingFaces_center {
103 index_t refId;
104 double x[MAX_numDim];
105 };
106 typedef struct Dudley_Mesh_findMatchingFaces_center Dudley_Mesh_findMatchingFaces_center;
107
108 /************************************************************************************/
109
110 /* interfaces: */
111 Dudley_Mesh *Dudley_Mesh_alloc(char *name, dim_t numDim, Esys_MPIInfo * mpi_info);
112 Dudley_Mesh *Dudley_Mesh_reference(Dudley_Mesh *);
113 dim_t Dudley_Mesh_getDim(Dudley_Mesh *);
114 void Dudley_Mesh_free(Dudley_Mesh *);
115
116 void Dudley_Mesh_addTagMap(Dudley_Mesh * mesh_p, const char *name, index_t tag_key);
117 index_t Dudley_Mesh_getTag(Dudley_Mesh * mesh_p, const char *name);
118 bool_t Dudley_Mesh_isValidTagName(Dudley_Mesh * mesh_p, const char *name);
119 void Dudley_Mesh_distributeByRankOfDOF(Dudley_Mesh * in, dim_t * distribution);
120 Paso_SystemMatrixPattern *Dudley_getPattern(Dudley_Mesh * mesh, bool_t reduce_row_order, bool_t reduce_col_order);
121 Paso_SystemMatrixPattern *Dudley_makePattern(Dudley_Mesh * mesh, bool_t reduce_row_order, bool_t reduce_col_order);
122 void Dudley_Mesh_write(Dudley_Mesh *, char *);
123 void Dudley_Mesh_dump(Dudley_Mesh * in, char *fname);
124 void Dudley_PrintMesh_Info(Dudley_Mesh *, bool_t);
125 Dudley_Mesh *Dudley_Mesh_load(char *fname);
126 Dudley_Mesh *Dudley_Mesh_read(char *, index_t, index_t, bool_t);
127 Dudley_Mesh *Dudley_Mesh_readGmsh(char *, index_t, index_t, index_t, bool_t, bool_t);
128 void Dudley_Mesh_setOrders(Dudley_Mesh * in);
129
130 void Dudley_Mesh_setCoordinates(Dudley_Mesh *, escriptDataC *);
131 void Dudley_Mesh_setElements(Dudley_Mesh * self, Dudley_ElementFile * elements);
132 void Dudley_Mesh_setFaceElements(Dudley_Mesh * self, Dudley_ElementFile * elements);
133 void Dudley_Mesh_setPoints(Dudley_Mesh * self, Dudley_ElementFile * elements);
134
135 void Dudley_Mesh_optimizeDOFDistribution(Dudley_Mesh * in, dim_t * distribution);
136 void Dudley_Mesh_prepare(Dudley_Mesh * in, bool_t optimize);
137 void Dudley_Mesh_createColoring(Dudley_Mesh * in, index_t * node_localDOF_map);
138 void Dudley_Mesh_optimizeElementOrdering(Dudley_Mesh * in);
139 void Dudley_Mesh_resolveNodeIds(Dudley_Mesh *);
140 void Dudley_Mesh_createMappings(Dudley_Mesh * in, index_t * dof_distribution, index_t * node_distribution);
141 void Dudley_Mesh_createNodeFileMappings(Dudley_Mesh * in, dim_t numReducedNodes, index_t * indexReducedNodes,
142 index_t * dof_first_component, index_t * nodes_first_component);
143 void Dudley_Mesh_markDOFsConnectedToRange(index_t * mask, index_t offset, index_t marker, index_t firstDOF,
144 index_t lastDOF, Dudley_Mesh * in, bool_t useLinear);
145
146 void Dudley_Mesh_optimizeDOFLabeling(Dudley_Mesh *, dim_t *);
147
148 Dudley_Mesh *Dudley_Mesh_merge(dim_t, Dudley_Mesh **);
149
150 void Dudley_Mesh_relableElementNodes(int *, int, Dudley_Mesh *);
151 void Dudley_Mesh_markNodes(int *, int, Dudley_Mesh *, int);
152
153 void Dudley_Mesh_glueFaces(Dudley_Mesh * self, double safety_factor, double tolerance, bool_t);
154 void Dudley_Mesh_joinFaces(Dudley_Mesh * self, double safety_factor, double tolerance, bool_t);
155
156 int Dudley_Mesh_findMatchingFaces_compar(const void *, const void *);
157 void Dudley_Mesh_findMatchingFaces(Dudley_NodeFile *, Dudley_ElementFile *, double, double, int *, int *, int *, int *);
158 void Dudley_Mesh_print(Dudley_Mesh * in);
159 void Dudley_Mesh_optimizeNodeLabeling(Dudley_Mesh * mesh_p);
160 dim_t Dudley_Mesh_FindMinDegreeNode(Paso_SystemMatrixPattern * pattern_p, index_t * available, index_t indicator);
161 index_t Dudley_Mesh_getDegree(Paso_SystemMatrixPattern * pattern_p, index_t * label);
162 void Dudley_Mesh_setTagsInUse(Dudley_Mesh * in);
163 int Dudley_Mesh_getStatus(Dudley_Mesh * in);
164
165 #endif /* #ifndef INC_DUDLEY_MESH */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26