ESScript
Revision_4488
Main Page
Namespaces
Classes
Files
File List
File Members
finley
src
finley/src/Mesh.h
Go to the documentation of this file.
1
2
/*****************************************************************************
3
*
4
* Copyright (c) 2003-2013 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 __FINLEY_MESH_H__
17
#define __FINLEY_MESH_H__
18
19
/****************************************************************************
20
21
Finley: 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 in a Finley_NodeFile and elements in a
27
Finley_ElementFile. Four Finley_ElementFiles containing the elements
28
describe the domain, surface, contact and point sources, respectively.
29
Notice that the surface elements do not necessarily cover the entire
30
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 appears 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
Finley_NodeFile, see also Finley_resolveNodeIds.
39
40
In some cases it is useful to refer to a mesh entirely built from
41
order 1 (=linear) elements. The linear version of the mesh can be
42
accessed by referring 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 vector is introduced
45
in the Finley_NodeFile. This feature is not fully implemented
46
yet.
47
48
All nodes 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 be assigned the same value e.g. for the pressure.
52
53
The spatial dimension is determined by the type of elements
54
used. The spatial dimension should be accessed by the function
55
Finley_Mesh_getDim. Notice that the element type also determines
56
the type of surface elements to be used.
57
58
*****************************************************************************/
59
60
#include "
Finley.h
"
61
#include "
NodeFile.h
"
62
#include "
ElementFile.h
"
63
#include "
Util.h
"
64
#include "paso/SystemMatrixPattern.h"
65
66
#ifdef ESYS_MPI
67
#include "esysUtils/Esys_MPI.h"
68
#endif
69
70
#include <map>
71
#include <string>
72
73
namespace
escript {
74
class
Data;
75
}
76
77
namespace
finley {
78
typedef
std::map<std::string, int>
TagMap
;
79
}
80
81
using namespace
finley;
82
83
/****************************************************************************/
84
86
struct
Finley_Mesh
{
87
char
*
Name
;
// the name of the mesh
88
int
reference_counter
;
// counts the number of references to the mesh
89
int
approximationOrder
;
90
int
reducedApproximationOrder
;
91
int
integrationOrder
;
92
int
reducedIntegrationOrder
;
93
NodeFile
*
Nodes
;
// the table of the nodes
94
ElementFile
*
Elements
;
// the table of the elements
95
ElementFile
*
FaceElements
;
// the table of the face elements
96
ElementFile
*
ContactElements
;
// the table of the contact elements
97
ElementFile
*
Points
;
// the table of points (treated as elements of dimension 0)
98
TagMap
tagMap
;
// the tag map mapping names to tag keys
99
100
// pointer to the sparse matrix pattern
101
Paso_SystemMatrixPattern
*
FullFullPattern
;
102
Paso_SystemMatrixPattern
*
FullReducedPattern
;
103
Paso_SystemMatrixPattern
*
ReducedFullPattern
;
104
Paso_SystemMatrixPattern
*
ReducedReducedPattern
;
105
Esys_MPIInfo
*
MPIInfo
;
106
};
107
108
typedef
struct
Finley_Mesh
Finley_Mesh
;
109
110
// these structures are used for matching surface elements:
111
struct
Finley_Mesh_findMatchingFaces_center
{
112
int
refId
;
113
double
x[
MAX_numDim
];
114
};
115
typedef
struct
Finley_Mesh_findMatchingFaces_center
Finley_Mesh_findMatchingFaces_center
;
116
117
/****************************************************************************/
118
119
// interfaces:
120
Finley_Mesh
*
Finley_Mesh_alloc
(
char
* name,
int
numDim,
Esys_MPIInfo
*mpi_info);
121
Finley_Mesh
*
Finley_Mesh_reference
(
Finley_Mesh
*);
122
int
Finley_Mesh_getDim
(
Finley_Mesh
*);
123
void
Finley_Mesh_free
(
Finley_Mesh
*);
124
125
void
Finley_Mesh_addTagMap
(
Finley_Mesh
*mesh_p,
const
char
* name,
int
tag_key);
126
int
Finley_Mesh_getTag
(
Finley_Mesh
*mesh_p,
const
char
* name);
127
bool
Finley_Mesh_isValidTagName
(
Finley_Mesh
*mesh_p,
const
char
* name);
128
void
Finley_Mesh_distributeByRankOfDOF
(
Finley_Mesh
* in,
int
*distribution);
129
Paso_SystemMatrixPattern
*
Finley_getPattern
(
Finley_Mesh
*mesh,
bool_t
reduce_row_order,
bool_t
reduce_col_order);
130
Paso_SystemMatrixPattern
*
Finley_makePattern
(
Finley_Mesh
*mesh,
bool_t
reduce_row_order,
bool_t
reduce_col_order);
131
void
Finley_Mesh_write
(
Finley_Mesh
*,
const
char
*);
132
void
Finley_Mesh_dump
(
Finley_Mesh
*in,
char
* fname);
133
void
Finley_PrintMesh_Info
(
Finley_Mesh
*,
bool_t
);
134
Finley_Mesh
*
Finley_Mesh_load
(
char
* fname);
135
Finley_Mesh
*
Finley_Mesh_read
(
char
*,
int
,
int
,
bool_t
);
136
Finley_Mesh
*
Finley_Mesh_readGmsh
(
char
*,
int
,
int
,
int
,
bool_t
,
bool_t
);
137
void
Finley_Mesh_setOrders
(
Finley_Mesh
*in);
138
139
void
Finley_Mesh_setCoordinates
(
Finley_Mesh
*,
const
escript::Data
& newX);
140
void
Finley_Mesh_setElements
(
Finley_Mesh
*
self
,
ElementFile
*elements);
141
void
Finley_Mesh_setFaceElements
(
Finley_Mesh
*
self
,
ElementFile
*elements);
142
void
Finley_Mesh_setContactElements
(
Finley_Mesh
*
self
,
ElementFile
*elements);
143
void
Finley_Mesh_setPoints
(
Finley_Mesh
*
self
,
ElementFile
*elements);
144
145
void
Finley_Mesh_optimizeDOFDistribution
(
Finley_Mesh
* in,
int
*distribution);
146
void
Finley_Mesh_prepare
(
Finley_Mesh
* in,
bool_t
optimize);
147
void
Finley_Mesh_createColoring
(
Finley_Mesh
* in,
int
*node_localDOF_map);
148
void
Finley_Mesh_optimizeElementOrdering
(
Finley_Mesh
* in);
149
void
Finley_Mesh_resolveNodeIds
(
Finley_Mesh
*);
150
void
Finley_Mesh_createMappings
(
Finley_Mesh
* in,
int
*dof_distribution,
int
*node_distribution);
151
void
Finley_Mesh_createNodeFileMappings
(
Finley_Mesh
* in,
int
numReducedNodes,
int
* indexReducedNodes,
int
* dof_first_component,
int
* nodes_first_component);
152
void
Finley_Mesh_markDOFsConnectedToRange
(
int
* mask,
int
offset,
int
marker,
int
firstDOF,
int
lastDOF,
Finley_Mesh
* in,
bool_t
useLinear);
153
154
void
Finley_Mesh_optimizeDOFLabeling
(
Finley_Mesh
*,
int
*);
155
156
157
Finley_Mesh
*
Finley_Mesh_merge
(
int
,
Finley_Mesh
**);
158
159
void
Finley_Mesh_relableElementNodes
(
int
*,
int
,
Finley_Mesh
*);
160
void
Finley_Mesh_markNodes
(
int
*,
int
,
Finley_Mesh
*,
int
);
161
162
void
Finley_Mesh_glueFaces
(
Finley_Mesh
*
self
,
double
safety_factor,
double
tolerance,
bool_t
);
163
void
Finley_Mesh_joinFaces
(
Finley_Mesh
*
self
,
double
safety_factor,
double
tolerance,
bool_t
);
164
165
int
Finley_Mesh_findMatchingFaces_compar
(
const
void
*,
const
void
*);
166
void
Finley_Mesh_findMatchingFaces
(
finley::NodeFile
*,
ElementFile
*,
double
,
double
,
int
*,
int
*,
int
*,
int
*);
167
void
Finley_Mesh_print
(
Finley_Mesh
*in);
168
void
Finley_Mesh_optimizeNodeLabeling
(
Finley_Mesh
* mesh_p);
169
int
Finley_Mesh_FindMinDegreeNode
(
Paso_SystemMatrixPattern
* pattern_p,
int
* available,
int
indicator);
170
int
Finley_Mesh_getDegree
(
Paso_SystemMatrixPattern
* pattern_p,
int
*label);
171
172
void
Finley_Mesh_setTagsInUse
(
Finley_Mesh
* in);
173
int
Finley_Mesh_getStatus
(
Finley_Mesh
* in);
174
void
Finley_Mesh_addPoints
(
Finley_Mesh
* mesh,
const
int
numPoints,
const
double
*points_ptr,
const
int
*tags_ptr);
175
176
#endif // __FINLEY_MESH_H__
177
Generated on Fri Jun 28 2013 11:10:52 for ESScript by
1.8.1.2