NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
inputGen Class Referenceabstract

Detailed Description

Definition at line 47 of file inputGen.H.

Public Member Functions

 inputGen (jsoncons::json jsnStrm)
 
virtual ~inputGen ()
 
void _set_key (const std::string &key)
 
virtual void setNameType (const std::string &fname, inpFileType ftyp, const std::string &key=std::string())
 
virtual void setOrder (const std::vector< std::string > &ord, const std::string &key=std::string())
 
virtual std::vector< std::string > getOrder (const std::string &key=std::string())
 
virtual void pushOrder (const std::string &ord, const std::string &key=std::string())
 
virtual void setMsh (meshBase *mb, const std::string &key=std::string())
 
virtual void setCmntStr (const std::string &cmstr, const std::string &key=std::string())
 
virtual std::string getCmntStr (const std::string &key=std::string())
 
virtual void process ()=0
 
virtual void write (const std::string &key=std::string()) const
 
virtual void read (const std::string &fname)=0
 
virtual void close (const std::string &fname)=0
 
virtual void addNdeSet ()=0
 
virtual void addElmSet ()=0
 
virtual void addMat ()=0
 
virtual void addBC ()=0
 
virtual void addIC ()=0
 
virtual bool addMisc ()=0
 
virtual void wrtPre (const std::string &_tsk, const std::string &__tsk)=0
 
virtual void wrtCmnt (const std::string &cmnt)=0
 
virtual void wrtMsh (const std::string &_tsk, const std::string &__tsk)=0
 
virtual void wrtNdeCrds ()=0
 
virtual void wrtElmCon ()=0
 
virtual void wrtPost ()=0
 
virtual void wrtNdeSet ()=0
 
virtual void wrtElmSet ()=0
 
virtual void wrtMisc (const std::string &_tsk, const std::string &__tsk)=0
 
virtual void edit (const std::string &_tsk, const std::string &__tsk)=0
 

Protected Member Functions

virtual void _write (std::stringstream &ss)
 

Protected Attributes

jsoncons::json _jstrm
 
std::string _key
 
std::map< std::string, std::stringstream * > _inp
 
std::map< std::string, std::vector< meshBase * > > _mb
 
std::map< std::string, std::vector< std::string > > _ord
 
std::map< std::string, std::string > _fn
 
std::map< std::string, inpFileType_tpe
 
std::map< std::string, std::string > _cmnt
 

Constructor & Destructor Documentation

◆ inputGen()

inputGen::inputGen ( jsoncons::json  jsnStrm)
inlineexplicit

Definition at line 50 of file inputGen.H.

51  : _jstrm(std::move(jsnStrm)), _key("generic") {};
jsoncons::json _jstrm
Definition: inputGen.H:130
std::string _key
Definition: inputGen.H:134

◆ ~inputGen()

virtual inputGen::~inputGen ( )
inlinevirtual

Definition at line 53 of file inputGen.H.

53  {
54  for (auto &&inp : _inp)
55  delete inp.second;
56  }
std::map< std::string, std::stringstream * > _inp
Definition: inputGen.H:135

Member Function Documentation

◆ _set_key()

void inputGen::_set_key ( const std::string &  key)
inline

Definition at line 61 of file inputGen.H.

61 { _key = key; }
std::string _key
Definition: inputGen.H:134

◆ _write()

virtual void inputGen::_write ( std::stringstream &  ss)
inlineprotectedvirtual

Definition at line 116 of file inputGen.H.

117  {
118  auto key_it = _inp.find(_key);
119  if (key_it == _inp.end())
120  _inp.insert(
121  std::pair<std::string, std::stringstream *>(
122  _key,
123  new std::stringstream()
124  )
125  );
126 
127  *(_inp.at(_key)) << ss.str() << std::endl;
128  ss.clear();
129  ss.str(std::string());
130  };
std::string _key
Definition: inputGen.H:134
std::map< std::string, std::stringstream * > _inp
Definition: inputGen.H:135

