PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2026 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE)
9 */
10
11#ifndef INP_INPUT_H
12#define INP_INPUT_H
13
14#include "deckIncludes.h"
15#include "util/json.h"
16#include <string>
17#include <vector>
18#include <memory>
19
35namespace inp {
36
37// // forward declarations of decks
38// struct MaterialDeck;
39// struct MeshDeck;
40// struct ModelDeck;
41// struct OutputDeck;
42// struct RestartDeck;
43// struct ParticleDeck;
44// struct ParticleZone;
45// struct WallZone;
46// struct Zone;
47// struct ContactDeck;
48// struct ContactPairDeck;
49// struct TestDeck;
50
64class Input {
65
66public:
71 explicit Input(const json &j = json({}));
72
82 std::shared_ptr<inp::ModelDeck> getModelDeck() {return d_modelDeck_p;};
83
88 std::shared_ptr<inp::OutputDeck> getOutputDeck() {return d_outputDeck_p;};
89
94 std::shared_ptr<inp::RestartDeck> getRestartDeck() {return d_restartDeck_p;};
95
100 std::shared_ptr<inp::ParticleDeck> getParticleDeck() {return d_particleDeck_p;};
101
102 std::shared_ptr<inp::TestDeck> getTestDeck() {return d_testDeck_p;};
103
104 std::shared_ptr<inp::BCDeck> getBCDeck() {return d_bcDeck_p;};
105
110 bool isMultiParticle() {return d_modelDeck_p->d_particleSimType == "Multi_Particle";};
111
116 bool isPeriDEM() {
117 if (d_modelDeck_p->d_particleSimType == "Multi_Particle" or
118 d_modelDeck_p->d_particleSimType == "Single_Particle")
119 return true;
120
121 return false;
122 };
123
131 std::string printStr(int nt = 0, int lvl = 0) const {
132 auto tabS = util::io::getTabS(nt);
133 std::ostringstream oss;
134 oss << tabS << "------- Input --------" << std::endl << std::endl;
135 oss << tabS << "Particle sim type = " << d_modelDeck_p->d_particleSimType << std::endl;
136 oss << tabS << d_modelDeck_p->printStr(nt+1, lvl) << std::endl;
137 oss << tabS << d_outputDeck_p->printStr(nt+1, lvl) << std::endl;
138 oss << tabS << d_restartDeck_p->printStr(nt+1, lvl) << std::endl;
139 oss << tabS << d_testDeck_p->printStr(nt+1, lvl) << std::endl;
140 oss << tabS << d_bcDeck_p->printStr(nt+1, lvl) << std::endl;
141 oss << tabS << d_particleDeck_p->printStr(nt+1, lvl) << std::endl;
142 return oss.str();
143 }
144
151 void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); }
160 std::shared_ptr<inp::ModelDeck> d_modelDeck_p;
161
163 std::shared_ptr<inp::OutputDeck> d_outputDeck_p;
164
166 std::shared_ptr<inp::RestartDeck> d_restartDeck_p;
167
169 std::shared_ptr<inp::TestDeck> d_testDeck_p;
170
172 std::shared_ptr<inp::BCDeck> d_bcDeck_p;
173
175 std::shared_ptr<inp::ParticleDeck> d_particleDeck_p;
177};
178
181} // namespace inp
182
183#endif // INP_INPUT_H
A class to read input file.
Definition input.h:64
std::shared_ptr< inp::ParticleDeck > getParticleDeck()
Get the pointer to particle deck.
Definition input.h:100
std::shared_ptr< inp::ParticleDeck > d_particleDeck_p
Pointer to deck holding particle related data.
Definition input.h:175
std::shared_ptr< inp::TestDeck > d_testDeck_p
Test deck.
Definition input.h:169
std::shared_ptr< inp::ModelDeck > getModelDeck()
Get the pointer to model deck.
Definition input.h:82
std::shared_ptr< inp::RestartDeck > d_restartDeck_p
Pointer to deck holding restart related data.
Definition input.h:166
void print(int nt=0, int lvl=0) const
Prints the information about the object.
Definition input.h:151
std::shared_ptr< inp::BCDeck > d_bcDeck_p
Boundary condition deck.
Definition input.h:172
std::shared_ptr< inp::OutputDeck > d_outputDeck_p
Pointer to deck holding output related data.
Definition input.h:163
std::shared_ptr< inp::TestDeck > getTestDeck()
Get the pointer to model deck.
Definition input.h:102
std::shared_ptr< inp::BCDeck > getBCDeck()
Get the pointer to model deck.
Definition input.h:104
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.
Definition input.h:131
bool isMultiParticle()
Get particle simulation type.
Definition input.h:110
std::shared_ptr< inp::RestartDeck > getRestartDeck()
Get the pointer to restart deck.
Definition input.h:94
std::shared_ptr< inp::ModelDeck > d_modelDeck_p
Pointer to deck holding problem related data.
Definition input.h:160
bool isPeriDEM()
Specify if PeriDEM model should be run.
Definition input.h:116
std::shared_ptr< inp::OutputDeck > getOutputDeck()
Get the pointer to output deck.
Definition input.h:88
nlohmann::ordered_json json
Collection of methods and database related to input.
Definition pairForce.h:20
std::string getTabS(int nt)
Returns tab spaces of a given size.
Definition io.h:82