/[escript]/branches/domexper/dudley/src/Mesh.h
ViewVC logotype

Contents of /branches/domexper/dudley/src/Mesh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3126 - (show annotations)
Wed Sep 1 00:37:53 2010 UTC (9 years, 2 months ago) by jfenwick
File MIME type: text/plain
File size: 7692 byte(s)
Updated referenceElements and enums
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
15 #ifndef INC_DUDLEY_MESH
16 #define INC_DUDLEY_MESH
17
18 /**************************************************************/
19
20 /* Dudley: Mesh */
21
22 /* A mesh is built from nodes and elements which are describing the
23 domain, the surface and point sources. (the latter are needed to
24 establish links with other codes, in particular to particle
25 codes). The nodes are stored a Dudley_NodeFile and elements in a
26 Dudley_ElementFile. A Dudley_NodeFile and three Dudley_ElementFile
27 containing the elements describing the domain, surface and point
28 sources respectively. Notice that the surface elements do not
29 necessaryly cover the entire surface of the domain. */
30
31 /* The element type is fixed by the reference element, see
32 ReferenceElement.h. The numbering of the nodes starts with 0. */
33
34 /* Important: it is assumed that every node is appearing in at least
35 one element or surface element and that any node used in an
36 element, surface element or as a point is specified in the
37 Dudley_Node, see also Dudley_resolveNodeIds. */
38
39 /* In some cases it is useful to refer to a mesh entirly built from
40 order 1 (=linear) elements. The linear version of the mesh can be
41 accessed by referning to the first few nodes of each element
42 (thanks to the way the nodes are ordered). As the numbering of
43 these nodes is not continuous a relabeling vectors are introduced
44 in the Dudley_NodeFile. This feature is not fully implemented
45 yet. */
46
47 /* allnodes and elements are tagged. the tag allows to group nodes and
48 elements. A typical application is to mark surface elements on a
49 certain portion of the domain with the same tag. All these surface
50 elements can then assigned the same value eg. for the pressure. */
51
52 /* Thespacial dimension is determined by the type of elements
53 used. The spacial dimension should be accessed by the function
54 Dudley_Mesh_getDim. Notice that the element type also determines
55 the type of surface elements to be used. */
56
57 /**************************************************************/
58
59 #include "Dudley.h"
60 #include "NodeFile.h"
61 #include "ElementFile.h"
62 #include "TagMap.h"
63 #include "Util.h"
64 #include "paso/SystemMatrixPattern.h"
65 #include "escript/DataC.h"
66
67 #ifdef PASO_MPI
68 #include "paso/Paso_MPI.h"
69 #endif
70
71 /**************************************************************/
72
73 /* this struct holds a mesh: */
74
75 struct Dudley_Mesh {
76 char* Name; /* the name of the mesh */
77 dim_t reference_counter; /* counts the number of references to the mesh; */
78 dim_t approximationOrder;
79 dim_t reducedApproximationOrder;
80 dim_t integrationOrder;
81 dim_t reducedIntegrationOrder;
82 Dudley_NodeFile* Nodes; /* the table of the nodes */
83 Dudley_ElementFile* Elements; /* the table of the elements */
84 Dudley_ElementFile* FaceElements; /* the table of the face elements */
85 Dudley_ElementFile* Points; /* the table of points (treated as elements of dimension 0) */
86 Dudley_TagMap* TagMap; /* the tag map mapping names to tag keys */
87
88 /* pointer to the sparse matrix pattern */
89
90 Paso_SystemMatrixPattern *FullFullPattern;
91 Paso_SystemMatrixPattern *FullReducedPattern;
92 Paso_SystemMatrixPattern *ReducedFullPattern;
93 Paso_SystemMatrixPattern *ReducedReducedPattern;
94 Paso_MPIInfo *MPIInfo;
95 };
96
97 typedef struct Dudley_Mesh Dudley_Mesh;
98
99 /* these structures are used for matching surfaces elements: */
100
101 struct Dudley_Mesh_findMatchingFaces_center{
102 index_t refId;
103 double x[MAX_numDim];
104 };
105 typedef struct Dudley_Mesh_findMatchingFaces_center Dudley_Mesh_findMatchingFaces_center;
106
107 /**************************************************************/
108
109 /* interfaces: */
110 Dudley_Mesh* Dudley_Mesh_alloc(char* name,dim_t numDim, Paso_MPIInfo *mpi_info);
111 Dudley_Mesh* Dudley_Mesh_reference(Dudley_Mesh*);
112 dim_t Dudley_Mesh_getDim(Dudley_Mesh*);
113 void Dudley_Mesh_free(Dudley_Mesh*);
114
115 void Dudley_Mesh_addTagMap(Dudley_Mesh *mesh_p,const char* name, index_t tag_key);
116 index_t Dudley_Mesh_getTag(Dudley_Mesh *mesh_p,const char* name);
117 bool_t Dudley_Mesh_isValidTagName(Dudley_Mesh *mesh_p,const char* name);
118 void Dudley_Mesh_distributeByRankOfDOF(Dudley_Mesh* in, dim_t *distribution);
119 Paso_SystemMatrixPattern* Dudley_getPattern(Dudley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order);
120 Paso_SystemMatrixPattern* Dudley_makePattern(Dudley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order);
121 void Dudley_Mesh_write(Dudley_Mesh*,char*);
122 void Dudley_Mesh_dump(Dudley_Mesh *in,char* fname);
123 void Dudley_PrintMesh_Info(Dudley_Mesh *, bool_t);
124 Dudley_Mesh* Dudley_Mesh_load(char* fname);
125 Dudley_Mesh* Dudley_Mesh_read(char*,index_t, index_t, bool_t);
126 Dudley_Mesh* Dudley_Mesh_readGmsh(char*,index_t, index_t, index_t, bool_t, bool_t);
127 void Mesh_setOrders(Dudley_Mesh *in);
128
129 void Dudley_Mesh_setCoordinates(Dudley_Mesh*,escriptDataC*);
130 void Dudley_Mesh_setElements(Dudley_Mesh* self,Dudley_ElementFile *elements);
131 void Dudley_Mesh_setFaceElements(Dudley_Mesh* self,Dudley_ElementFile *elements);
132 void Dudley_Mesh_setPoints(Dudley_Mesh* self,Dudley_ElementFile *elements);
133
134 void Dudley_Mesh_optimizeDOFDistribution(Dudley_Mesh* in,dim_t *distribution);
135 void Dudley_Mesh_prepare(Dudley_Mesh* in, bool_t optimize);
136 void Dudley_Mesh_createColoring(Dudley_Mesh* in, index_t *node_localDOF_map);
137 void Dudley_Mesh_optimizeElementOrdering(Dudley_Mesh* in);
138 void Dudley_Mesh_resolveNodeIds(Dudley_Mesh*);
139 void Dudley_Mesh_createMappings(Dudley_Mesh* in, index_t *dof_distribution, index_t *node_distribution);
140 void Dudley_Mesh_createNodeFileMappings(Dudley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, 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,index_t lastDOF,Dudley_Mesh* in, bool_t useLinear);
142
143 void Dudley_Mesh_optimizeDOFLabeling(Dudley_Mesh*,dim_t *);
144
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,escriptDataC* *data_pp);
158 void Dudley_Mesh_optimizeNodeLabeling(Dudley_Mesh* mesh_p);
159 dim_t Dudley_Mesh_FindMinDegreeNode(Paso_SystemMatrixPattern* pattern_p,index_t* available,index_t indicator);
160 index_t Dudley_Mesh_getDegree(Paso_SystemMatrixPattern* pattern_p, index_t *label);
161
162 void Dudley_Mesh_saveVTK(const char * filename_p, Dudley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp, const char* metadata, const char*metadata_schema);
163 void Dudley_Mesh_setTagsInUse(Dudley_Mesh* in);
164
165 int Dudley_Mesh_getStatus(Dudley_Mesh* in);
166
167 #endif /* #ifndef INC_DUDLEY_MESH */
168

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26