1 |
/* |
2 |
****************************************************************************** |
3 |
* * |
4 |
* COPYRIGHT ACcESS 2003,2004,2005 - All Rights Reserved * |
5 |
* * |
6 |
* This software is the property of ACcESS. No part of this code * |
7 |
* may be copied in any form or by any means without the expressed written * |
8 |
* consent of ACcESS. Copying, use or modification of this software * |
9 |
* by any unauthorised person is illegal unless that person has a software * |
10 |
* license agreement with ACcESS. * |
11 |
* * |
12 |
****************************************************************************** |
13 |
*/ |
14 |
/* Version: $Id$ */ |
15 |
|
16 |
|
17 |
#ifndef INC_FINLEY_MESH |
18 |
#define INC_FINLEY_MESH |
19 |
|
20 |
/**************************************************************/ |
21 |
|
22 |
/* Finley: 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 Finley_NodeFile and elements in a |
28 |
Finley_ElementFile. A Finley_NodeFile and three Finley_ElementFile |
29 |
containing the elements describing the domain, surface and point |
30 |
sources respectively. Notice that the surface elements do not |
31 |
necessaryly 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 |
Finley_Node, see also Finley_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 Finley_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 |
Finley_Mesh_getDim. Notice that the element type also determines |
57 |
the type of surface elements to be used. */ |
58 |
|
59 |
/**************************************************************/ |
60 |
|
61 |
#include "Finley.h" |
62 |
#include "NodeFile.h" |
63 |
#include "ElementFile.h" |
64 |
#include "SystemMatrixPattern.h" |
65 |
#include "DataC.h" |
66 |
|
67 |
/**************************************************************/ |
68 |
|
69 |
/* this struct holds a mesh: */ |
70 |
|
71 |
struct Finley_Mesh { |
72 |
char* Name; /* the name of the mesh */ |
73 |
index_t order; /* integration order */ |
74 |
dim_t reference_counter; /* counts the number of references to the mesh; */ |
75 |
Finley_NodeFile* Nodes; /* the table of the nodes */ |
76 |
Finley_ElementFile* Elements; /* the table of the elements */ |
77 |
Finley_ElementFile* FaceElements; /* the table of the face elements */ |
78 |
Finley_ElementFile* ContactElements; /* the table of the contact elements */ |
79 |
Finley_ElementFile* Points; /* the table of points (treated as elements of dimension 0) */ |
80 |
|
81 |
/* pointer to the sparse matrix pattern */ |
82 |
|
83 |
Paso_SystemMatrixPattern *FullFullPattern; |
84 |
Paso_SystemMatrixPattern *FullReducedPattern; |
85 |
Paso_SystemMatrixPattern *ReducedFullPattern; |
86 |
Paso_SystemMatrixPattern *ReducedReducedPattern; |
87 |
}; |
88 |
|
89 |
typedef struct Finley_Mesh Finley_Mesh; |
90 |
|
91 |
/* these structures are used for matching surfaces elements: */ |
92 |
|
93 |
struct Finley_Mesh_findMatchingFaces_center{ |
94 |
index_t refId; |
95 |
double x[MAX_numDim]; |
96 |
}; |
97 |
typedef struct Finley_Mesh_findMatchingFaces_center Finley_Mesh_findMatchingFaces_center; |
98 |
|
99 |
/**************************************************************/ |
100 |
|
101 |
/* interfaces: */ |
102 |
|
103 |
Finley_Mesh* Finley_Mesh_alloc(char*,int,int); |
104 |
Finley_Mesh* Finley_Mesh_reference(Finley_Mesh*); |
105 |
void Finley_Mesh_dealloc(Finley_Mesh*); |
106 |
dim_t Finley_Mesh_getDim(Finley_Mesh*); |
107 |
dim_t Finley_Mesh_getNumNodes(Finley_Mesh*); |
108 |
dim_t Finley_Mesh_getNumDegreesOfFreedom(Finley_Mesh*); |
109 |
dim_t Finley_Mesh_getReducedNumDegreesOfFreedom(Finley_Mesh*); |
110 |
Paso_SystemMatrixPattern* Finley_getPattern(Finley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order); |
111 |
Paso_SystemMatrixPattern* Finley_makePattern(Finley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order); |
112 |
void Finley_Mesh_write(Finley_Mesh*,char*); |
113 |
Finley_Mesh* Finley_Mesh_read(char*,index_t); |
114 |
|
115 |
void Finley_Mesh_prepare(Finley_Mesh* in); |
116 |
void Finley_Mesh_prepareNodes(Finley_Mesh* in); |
117 |
void Finley_Mesh_improveColoring(Finley_Mesh* in); |
118 |
void Finley_Mesh_optimizeElementDistribution(Finley_Mesh* in); |
119 |
void Finley_Mesh_resolveNodeIds(Finley_Mesh*); |
120 |
Finley_Mesh* Finley_Mesh_merge(dim_t, Finley_Mesh**); |
121 |
|
122 |
void Finley_Mesh_relableElementNodes(int*,int,Finley_Mesh*); |
123 |
void Finley_Mesh_markNodes(int*,int,Finley_Mesh*,int); |
124 |
|
125 |
void Finley_Mesh_glueFaces(Finley_Mesh* self,double safety_factor,double tolerance); |
126 |
void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance); |
127 |
|
128 |
int Finley_Mesh_findMatchingFaces_compar(const void*,const void*); |
129 |
void Finley_Mesh_findMatchingFaces(Finley_NodeFile*,Finley_ElementFile *,double,double, int*, int*,int*,int*); |
130 |
void Finley_Mesh_print(Finley_Mesh *in); |
131 |
void Finley_Mesh_saveDX(const char * filename_p, Finley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp); |
132 |
void Finley_Mesh_saveVTK(const char * filename_p, Finley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp); |
133 |
|
134 |
#endif /* #ifndef INC_FINLEY_MESH */ |
135 |
|