00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef INC_FINLEY_MESH
00016 #define INC_FINLEY_MESH
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #include "Finley.h"
00060 #include "NodeFile.h"
00061 #include "ElementFile.h"
00062 #include "TagMap.h"
00063 #include "Util.h"
00064 #include "paso/SystemMatrixPattern.h"
00065 #include "escript/DataC.h"
00066
00067 #ifdef ESYS_MPI
00068 #include "esysUtils/Esys_MPI.h"
00069 #endif
00070
00071
00072
00073
00074
00075 struct Finley_Mesh {
00076 char* Name;
00077 dim_t reference_counter;
00078 dim_t approximationOrder;
00079 dim_t reducedApproximationOrder;
00080 dim_t integrationOrder;
00081 dim_t reducedIntegrationOrder;
00082 Finley_NodeFile* Nodes;
00083 Finley_ElementFile* Elements;
00084 Finley_ElementFile* FaceElements;
00085 Finley_ElementFile* ContactElements;
00086 Finley_ElementFile* Points;
00087 Finley_TagMap* TagMap;
00088
00089
00090
00091 Paso_SystemMatrixPattern *FullFullPattern;
00092 Paso_SystemMatrixPattern *FullReducedPattern;
00093 Paso_SystemMatrixPattern *ReducedFullPattern;
00094 Paso_SystemMatrixPattern *ReducedReducedPattern;
00095 Esys_MPIInfo *MPIInfo;
00096 };
00097
00098 typedef struct Finley_Mesh Finley_Mesh;
00099
00100
00101
00102 struct Finley_Mesh_findMatchingFaces_center{
00103 index_t refId;
00104 double x[MAX_numDim];
00105 };
00106 typedef struct Finley_Mesh_findMatchingFaces_center Finley_Mesh_findMatchingFaces_center;
00107
00108
00109
00110
00111 Finley_Mesh* Finley_Mesh_alloc(char* name,dim_t numDim, Esys_MPIInfo *mpi_info);
00112 Finley_Mesh* Finley_Mesh_reference(Finley_Mesh*);
00113 dim_t Finley_Mesh_getDim(Finley_Mesh*);
00114 void Finley_Mesh_free(Finley_Mesh*);
00115
00116 void Finley_Mesh_addTagMap(Finley_Mesh *mesh_p,const char* name, index_t tag_key);
00117 index_t Finley_Mesh_getTag(Finley_Mesh *mesh_p,const char* name);
00118 bool_t Finley_Mesh_isValidTagName(Finley_Mesh *mesh_p,const char* name);
00119 void Finley_Mesh_distributeByRankOfDOF(Finley_Mesh* in, dim_t *distribution);
00120 Paso_SystemMatrixPattern* Finley_getPattern(Finley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order);
00121 Paso_SystemMatrixPattern* Finley_makePattern(Finley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order);
00122 void Finley_Mesh_write(Finley_Mesh*,char*);
00123 void Finley_Mesh_dump(Finley_Mesh *in,char* fname);
00124 void Finley_PrintMesh_Info(Finley_Mesh *, bool_t);
00125 Finley_Mesh* Finley_Mesh_load(char* fname);
00126 Finley_Mesh* Finley_Mesh_read(char*,index_t, index_t, bool_t);
00127 Finley_Mesh* Finley_Mesh_readGmsh(char*,index_t, index_t, index_t, bool_t, bool_t);
00128 void Finley_Mesh_setOrders(Finley_Mesh *in);
00129
00130 void Finley_Mesh_setCoordinates(Finley_Mesh*,escriptDataC*);
00131 void Finley_Mesh_setElements(Finley_Mesh* self,Finley_ElementFile *elements);
00132 void Finley_Mesh_setFaceElements(Finley_Mesh* self,Finley_ElementFile *elements);
00133 void Finley_Mesh_setContactElements(Finley_Mesh* self,Finley_ElementFile *elements);
00134 void Finley_Mesh_setPoints(Finley_Mesh* self,Finley_ElementFile *elements);
00135
00136 void Finley_Mesh_optimizeDOFDistribution(Finley_Mesh* in,dim_t *distribution);
00137 void Finley_Mesh_prepare(Finley_Mesh* in, bool_t optimize);
00138 void Finley_Mesh_createColoring(Finley_Mesh* in, index_t *node_localDOF_map);
00139 void Finley_Mesh_optimizeElementOrdering(Finley_Mesh* in);
00140 void Finley_Mesh_resolveNodeIds(Finley_Mesh*);
00141 void Finley_Mesh_createMappings(Finley_Mesh* in, index_t *dof_distribution, index_t *node_distribution);
00142 void Finley_Mesh_createNodeFileMappings(Finley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, index_t* dof_first_component, index_t* nodes_first_component);
00143 void Finley_Mesh_markDOFsConnectedToRange(index_t* mask, index_t offset, index_t marker,index_t firstDOF,index_t lastDOF,Finley_Mesh* in, bool_t useLinear);
00144
00145 void Finley_Mesh_optimizeDOFLabeling(Finley_Mesh*,dim_t *);
00146
00147
00148 Finley_Mesh* Finley_Mesh_merge(dim_t, Finley_Mesh**);
00149
00150 void Finley_Mesh_relableElementNodes(int*,int,Finley_Mesh*);
00151 void Finley_Mesh_markNodes(int*,int,Finley_Mesh*,int);
00152
00153 void Finley_Mesh_glueFaces(Finley_Mesh* self,double safety_factor,double tolerance, bool_t);
00154 void Finley_Mesh_joinFaces(Finley_Mesh* self,double safety_factor,double tolerance, bool_t);
00155
00156 int Finley_Mesh_findMatchingFaces_compar(const void*,const void*);
00157 void Finley_Mesh_findMatchingFaces(Finley_NodeFile*,Finley_ElementFile *,double,double, int*, int*,int*,int*);
00158 void Finley_Mesh_print(Finley_Mesh *in);
00159 void Finley_Mesh_saveDX(const char * filename_p, Finley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp);
00160 void Finley_Mesh_optimizeNodeLabeling(Finley_Mesh* mesh_p);
00161 dim_t Finley_Mesh_FindMinDegreeNode(Paso_SystemMatrixPattern* pattern_p,index_t* available,index_t indicator);
00162 index_t Finley_Mesh_getDegree(Paso_SystemMatrixPattern* pattern_p, index_t *label);
00163
00164 void Finley_Mesh_saveVTK(const char * filename_p, Finley_Mesh *mesh_p, const dim_t num_data,char* *names_p,escriptDataC* *data_pp, const char* metadata, const char*metadata_schema);
00165 void Finley_Mesh_setTagsInUse(Finley_Mesh* in);
00166
00167 int Finley_Mesh_getStatus(Finley_Mesh* in);
00168 void Finley_Mesh_addPoints(Finley_Mesh* mesh, const dim_t numPoints, const double *points_ptr, const index_t *tags_ptr);
00169
00170 #endif
00171