00001 //*****************************************************************// 00002 // Albany 2.0: Copyright 2012 Sandia Corporation // 00003 // This Software is released under the BSD license detailed // 00004 // in the file "license.txt" in the top-level Albany directory // 00005 //*****************************************************************// 00006 00007 00008 #ifndef AADAPT_MESHADAPT_HPP 00009 #define AADAPT_MESHADAPT_HPP 00010 00011 #include "Teuchos_RCP.hpp" 00012 #include "Teuchos_ParameterList.hpp" 00013 00014 #include "AAdapt_AbstractAdapter.hpp" 00015 #include "AlbPUMI_FMDBMeshStruct.hpp" 00016 #include "AlbPUMI_AbstractPUMIDiscretization.hpp" 00017 00018 #include "Phalanx.hpp" 00019 #include "PHAL_Workset.hpp" 00020 #include "PHAL_Dimension.hpp" 00021 00022 #include "AAdapt_UnifSizeField.hpp" 00023 #include "AAdapt_UnifRefSizeField.hpp" 00024 #ifdef SCOREC_SPR 00025 #include "AAdapt_SPRSizeField.hpp" 00026 #endif 00027 00028 namespace AAdapt { 00029 00030 template<class SizeField> 00031 00032 class MeshAdapt : public AbstractAdapter { 00033 public: 00034 00035 MeshAdapt(const Teuchos::RCP<Teuchos::ParameterList>& params_, 00036 const Teuchos::RCP<ParamLib>& paramLib_, 00037 Albany::StateManager& StateMgr_, 00038 const Teuchos::RCP<const Epetra_Comm>& comm_); 00040 ~MeshAdapt(); 00041 00043 virtual bool queryAdaptationCriteria(); 00044 00046 // Solution is needed to calculate the size function 00047 virtual bool adaptMesh(const Epetra_Vector& solution, const Epetra_Vector& ovlp_solution); 00048 00050 virtual void solutionTransfer(const Epetra_Vector& oldSolution, 00051 Epetra_Vector& newSolution); 00052 00054 Teuchos::RCP<const Teuchos::ParameterList> getValidAdapterParameters() const; 00055 00056 Teuchos::RCP<Teuchos::Time> adaptTime; 00057 00058 private: 00059 00060 // Disallow copy and assignment 00061 MeshAdapt(const MeshAdapt&); 00062 MeshAdapt& operator=(const MeshAdapt&); 00063 00064 int numDim; 00065 int remeshFileIndex; 00066 00067 Teuchos::RCP<AlbPUMI::FMDBMeshStruct> fmdbMeshStruct; 00068 00069 Teuchos::RCP<Albany::AbstractDiscretization> disc; 00070 Teuchos::RCP<AlbPUMI::AbstractPUMIDiscretization> pumi_discretization; 00071 00072 apf::Mesh2* mesh; 00073 pMeshMdl pumiMesh; 00074 00075 int num_iterations; 00076 00077 const Epetra_Vector* solution; 00078 const Epetra_Vector* ovlp_solution; 00079 00080 static Teuchos::RCP<SizeField> szField; 00081 00082 void printElementData(); 00083 00084 void checkValidStateVariable(const std::string name); 00085 00086 std::string adaptation_method; 00087 std::string base_exo_filename; 00088 00089 bool loadBalancing; 00090 double lbMaxImbalance; 00091 00092 }; 00093 00094 } 00095 00096 // Define macros for explicit template instantiation 00097 #define MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_UNIF(name) \ 00098 template class name<AAdapt::UnifSizeField>; 00099 #define MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_UNIFREF(name) \ 00100 template class name<AAdapt::UnifRefSizeField>; 00101 00102 #ifdef SCOREC_SPR 00103 #define MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_SPR(name) \ 00104 template class name<AAdapt::SPRSizeField>; 00105 #endif 00106 00107 #ifdef SCOREC_SPR 00108 #define MESHADAPT_INSTANTIATE_TEMPLATE_CLASS(name) \ 00109 MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_UNIF(name) \ 00110 MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_UNIFREF(name) \ 00111 MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_SPR(name) 00112 #else 00113 #define MESHADAPT_INSTANTIATE_TEMPLATE_CLASS(name) \ 00114 MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_UNIF(name) \ 00115 MESHADAPT_INSTANTIATE_TEMPLATE_CLASS_UNIFREF(name) 00116 #endif 00117 00118 #endif //ALBANY_MESHADAPT_HPP