00001 #ifndef _APPROX_MODULE_H_ 00002 #define _APPROX_MODULE_H_ 00003 00004 #include "../../include/mod_fem_viewer.h" 00005 00006 #if defined(__cplusplus) 00007 extern "C" { 00008 #endif 00009 00010 #define APC_MAX_NUM_FIELD 10 00011 00012 #ifdef WIN32 00013 # ifndef fun_call 00014 # define fun_call _fastcall 00015 # endif 00016 # ifndef std_call 00017 # define std_call _stdcall 00018 # endif 00019 #else 00020 # define fun_call 00021 # define std_call 00022 #endif 00023 00024 00025 typedef enum { 00026 APR_NONE = 0x0, 00027 APR_MESH = 0x1, 00028 APR_DG_PRSIM = 0x2, 00029 APR_STD_PRISM = 0x4, 00030 APR_STD_HYBRID = 0x8, 00031 } apr_type; 00032 00033 enum mod_approx 00034 { 00035 approx_dg_std_int, 00036 approx_dg_ext, 00037 approx_std_ext, 00038 approx_std_hibrid_ext, 00039 }; 00040 00041 00042 /*** FUNCTIONS DECLARATIONS - headers for internal functions ***/ 00043 00044 /* init - function for checking module's presentation */ 00045 int init_approx_modules(); 00046 00047 /* destroy - function to destroying manager and do cleanup */ 00048 void destroy(); 00049 00050 /* set_approx - set current approximation */ 00051 int set_approx_module(apr_type type); 00052 00053 /* init_mesh - Function to init mesh */ 00054 int init_mesh(int Control, char * Filename); 00055 00056 /* free_mesh - release mesh */ 00057 int free_mesh(int Mesh_id); 00058 00059 int fun_call get_nmno(int Mesh_id); 00060 00061 int fun_call get_nmed(int Mesh_id); 00062 00063 int fun_call get_nmfa(int Mesh_id); 00064 00065 int fun_call get_nmel(int Mesh_id); 00066 00067 int fun_call get_next_act_elem(int Mesh_id,int El); 00068 00069 int fun_call get_next_elem(int Mesh_id,int El); 00070 00071 int fun_call get_next_face(int Mesh_id,int Fa); 00072 00073 int fun_call get_next_edge(int Mesh_id,int Ed); 00074 int fun_call get_next_node(int Mesh_id,int Node); 00075 int fun_call get_el_status(int Mesh_id,int el); 00076 int fun_call get_el_type(int Mesh_id,int El); 00077 int fun_call get_el_mate(int Mesh_id,int El); 00078 int fun_call get_el_faces(int Mesh_id,int El,int* Faces, int* Orient); 00079 int fun_call get_el_fam(int Mesh_id,int El,int* Elsons,int* Type); 00080 int fun_call get_el_struct(int Mesh_id,int El_id,int *El_struct); 00081 00082 int fun_call get_el_node_coor(int Mesh_id,int El,int *Nodes,double *Xcoor); 00083 00084 int fun_call get_fa_status(int Mesh_id,int Fa); 00085 int fun_call get_fa_type(int Mesh_id,int Fa); 00086 int fun_call get_fa_sub_bnd(int Mesh_id,int Fa); 00087 int fun_call get_fa_node_coor(int Mesh_id,int Fa,int* Nodes,double* Coords); 00088 void fun_call get_fa_neig(int Mesh_id, int Fa, int* Fa_neig, 00089 int* Neig_sides, int* Node_shift, int* Diff_gen, 00090 double* Acceff, double* Bcceff); 00091 00092 int fun_call get_face_edges(int Mesh_id,int Fa,int *Edges,int *Orient); 00093 00094 int fun_call get_face_struct(int Mesh_id,int fa,int *Fa_struct); 00095 int fun_call get_edge_status(int Mesh_id,int Ed); 00096 int fun_call get_edge_nodes(int Mesh_id,int Ed,int *Ed_nodes); 00097 int fun_call get_edge_struct(int Mesh_id,int Ed,int *Ed_struct); 00098 int fun_call get_node_status(int Mesh_id,int Node); 00099 int fun_call get_node_coor(int Mesh_id,int Node,double *Coor); 00100 00101 int std_call init_field(char Field_type,int Mesh_id,const char *Filename); 00102 int free_field(int Field_id); 00103 00104 int fun_call get_nreq(int Field_id); 00105 00106 int fun_call get_nr_sol(int Field_id); 00107 00108 int fun_call get_base_type(int Field_id); 00109 00110 int fun_call get_el_pdeg(int Field_id,int El,int* Pdeg_vec); 00111 00112 /*------------------------------------------------------------ 00113 get_element_dofs - to return the list of standard dofs for a given element 00114 each dof corresponds to a standard shape function 00115 ------------------------------------------------------------*/ 00116 int fun_call get_element_dofs( /* returns: >0 - the number of dofs 00117 <0 - error code */ 00118 int Field_id, /* in: approximation field ID */ 00119 int El_id, /* in: element ID */ 00120 int Vect_id, /* in: vector ID in case of multiple solution vectors */ 00121 double *El_dofs_std /* out: the list of values of element dofs */ 00122 ); 00123 00124 /*--------------------------------------------------------- 00125 apr_select_field - to sel ect the proper field 00126 ---------------------------------------------------------*/ 00127 //apt_field_dg* apr_select_field_dg( /* returns: pointer to the selected field */ 00128 // int Field_id /* in: field ID */ 00129 // ); 00130 00131 /*--------------------------------------------------------- 00132 apr_select_field - to select the proper field 00133 ---------------------------------------------------------*/ 00134 //apt_field_std* apr_select_field_std( /* returns: pointer to the selected field */ 00135 // int Field_id /* in: field ID */ 00136 // ); 00137 00138 /*------------------------------------------------------------ 00139 create_constr_data - to create and fill constraint arrays 00140 (assuming approximation and mesh data agree) 00141 ------------------------------------------------------------*/ 00142 int fun_call create_constr_data( /* returns: >=0 - success code, <0 - error code */ 00143 int Field_id /* in: approximation field ID */ 00144 ); 00145 00146 00147 00148 /*------------------------------------------------------------ 00149 apr_get_constr_data - to return constraints data for a node (dof entity) 00150 ------------------------------------------------------------*/ 00151 //int apr_get_constr_data( 00152 // /* returns: >=0 - success code, <0 - error code */ 00153 // int Field_id, /* in: approximation field ID */ 00154 // int Nvert, /* in: vertex (i.e. node, i.e. dof entity) ID */ 00155 // int *Constr /* out: table with constraints data; */ 00156 // /* constr[0] - number of constraints (2 - mid-edge node, 4 - mid-side node */ 00157 // ); 00158 00159 /*------------------------------------------------------------ 00160 apr_get_el_constr_data - to return the number and the list of element's real 00161 nodes, with the corresponding constraint coefficients 00162 ------------------------------------------------------------*/ 00163 //int apr_get_el_constr_data( 00164 // /* returns: >=0 - success code, <0 - error code */ 00165 // int Field_id, /* in: approximation field ID */ 00166 // int El_id, /* in: element ID */ 00167 // int* Nodes, /* out: list of vertex node IDs */ 00168 // /* (Nodes[0] - number of nodes) */ 00169 // int* Nr_constr, /* out: list with the numbers of constraints for each vertex*/ 00170 // int* Constr_id, /* out: ID's of parent (constraining) nodes */ 00171 // double* Constr_val /* out: the corresponding constraint coefficients */ 00172 // ); 00173 00174 /*------------------------------------------------------------------ 00175 apr_elem_calc_3D - to perform element calculations (to provide data on 00176 coordinates, solution, shape functions, etc. for a given point 00177 inside element (given local coordinates Eta[i]); 00178 for geometrically multi-linear or linear 3D elements 00179 -------------------------------------------------------------------*/ 00180 double apr_elem_calc_3D_mod( 00181 /* returns: Jacobian determinant at a point, either for */ 00182 /* volume integration if Vec_norm==NULL, */ 00183 /* or for surface integration otherwise */ 00184 int Control, /* in: control parameter (what to compute): */ 00185 /* 1 - shape functions and values */ 00186 /* 2 - derivatives and jacobian */ 00187 /* >2 - computations on the (Control-2)-th */ 00188 /* element's face */ 00189 int Nreq, /* in: number of equations */ 00190 int *Pdeg_vec, /* in: element degree of polynomial */ 00191 int Base_type, /* in: type of basis functions: */ 00192 /* 1 (APC_TENSOR) - tensor product */ 00193 /* 2 (APC_COMPLETE) - complete polynomials */ 00194 double *Eta, /* in: local coordinates of the input point */ 00195 double *Node_coor, /* in: array of coordinates of vertices of element */ 00196 double *Sol_dofs, /* in: array of element' dofs */ 00197 double *Base_phi, /* out: basis functions */ 00198 double *Base_dphix, /* out: x-derivatives of basis functions */ 00199 double *Base_dphiy, /* out: y-derivatives of basis functions */ 00200 double *Base_dphiz, /* out: z-derivatives of basis functions */ 00201 double *Xcoor, /* out: global coordinates of the point*/ 00202 double *Sol, /* out: solution at the point */ 00203 double *Dsolx, /* out: derivatives of solution at the point */ 00204 double *Dsoly, /* out: derivatives of solution at the point */ 00205 double *Dsolz, /* out: derivatives of solution at the point */ 00206 double *Vec_nor /* out: outward unit vector normal to the face */ 00207 ); 00208 00209 00210 00211 00212 #if defined(__cplusplus) 00213 } 00214 #endif 00215 00216 #endif /* _APPROX_MANAGER_H_ 00217 */