00001 /* File: fem_interpolate.h 00002 * Authors: Terry Wilmarth, Nilesh Choudhury 00003 * 00004 */ 00005 00006 // This is an interface for specifying solution transfer operations 00007 // for small mesh modification operations. It provides overridable 00008 // defaults for node and element interpolations. These functions are passed to 00009 // FEM_add_element and FEM_add_node operations, along with a simple argument 00010 // struct - TLW 00011 00012 #ifndef __CHARM_FEM_INTERPOLATE_H 00013 #define __CHARM_FEM_INTERPOLATE_H 00014 00015 #include "charm-api.h" 00016 #include "ckvector3d.h" 00017 #include "fem.h" 00018 #include "fem_mesh.h" 00019 00020 class femMeshModify; 00021 00022 class FEM_Interpolate { 00023 FEM_Mesh *theMesh; 00024 femMeshModify *theMod; 00025 public: 00026 typedef struct { 00027 int n; 00028 int nodes[8]; 00029 int dim; 00030 int nNbrs; 00031 double coord[3]; 00032 double frac; 00033 bool addNode; 00034 } NodalArgs; 00035 00036 typedef struct { 00037 int e; 00038 int oldElement; 00039 int elType; 00040 } ElementArgs; 00041 00042 typedef void (* FEM_InterpolateNodeFn)(NodalArgs, FEM_Mesh *); 00043 typedef void (* FEM_InterpolateElementFn)(ElementArgs); 00044 00045 FEM_InterpolateNodeFn nodeEdgeFnPtr, nodeFaceFnPtr, nodeElementFnPtr, nodeCopyFnPtr; 00046 FEM_InterpolateElementFn elemCopyFnPtr, elemNodeFnPtr; 00047 00049 FEM_Interpolate() { 00050 nodeEdgeFnPtr = nodeFaceFnPtr = nodeElementFnPtr = nodeCopyFnPtr = NULL; 00051 elemCopyFnPtr = elemNodeFnPtr = NULL; 00052 } 00053 00054 FEM_Interpolate(FEM_Mesh *m) { 00055 nodeEdgeFnPtr = nodeFaceFnPtr = nodeElementFnPtr = nodeCopyFnPtr = NULL; 00056 elemCopyFnPtr = elemNodeFnPtr = NULL; 00057 theMesh = m; 00058 } 00059 00060 FEM_Interpolate(FEM_Mesh *m, femMeshModify *fm) { 00061 nodeEdgeFnPtr = nodeFaceFnPtr = nodeElementFnPtr = nodeCopyFnPtr = NULL; 00062 elemCopyFnPtr = elemNodeFnPtr = NULL; 00063 theMesh = m; 00064 theMod = fm; 00065 } 00066 00067 void FEM_InterpolateSetMesh(FEM_Mesh *m) { theMesh = m; } 00068 00069 // Methods to set and reset interpolate functions on the fly; these will be 00070 // used to override defaults by Fortan code, and can also be set and reset 00071 // for using temporary special-purpose interpolation functions 00072 void FEM_SetInterpolateNodeEdgeFnPtr(FEM_InterpolateNodeFn fnPtr) { 00073 nodeEdgeFnPtr = fnPtr; 00074 } 00075 void FEM_SetInterpolateNodeFaceFnPtr(FEM_InterpolateNodeFn fnPtr) { 00076 nodeFaceFnPtr = fnPtr; 00077 } 00078 void FEM_SetInterpolateNodeElementFnPtr(FEM_InterpolateNodeFn fnPtr) { 00079 nodeElementFnPtr = fnPtr; 00080 } 00081 void FEM_SetInterpolateElementCopyFnPtr(FEM_InterpolateElementFn fnPtr) { 00082 elemCopyFnPtr = fnPtr; 00083 } 00084 void FEM_SetInterpolateElementNodeFnPtr(FEM_InterpolateElementFn fnPtr) { 00085 elemNodeFnPtr = fnPtr; 00086 } 00087 void FEM_SetInterpolateCopyAttributesFnPtr(FEM_InterpolateNodeFn fnPtr) { 00088 nodeCopyFnPtr = fnPtr; 00089 } 00090 void FEM_ResetInterpolateNodeEdgeFnPtr() { nodeEdgeFnPtr = NULL; } 00091 void FEM_ResetInterpolateNodeFaceFnPtr() { nodeFaceFnPtr = NULL; } 00092 void FEM_ResetInterpolateNodeElementFnPtr() { nodeElementFnPtr = NULL; } 00093 void FEM_ResetInterpolateElementCopyFnPtr() { elemCopyFnPtr = NULL; } 00094 void FEM_ResetInterpolateElementNodeFnPtr() { elemNodeFnPtr = NULL; } 00095 void FEM_ReetInterpolateCopyAttributesFnPtr() { nodeCopyFnPtr = NULL; } 00096 00097 // Nodal data 00099 00103 virtual void FEM_InterpolateNodeOnEdge(NodalArgs args); 00105 00107 virtual void FEM_InterpolateNodeOnFace(NodalArgs args); 00109 00111 virtual void FEM_InterpolateNodeInElement(NodalArgs args); 00112 00113 // Element data 00115 00118 virtual void FEM_InterpolateElementCopy(ElementArgs args); 00120 00123 virtual void FEM_InterpolateElementFromNodes(ElementArgs args); 00124 00125 // Utility 00127 00129 virtual void FEM_InterpolateElementToNodes(int e); 00130 00131 //node data 00132 virtual void FEM_InterpolateCopyAttributes(int oldnode, int newnode); 00133 }; 00134 00135 #endif