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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3259 - (show annotations)
Mon Oct 11 01:48:14 2010 UTC (9 years ago) by jfenwick
File MIME type: text/plain
File size: 7711 byte(s)
Merging dudley and scons updates from branches

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