00001 #include "fem_adapt_if.h"
00002
00003
00004 void FEM_ADAPT_Init(int meshID) {
00005 const int triangleFaces[6] = {0,1,1,2,2,0};
00006 FEM_Add_elem2face_tuples(meshID, 0, 2, 3, triangleFaces);
00007 FEM_Mesh_create_elem_elem_adjacency(meshID);
00008 FEM_Mesh_create_node_elem_adjacency(meshID);
00009 FEM_Mesh_create_node_node_adjacency(meshID);
00010 _registerFEMMeshModify();
00011 FEM_REF_INIT(meshID, 2);
00012 FEM_Mesh *meshP = FEM_Mesh_lookup(meshID, "FEM_ADAPT_Init");
00013 CtvInitialize(FEM_Adapt_Algs *, _adaptAlgs);
00014 CtvAccess(_adaptAlgs) = meshP->getfmMM()->getfmAdaptAlgs();
00015 CtvAccess(_adaptAlgs)->FEM_Adapt_Algs_Init(FEM_DATA+0, FEM_BOUNDARY);
00016 }
00017 FLINKAGE void FTN_NAME(FEM_ADAPT_INIT,fem_adapt_init)(int *meshID)
00018 {
00019 FEM_ADAPT_Init(*meshID);
00020 }
00021
00022
00023 void FEM_ADAPT_Refine(int meshID, int qm, int method, double factor,
00024 double *sizes) {
00025 FEM_Mesh* mesh = FEM_Mesh_lookup(meshID, "FEM_ADAPT_Refine");
00026 mesh->getfmMM()->getfmAdaptAlgs()->FEM_Refine(qm, method, factor, sizes);
00027 }
00028 FLINKAGE void FTN_NAME(FEM_ADAPT_REFINE,fem_adapt_refine)(int* meshID,
00029 int *qm, int *method, double *factor, double *sizes)
00030 {
00031 FEM_ADAPT_Refine(*meshID, *qm, *method, *factor, sizes);
00032 }
00033
00034
00035 void FEM_ADAPT_Coarsen(int meshID, int qm, int method, double factor,
00036 double *sizes) {
00037 FEM_Mesh* mesh = FEM_Mesh_lookup(meshID, "FEM_ADAPT_Coarsen");
00038 mesh->getfmMM()->getfmAdaptAlgs()->FEM_Coarsen(qm, method, factor, sizes);
00039 }
00040 FLINKAGE void FTN_NAME(FEM_ADAPT_COARSEN,fem_adapt_coarsen)(int* meshID,
00041 int *qm, int *method, double *factor, double *sizes)
00042 {
00043 FEM_ADAPT_Coarsen(*meshID, *qm, *method, *factor, sizes);
00044 }
00045
00046 void FEM_ADAPT_AdaptMesh(int meshID, int qm, int method, double factor,
00047 double *sizes) {
00048 FEM_Mesh* mesh = FEM_Mesh_lookup(meshID, "FEM_ADAPT_AdaptMesh");
00049 mesh->getfmMM()->getfmAdaptAlgs()->FEM_AdaptMesh(qm, method, factor, sizes);
00050 }
00051 FLINKAGE void FTN_NAME(FEM_ADAPT_ADAPTMESH,fem_adapt_adaptmesh)(int* meshID,
00052 int *qm, int *method, double *factor, double *sizes)
00053 {
00054 FEM_ADAPT_AdaptMesh(*meshID, *qm, *method, *factor, sizes);
00055 }
00056
00057
00058 void FEM_ADAPT_SetElementSizeField(int meshID, int elem, double size) {
00059 FEM_Mesh *meshP = FEM_Mesh_lookup(meshID, "FEM_ADAPT_SetElementSizeField");
00060 meshP->elem[0].setMeshSizing(elem, size);
00061 }
00062 FLINKAGE void FTN_NAME(FEM_ADAPT_SETELEMENTSIZEFIELD,fem_adapt_setelementsizefield)(int *meshID, int *elem, double *size)
00063 {
00064 FEM_ADAPT_SetElementSizeField(*meshID, *elem, *size);
00065 }
00066
00067
00068 void FEM_ADAPT_SetElementsSizeField(int meshID, double *sizes) {
00069 FEM_Mesh *meshP = FEM_Mesh_lookup(meshID, "FEM_ADAPT_SetElementsSizeField");
00070 int numElements = meshP->elem[0].size();
00071 for (int i=0; i<numElements; i++) {
00072 meshP->elem[0].setMeshSizing(i, sizes[i]);
00073 }
00074 }
00075 FLINKAGE void FTN_NAME(FEM_ADAPT_SETELEMENTSSIZEFIELD,fem_adapt_setelementssizefield)(int *meshID, double *sizes)
00076 {
00077 FEM_ADAPT_SetElementsSizeField(*meshID, sizes);
00078 }
00079
00080
00081 void FEM_ADAPT_SetReferenceMesh(int meshID) {
00082 FEM_Mesh* mesh = FEM_Mesh_lookup(meshID, "FEM_ADAPT_SetReferenceMesh");
00083 mesh->getfmMM()->getfmAdaptAlgs()->SetReferenceMesh();
00084 }
00085 FLINKAGE void FTN_NAME(FEM_ADAPT_SETREFERENCEMESH, fem_adapt_setreferencemesh)(int* meshID)
00086 {
00087 FEM_ADAPT_SetReferenceMesh(*meshID);
00088 }
00089
00090
00091 void FEM_ADAPT_GradateMesh(int meshID, double smoothness)
00092 {
00093 FEM_Mesh* mesh = FEM_Mesh_lookup(meshID, "FEM_ADAPT_GradateMesh");
00094 mesh->getfmMM()->getfmAdaptAlgs()->GradateMesh(smoothness);
00095 }
00096 FLINKAGE void FTN_NAME(FEM_ADAPT_GRADATEMESH, fem_adapt_gradatemesh)(int* meshID, double* smoothness)
00097 {
00098 FEM_ADAPT_GradateMesh(*meshID, *smoothness);
00099 }
00100