◆ addBC()

virtual void inputGen::addBC ( )
pure virtual

◆ addElmSet()

virtual void inputGen::addElmSet ( )
pure virtual

◆ addIC()

virtual void inputGen::addIC ( )
pure virtual

◆ addMat()

virtual void inputGen::addMat ( )
pure virtual

◆ addMisc()

virtual bool inputGen::addMisc ( )
pure virtual

◆ addNdeSet()

virtual void inputGen::addNdeSet ( )
pure virtual

◆ close()

virtual void inputGen::close ( const std::string &  fname)
pure virtual

◆ edit()

virtual void inputGen::edit ( const std::string &  _tsk,
const std::string &  __tsk 
)
pure virtual

◆ getCmntStr()

std::string inputGen::getCmntStr ( const std::string &  key = std::string())
virtual

Definition at line 96 of file inputGen.C.

References _cmnt, and _key.

97 {
98  if (!key.empty())
99  _key = key;
100  return _cmnt[_key];
101 }
std::map< std::string, std::string > _cmnt
Definition: inputGen.H:140
std::string _key
Definition: inputGen.H:134

◆ getOrder()

std::vector< std::string > inputGen::getOrder ( const std::string &  key = std::string())
virtual

Definition at line 62 of file inputGen.C.

References _key, and _ord.

63 {
64  if (!key.empty())
65  _key = key;
66  return _ord[_key];
67 }
std::map< std::string, std::vector< std::string > > _ord
Definition: inputGen.H:137
std::string _key
Definition: inputGen.H:134

◆ process()

virtual void inputGen::process ( )
pure virtual

◆ pushOrder()

void inputGen::pushOrder ( const std::string &  ord,
const std::string &  key = std::string() 
)
virtual

Definition at line 70 of file inputGen.C.

References _key, _ord, and nemAux::toLower().

71 {
72  if (!key.empty())
73  _key = key;
74  std::string ord = __ord;
75  nemAux::toLower(ord);
76  _ord[_key].push_back(ord);
77 }
std::map< std::string, std::vector< std::string > > _ord
Definition: inputGen.H:137
void toLower(std::string &str)
std::string _key
Definition: inputGen.H:134

◆ read()

virtual void inputGen::read ( const std::string &  fname)
pure virtual

◆ setCmntStr()

void inputGen::setCmntStr ( const std::string &  cmstr,
const std::string &  key = std::string() 
)
virtual

Definition at line 88 of file inputGen.C.

References _cmnt, and _key.

89 {
90  if (!key.empty())
91  _key = key;
92  _cmnt[_key] = cmstr;
93 }
std::map< std::string, std::string > _cmnt
Definition: inputGen.H:140
std::string _key
Definition: inputGen.H:134

◆ setMsh()

void inputGen::setMsh ( meshBase mb,
const std::string &  key = std::string() 
)
virtual

Definition at line 80 of file inputGen.C.

References _key, and _mb.

81 {
82  if (!key.empty())
83  _key = key;
84  _mb[_key].push_back(mb);
85 }
std::map< std::string, std::vector< meshBase * > > _mb
Definition: inputGen.H:136
std::string _key
Definition: inputGen.H:134

◆ setNameType()

void inputGen::setNameType ( const std::string &  fname,
inpFileType  ftyp,
const std::string &  key = std::string() 
)
virtual

Definition at line 39 of file inputGen.C.

References _fn, _key, and _tpe.

42 {
43  if (!key.empty())
44  _key = key;
45  _fn[_key] = fname;
46  _tpe[_key] = ftyp;
47 }
std::map< std::string, inpFileType > _tpe
Definition: inputGen.H:139
std::map< std::string, std::string > _fn
Definition: inputGen.H:138
std::string _key
Definition: inputGen.H:134

◆ setOrder()

void inputGen::setOrder ( const std::vector< std::string > &  ord,
const std::string &  key = std::string() 
)
virtual

