1 |
jgs |
150 |
/* |
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 |
jgs |
82 |
|
16 |
jgs |
150 |
|
17 |
jgs |
82 |
#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 |
jgs |
150 |
#include "Finley.h" |
62 |
jgs |
82 |
#include "NodeFile.h" |
63 |
|
|
#include "ElementFile.h" |
64 |
jgs |
467 |
#include "SystemMatrixPattern.h" |
65 |
jgs |
474 |
#include "DataC.h" |
66 |
jgs |
82 |
|
67 |
|
|
/**************************************************************/ |
68 |
|
|
|
69 |
|
|
/* this struct holds a mesh: */ |
70 |
|
|
|
71 |
|
|
struct Finley_Mesh { |
72 |
|
|
char* Name; /* the name of the mesh */ |
73 |
jgs |
123 |
index_t order; /* integration order */ |
74 |
|
|
dim_t reference_counter; /* counts the number of references to the mesh; */ |
75 |
jgs |
82 |
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 |
jgs |
102 |
|
81 |
|
|
/* pointer to the sparse matrix pattern */ |
82 |
|
|
|
83 |
jgs |
150 |
Paso_SystemMatrixPattern *FullFullPattern; |
84 |
|
|
Paso_SystemMatrixPattern *FullReducedPattern; |
85 |
|
|
Paso_SystemMatrixPattern *ReducedFullPattern; |
86 |
|
|
Paso_SystemMatrixPattern *ReducedReducedPattern; |
87 |
jgs |
82 |
}; |
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 |
jgs |
123 |
index_t refId; |
95 |
jgs |
82 |
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 |
jgs |
102 |
Finley_Mesh* Finley_Mesh_reference(Finley_Mesh*); |
105 |
jgs |
82 |
void Finley_Mesh_dealloc(Finley_Mesh*); |
106 |
jgs |
123 |
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 |
jgs |
150 |
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 |
jgs |
82 |
void Finley_Mesh_write(Finley_Mesh*,char*); |
113 |
jgs |
123 |
Finley_Mesh* Finley_Mesh_read(char*,index_t); |
114 |
gross |
532 |
void Finley_Mesh_setCoordinates(Finley_Mesh*,escriptDataC*); |
115 |
jgs |
82 |
|
116 |
|
|
void Finley_Mesh_prepare(Finley_Mesh* in); |
117 |
|
|
void Finley_Mesh_prepareNodes(Finley_Mesh* in); |
118 |
|
|
void Finley_Mesh_improveColoring(Finley_Mesh* in); |
119 |
|
|
void Finley_Mesh_optimizeElementDistribution(Finley_Mesh* in); |
120 |
|
|
void Finley_Mesh_resolveNodeIds(Finley_Mesh*); |
121 |
jgs |
123 |
Finley_Mesh* Finley_Mesh_merge(dim_t, Finley_Mesh**); |
122 |
jgs |
82 |
|
123 |
|
|
void Finley_Mesh_relableElementNodes(int*,int,Finley_Mesh*); |
124 |
|
|
void Finley_Mesh_markNodes(int*,int,Finley_Mesh*,int); |
125 |
|
|
|
126 |
|
|
void Finley_Mesh_glueFaces(Finley_Mesh* self,double safety_factor,double tolerance); |
127 |
|
|
void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance); |
128 |
|
|
|
129 |
|
|
int Finley_Mesh_findMatchingFaces_compar(const void*,const void*); |
130 |
|
|
void Finley_Mesh_findMatchingFaces(Finley_NodeFile*,Finley_ElementFile *,double,double, int*, int*,int*,int*); |
131 |
|
|
void Finley_Mesh_print(Finley_Mesh *in); |
132 |
jgs |
153 |
void Finley_Mesh_saveDX(const char * filename_p, Finley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp); |
133 |
|
|
void Finley_Mesh_saveVTK(const char * filename_p, Finley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp); |
134 |
jgs |
82 |
|
135 |
|
|
#endif /* #ifndef INC_FINLEY_MESH */ |
136 |
jgs |
123 |
|