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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6009 - (show annotations)
Wed Mar 2 04:13:26 2016 UTC (3 years, 1 month ago) by caltinay
File MIME type: text/plain
File size: 7610 byte(s)
Much needed sync with trunk...

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26