Definition at line 50 of file inputGen.C.

References _key, _ord, and nemAux::toLower().

52 {
53  if (!key.empty())
54  _key = key;
55  std::vector<std::string> ord = __ord;
56  for (auto &&it : ord)
57  nemAux::toLower(it);
58  _ord[_key].insert(_ord[_key].end(), ord.begin(), ord.end());
59 }
std::map< std::string, std::vector< std::string > > _ord
Definition: inputGen.H:137
void toLower(std::string &str)
std::string _key
Definition: inputGen.H:134

◆ write()

void inputGen::write ( const std::string &  key = std::string()) const
virtual

Definition at line 103 of file inputGen.C.

References _fn, and _inp.

104 {
105  bool onlyKey = false;
106  if (!key.empty())
107  onlyKey = true;
108  for (const auto &it : _inp)
109  {
110  if (onlyKey && it.first != key)
111  continue;
112 
113  std::string fname = _fn.at(it.first);
114  std::ofstream ofile;
115  ofile.open(fname);
116  if (!ofile.good())
117  {
118  std::cerr << "Error opening file " << fname << std::endl;
119  throw;
120  }
121  ofile << (it.second)->str();
122  ofile.close();
123  }
124 }
std::map< std::string, std::string > _fn
Definition: inputGen.H:138
std::map< std::string, std::stringstream * > _inp
Definition: inputGen.H:135

◆ wrtCmnt()

virtual void inputGen::wrtCmnt ( const std::string &  cmnt)
pure virtual

◆ wrtElmCon()

virtual void inputGen::wrtElmCon ( )
pure virtual

◆ wrtElmSet()

virtual void inputGen::wrtElmSet ( )
pure virtual

◆ wrtMisc()

virtual void inputGen::wrtMisc ( const std::string &  _tsk,
const std::string &  __tsk 
)
pure virtual

◆ wrtMsh()

virtual void inputGen::wrtMsh ( const std::string &  _tsk,
const std::string &  __tsk 
)
pure virtual

◆ wrtNdeCrds()

virtual void inputGen::wrtNdeCrds ( )
pure virtual

◆ wrtNdeSet()

virtual void inputGen::wrtNdeSet ( )
pure virtual

◆ wrtPost()

virtual void inputGen::wrtPost ( )
pure virtual

◆ wrtPre()

virtual void inputGen::wrtPre ( const std::string &  _tsk,
const std::string &  __tsk 
)
pure virtual

Member Data Documentation

◆ _cmnt

std::map<std::string, std::string> inputGen::_cmnt
protected

Definition at line 140 of file inputGen.H.

Referenced by getCmntStr(), and setCmntStr().

◆ _fn

std::map<std::string, std::string> inputGen::_fn
protected

Definition at line 138 of file inputGen.H.

Referenced by setNameType(), and write().

◆ _inp

std::map<std::string, std::stringstream *> inputGen::_inp
protected

Definition at line 135 of file inputGen.H.

Referenced by write().

◆ _jstrm

jsoncons::json inputGen::_jstrm
protected

Definition at line 130 of file inputGen.H.

◆ _key

std::string inputGen::_key
protected

Definition at line 134 of file inputGen.H.

Referenced by getCmntStr(), getOrder(), pushOrder(), setCmntStr(), setMsh(), setNameType(), and setOrder().

◆ _mb

std::map<std::string, std::vector<meshBase *> > inputGen::_mb
protected

Definition at line 136 of file inputGen.H.

Referenced by setMsh().

◆ _ord

std::map<std::string, std::vector<std::string> > inputGen::_ord
protected

Definition at line 137 of file inputGen.H.

Referenced by getOrder(), pushOrder(), and setOrder().

◆ _tpe

std::map<std::string, inpFileType> inputGen::_tpe
protected

Definition at line 139 of file inputGen.H.

Referenced by setNameType().


The documentation for this class was generated from the following files: