1 #ifndef VERTEXCFD_EXTERNALFIELDSMANAGER_IMPL_HPP
2 #define VERTEXCFD_EXTERNALFIELDSMANAGER_IMPL_HPP
4 #include "VertexCFD_InitialConditionManager.hpp"
5 #include "VertexCFD_MeshManager.hpp"
6 #include "VertexCFD_PhysicsManager.hpp"
7 #include "parameters/VertexCFD_ParameterDatabase.hpp"
9 #include <Panzer_ReadOnlyVector_GlobalEvaluationData.hpp>
11 #include <Thyra_DefaultSpmdVector.hpp>
16 template<
class Traits>
17 template<
int NumSpaceDim>
18 ExternalFieldsManager<Traits>::ExternalFieldsManager(
19 const std::integral_constant<int, NumSpaceDim>& num_space_dim,
20 const Teuchos::RCP<
const Teuchos::MpiComm<int>>& comm,
21 const std::string& filename)
24 = Teuchos::rcp(
new Parameter::ParameterDatabase(comm, filename));
25 auto mesh_manager = Teuchos::rcp(
new MeshManager(*parameter_db, comm));
26 auto physics_manager = Teuchos::rcp(
27 new PhysicsManager(num_space_dim, parameter_db, mesh_manager));
28 physics_manager->setupModel();
30 _global_indexer = physics_manager->dofManager();
32 auto ic_manager = Teuchos::rcp(
33 new InitialConditionManager(parameter_db, mesh_manager));
34 Teuchos::RCP<Thyra::VectorBase<double>> solution;
35 Teuchos::RCP<Thyra::VectorBase<double>> solution_dot;
36 ic_manager->applyInitialConditions(
37 num_space_dim, *physics_manager, solution, solution_dot);
40 Teuchos::RCP<panzer::ReadOnlyVector_GlobalEvaluationData> ged;
41 ged = physics_manager->linearObjectFactory()->buildReadOnlyDomainContainer();
42 ged->setOwnedVector(solution);
45 ged->globalToGhost(0);
49 = Teuchos::rcp_dynamic_cast<const Thyra::SpmdVectorBase<double>>(
50 ged->getGhostedVector());
51 auto ghosted_data_host = ghosted_vector->getLocalSubVector();
56 _ghosted_field_data = Kokkos::View<double*, PHX::Device>(
57 "ghosted_field_data", ghosted_data_host.subDim());
58 auto ghost_mirror = Kokkos::create_mirror(_ghosted_field_data);
59 for (
int i = 0; i < ghosted_data_host.subDim(); ++i)
60 ghost_mirror(i) = ghosted_data_host[i];
61 Kokkos::deep_copy(_ghosted_field_data, ghost_mirror);
65 template<
class Traits>
66 Teuchos::RCP<const panzer::GlobalIndexer>
67 ExternalFieldsManager<Traits>::globalIndexer()
const
69 return _global_indexer;
73 template<
class Traits>
74 Kokkos::View<double*, PHX::Device>
75 ExternalFieldsManager<Traits>::ghostedFieldData()
const
77 return _ghosted_field_data;
84 #endif // end VERTEXCFD_EXTERNALFIELDSMANAGER_IMPL_HPP