00001
00002
00003
00004
00005
00006
00007 #ifndef ALBANY_GENERICSTKFIELDCONT_HPP
00008 #define ALBANY_GENERICSTKFIELDCONT_HPP
00009
00010 #include "Albany_AbstractSTKFieldContainer.hpp"
00011 #include "Teuchos_ParameterList.hpp"
00012
00013
00014
00015 #include <stk_mesh/base/Types.hpp>
00016 #include <stk_mesh/base/FieldData.hpp>
00017 #include <stk_mesh/fem/FEMMetaData.hpp>
00018
00019 #include <boost/utility.hpp>
00020 #include <boost/type_traits/is_same.hpp>
00021
00022
00023 namespace Albany {
00024
00025 template<bool Interleaved>
00026
00027 class GenericSTKFieldContainer : public AbstractSTKFieldContainer {
00028
00029 public:
00030
00031 GenericSTKFieldContainer(const Teuchos::RCP<Teuchos::ParameterList>& params_,
00032 stk::mesh::fem::FEMMetaData* metaData_,
00033 stk::mesh::BulkData* bulkData_,
00034 const int neq_,
00035 const int numDim_);
00036
00037 virtual ~GenericSTKFieldContainer();
00038
00039 protected:
00040
00041
00042 inline int getDOF(const int inode, const int eq) const {
00043 return inode + numNodes * eq;
00044 }
00045
00046
00047 void buildStateStructs(const Teuchos::RCP<Albany::StateInfoStruct>& sis);
00048
00049
00050
00051 template<class T>
00052 typename boost::disable_if< boost::is_same<T, ScalarFieldType>, void >::type
00053 fillVectorHelper(Epetra_Vector& soln,
00054 T* solution_field,
00055 const Teuchos::RCP<Epetra_Map>& node_map,
00056 const stk::mesh::Bucket& bucket, int offset);
00057
00058 void fillVectorHelper(Epetra_Vector& soln,
00059 ScalarFieldType* solution_field,
00060 const Teuchos::RCP<Epetra_Map>& node_map,
00061 const stk::mesh::Bucket& bucket, int offset);
00062
00063
00064 template<class T>
00065 typename boost::disable_if< boost::is_same<T, ScalarFieldType>, void >::type
00066 saveVectorHelper(const Epetra_Vector& soln,
00067 T* solution_field,
00068 const Teuchos::RCP<Epetra_Map>& node_map,
00069 const stk::mesh::Bucket& bucket, int offset);
00070
00071 void saveVectorHelper(const Epetra_Vector& soln,
00072 ScalarFieldType* solution_field,
00073 const Teuchos::RCP<Epetra_Map>& node_map,
00074 const stk::mesh::Bucket& bucket, int offset);
00075
00076
00077 template<class T>
00078 typename boost::disable_if< boost::is_same<T, ScalarFieldType>, void >::type
00079 copySTKField(const T* source, T* target);
00080
00081
00082 void copySTKField(const ScalarFieldType* source, ScalarFieldType* target);
00083
00084 stk::mesh::fem::FEMMetaData* metaData;
00085 stk::mesh::BulkData* bulkData;
00086 Teuchos::RCP<Teuchos::ParameterList> params;
00087
00088 int numNodes;
00089 int neq;
00090 int numDim;
00091
00092 };
00093
00094
00095 template<> inline int GenericSTKFieldContainer<true>::getDOF(const int inode, const int eq) const {
00096 return inode * neq + eq;
00097 }
00098
00099 }
00100
00101
00102
00103
00104 #define STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_CLASS_NONINTERLEAVED(name) \
00105 template class name<false>;
00106 #define STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_CLASS_INTERLEAVED(name) \
00107 template class name<true>;
00108 #define STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_SVH(class_name, value, arg_type) \
00109 template void class_name<value>::saveVectorHelper( \
00110 const Epetra_Vector &soln, \
00111 arg_type *solution_field, \
00112 const Teuchos::RCP<Epetra_Map>& node_map, \
00113 const stk::mesh::Bucket & bucket, int offset);
00114 #define STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_FVH(class_name, value, arg_type) \
00115 template void class_name<value>::fillVectorHelper( \
00116 Epetra_Vector &soln, \
00117 arg_type *solution_field, \
00118 const Teuchos::RCP<Epetra_Map>& node_map, \
00119 const stk::mesh::Bucket & bucket, int offset);
00120 #define STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_CSTKF(class_name, value, arg_type) \
00121 template void class_name<value>::copySTKField( \
00122 const arg_type *source_field, \
00123 arg_type *target_field);
00124
00125
00126 #define STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_CLASS(name) \
00127 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_CLASS_NONINTERLEAVED(name) \
00128 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_CLASS_INTERLEAVED(name) \
00129 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_SVH(name, true, AbstractSTKFieldContainer::VectorFieldType) \
00130 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_SVH(name, false, AbstractSTKFieldContainer::VectorFieldType) \
00131 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_FVH(name, true, AbstractSTKFieldContainer::VectorFieldType) \
00132 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_FVH(name, false, AbstractSTKFieldContainer::VectorFieldType) \
00133 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_CSTKF(name, true, AbstractSTKFieldContainer::VectorFieldType) \
00134 STKFIELDCONTAINER_INSTANTIATE_TEMPLATE_FUNCTION_CSTKF(name, false, AbstractSTKFieldContainer::VectorFieldType)
00135
00136
00137 #endif