NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble_data_manager.h
Go to the documentation of this file.
1/*
2//@HEADER
3// ************************************************************************
4//
5// NimbleSM
6// Copyright 2018
7// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
8//
9// Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
10// retains certain rights in this software.
11//
12// Redistribution and use in source and binary forms, with or without
13// modification, are permitted provided that the following conditions are
14// met:
15//
16// 1. Redistributions of source code must retain the above copyright
17// notice, this list of conditions and the following disclaimer.
18//
19// 2. Redistributions in binary form must reproduce the above copyright
20// notice, this list of conditions and the following disclaimer in the
21// documentation and/or other materials provided with the distribution.
22//
23// 3. Neither the name of the Corporation nor the names of the
24// contributors may be used to endorse or promote products derived from
25// this software without specific prior written permission.
26//
27// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY EXPRESS OR IMPLIED
28// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
30// NO EVENT SHALL NTESS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
32// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact David Littlewood (djlittl@sandia.gov)
39//
40// ************************************************************************
41//@HEADER
42*/
43
44#ifndef NIMBLE_DATA_MANAGER_H
45#define NIMBLE_DATA_MANAGER_H
46
48#include "nimble_data_utils.h"
49#include "nimble_defs.h"
51#include "nimble_model_data.h"
52
53#ifdef NIMBLE_HAVE_DARMA
54#include "darma.h"
55#else
56#include <map>
57#include <string>
58#include <vector>
59#endif
60
61namespace nimble {
62
64class GenesisMesh;
65class ModelDataBase;
66class Parser;
68
70{
71 public:
72 /// \brief Constructor
73 ///
74 /// \param parser Reference to parser information
75 /// \param mesh Reference to mesh
76 ///
77 DataManager(const nimble::Parser& parser, const nimble::GenesisMesh& mesh);
78
79 /// \brief Destructor
80 ~DataManager() = default;
81
82#ifdef NIMBLE_HAVE_DARMA
83 template <typename ArchiveType>
84 void
85 serialize(ArchiveType& ar)
86 {
87 ar | model_data_;
88 }
89#endif
90
91 /// \brief Initialize the data for Exodus output
92 ///
93 /// \param filename File name for the output files
94 void
95 InitializeOutput(const std::string& filename);
96
97 /// \brief Return constant reference to parser information
98 ///
99 /// \return Reference to parser information
100 const nimble::Parser&
101 GetParser() const
102 {
103 return parser_;
104 }
105
106 /// \brief Return constant reference to mesh
107 ///
108 /// \return Reference to mesh
110 GetMesh() const
111 {
112 return mesh_;
113 }
114
115 /// \brief Return shared pointer to ModelData objet
116 ///
117 /// \return Shared pointer
118 std::shared_ptr<nimble::ModelDataBase>
120 {
121 return model_data_;
122 }
123
124 /// \brief Return a const reference to the field IDs
125 ///
126 /// \return Field IDs
127 const nimble::FieldIds&
129 {
130 return field_ids_;
131 }
132
133 /// \brief Return reference to the field IDs
134 ///
135 /// \return Field IDs
138 {
139 return field_ids_;
140 }
141
142 /// \brief Return shared pointer to VectorCommunicator objet
143 ///
144 /// \return Shared pointer
145 std::shared_ptr<nimble::VectorCommunicator>
150
151 /// \brief Write output of simulations
152 ///
153 /// \param[in] time_current Time value
154 void
155 WriteOutput(double time_current);
156
157 std::shared_ptr<nimble::ExodusOutput>
159 {
160 return exodus_output_;
161 }
162
163 /// \brief Set BlockMaterialInterfaceFactoryBase object and initialize
164 /// block data information.
165 ///
166 void
168 const std::shared_ptr<nimble::BlockMaterialInterfaceFactoryBase>& block_material_factory);
169
170 /// \brief Return shared pointer to BlockMaterialInterfaceFactoryBase object
171 ///
172 /// \return Shared pointer
173 const std::shared_ptr<nimble::BlockMaterialInterfaceFactoryBase>&
175
176 /// \brief Return shared pointer to BoundaryConditionManager object
177 ///
178 /// \return Shared pointer
179 std::shared_ptr<nimble::BoundaryConditionManager>
184
185 protected:
186 /// \brief Initialize data for simulation
187 void
188 Initialize();
189
190 protected:
193 std::shared_ptr<nimble::ModelDataBase> model_data_ = nullptr;
194
196
197 std::shared_ptr<nimble::VectorCommunicator> vector_communicator_ = nullptr;
198 std::shared_ptr<nimble::ExodusOutput> exodus_output_ = nullptr;
199
200 std::shared_ptr<nimble::BlockMaterialInterfaceFactoryBase> block_material_factory_ = nullptr;
201
202 std::shared_ptr<nimble::BoundaryConditionManager> boundary_condition_ = nullptr;
203};
204
205} // namespace nimble
206
207#endif
Definition nimble_boundary_condition_manager.h:60
~DataManager()=default
Destructor.
DataManager(const nimble::Parser &parser, const nimble::GenesisMesh &mesh)
Constructor.
Definition nimble_data_manager.cc:69
const nimble::Parser & parser_
Definition nimble_data_manager.h:191
void SetBlockMaterialInterfaceFactory(const std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > &block_material_factory)
Set BlockMaterialInterfaceFactoryBase object and initialize block data information.
Definition nimble_data_manager.cc:186
nimble::FieldIds & GetFieldIDs()
Return reference to the field IDs.
Definition nimble_data_manager.h:137
std::shared_ptr< nimble::BoundaryConditionManager > GetBoundaryConditionManager()
Return shared pointer to BoundaryConditionManager object.
Definition nimble_data_manager.h:180
std::shared_ptr< nimble::ModelDataBase > model_data_
Definition nimble_data_manager.h:193
const std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > & GetBlockMaterialInterfaceFactory() const
Return shared pointer to BlockMaterialInterfaceFactoryBase object.
Definition nimble_data_manager.cc:193
void Initialize()
Initialize data for simulation.
Definition nimble_data_manager.cc:81
void InitializeOutput(const std::string &filename)
Initialize the data for Exodus output.
Definition nimble_data_manager.cc:162
const nimble::Parser & GetParser() const
Return constant reference to parser information.
Definition nimble_data_manager.h:101
std::shared_ptr< nimble::BlockMaterialInterfaceFactoryBase > block_material_factory_
Definition nimble_data_manager.h:200
std::shared_ptr< nimble::ModelDataBase > GetModelData()
Return shared pointer to ModelData objet.
Definition nimble_data_manager.h:119
std::shared_ptr< nimble::ExodusOutput > exodus_output_
Definition nimble_data_manager.h:198
std::shared_ptr< nimble::ExodusOutput > GetExodusOutput()
Definition nimble_data_manager.h:158
const nimble::GenesisMesh & mesh_
Definition nimble_data_manager.h:192
nimble::FieldIds field_ids_
Definition nimble_data_manager.h:195
const nimble::GenesisMesh & GetMesh() const
Return constant reference to mesh.
Definition nimble_data_manager.h:110
std::shared_ptr< nimble::VectorCommunicator > vector_communicator_
Definition nimble_data_manager.h:197
void WriteOutput(double time_current)
Write output of simulations.
Definition nimble_data_manager.cc:180
std::shared_ptr< nimble::VectorCommunicator > GetVectorCommunicator()
Return shared pointer to VectorCommunicator objet.
Definition nimble_data_manager.h:146
const nimble::FieldIds & GetFieldIDs() const
Return a const reference to the field IDs.
Definition nimble_data_manager.h:128
std::shared_ptr< nimble::BoundaryConditionManager > boundary_condition_
Definition nimble_data_manager.h:202
Definition nimble_genesis_mesh.h:59
Definition nimble_model_data_base.h:88
Definition nimble_parser.h:107
Definition nimble_vector_communicator.h:74
Definition kokkos_contact_manager.h:49
Definition nimble_model_data_base.h:66