Parfis  v0.0.7
datastruct.h
Go to the documentation of this file.
1 #ifndef PARFIS_DATASTRUCT_H
2 #define PARFIS_DATASTRUCT_H
3 
9 #include <iostream>
10 #include <string>
11 #include <map>
12 #include <unordered_map>
13 #include <list>
14 #include <vector>
15 #include <math.h>
16 #include <functional>
17 #include <memory>
18 #include <random>
19 
21 #if defined(PARFIS_LOG_LEVEL)
22 #define LOG_LEVEL PARFIS_LOG_LEVEL
23 #else
24 #define LOG_LEVEL 0
25 #endif
26 
32 #if LOG_LEVEL > 0
34 #define LOG(logger, level, msg) {Logger::log(logger, level, msg);}
35 #else
36 #define LOG(logger, level, msg) {}
37 #endif // LOG_LEVEL
38 
40 #if defined(STATE_TYPE_DOUBLE)
42 #define STATE_TYPE double
43 #else
44 #define STATE_TYPE float
45 #endif
46 
47 namespace parfis {
48 
52  typedef uint32_t cellId_t;
54  typedef uint32_t stateId_t;
56  typedef uint16_t cellPos_t;
58  typedef uint8_t nodeFlag_t;
60  typedef uint8_t stateFlag_t;
62  typedef std::mt19937_64 randEngine_t;
63 
64  struct StateFlag {
65  constexpr static stateFlag_t None = 0;
66  constexpr static stateFlag_t PushedState = 1;
67  };
68 
69  struct NodeFlag {
70  constexpr static nodeFlag_t InsideGeo = 0b11111111;
71  constexpr static nodeFlag_t NegZBound = 0b11110000;
72  constexpr static nodeFlag_t PosZBound = 0b00001111;
73  };
74 
86  enum struct LogMask: uint32_t {
88  None = 0b0,
90  Error = 0b1,
92  Warning = 0b10,
94  Memory = 0b100,
96  Info = 0b1000
97  };
98 
102  struct Logger
103  {
104  Logger(): m_fname(""), m_str(""){};
105 
107  std::string m_str;
109  std::string m_fname;
110 
111  void initialize(const std::string& fname);
112  void logToStr(LogMask mask, const std::string& msg);
113  void printLogFile();
114  static std::string getLogFileName(uint32_t id, uint32_t cnt);
123  static void log(Logger& logger, LogMask mask, const std::string& msg) {
124  if (LOG_LEVEL > 0) {
125  if(uint32_t(mask) & LOG_LEVEL) logger.logToStr(mask, msg);
126  }
127  }
128  };
141  template <class T>
142  struct Vec3D
143  {
145  T x;
147  T y;
149  T z;
150 
154  friend bool operator==(const Vec3D<T>& lhs, const Vec3D<T>& rhs) {
155  return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);
156  }
157 
161  friend bool operator!=(const Vec3D<T>& lhs, const Vec3D<T>& rhs) {
162  return (lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != rhs.z);
163  }
164 
172  friend std::ostream& operator<<(std::ostream& os, const Vec3D<T>& vec) {
173  os << '[' << vec.x << ", " << vec.y << ", " << vec.z << ']';
174  return os;
175  }
176 
181  T len() const { return sqrt(x * x + y * y + z * z); }
182 
187  T lenSq() const { return x * x + y * y + z * z; }
188  };
189 
191  {
192  static std::vector<const char *> pyStrVec;
193  };
194 
199  template <class T>
200  struct PyVec
201  {
202  const T* ptr;
203  size_t size;
204 
205  PyVec<T>& operator=(const std::vector<T>& tVec) {
206  size = tVec.size();
207  if (size > 0)
208  ptr = &tVec[0];
209  return *this;
210  }
211  };
212 
219  template<>
220  struct PyVec<std::string>
221  {
222  const char ** ptr;
223  size_t size;
224 
225  PyVec<std::string>& operator=(const std::vector<std::string>& strVec) {
226  bool init = true;
227  for (auto & str: strVec) {
228  PyVecContainer::pyStrVec.push_back(str.c_str());
229  if (init) {
230  ptr = &PyVecContainer::pyStrVec.back();
231  size = strVec.size();
232  init = false;
233  }
234  }
235  return *this;
236  }
237  };
238 
245  inline double xyDistSq(Vec3D<double>& a, Vec3D<double>& b) {
246  return (a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y);
247  };
248 
280  struct Cell
281  {
284  };
285 
291  struct State
292  {
301  };
302 
306  struct Specie
307  {
309  uint32_t id;
311  const char * name;
319  double dt;
321  double idt;
323  double maxVel;
325  double maxEv;
331  double qm;
333  double amuMass;
335  double mass;
337  int eCharge;
339  double charge;
341  uint32_t stateCount;
343  size_t headIdOffset;
349  std::vector<uint32_t> gasCollisionVecId;
352  };
353 
357  struct Gas
358  {
360  uint32_t id;
362  const char* name;
364  double amuMass;
368  double temperature;
370  double molDensity;
371  };
372 
377  struct FuncTable
378  {
380  int type;
383  int colCnt;
385  int rowCnt;
387  std::vector<double> ranges;
389  std::vector<int> nbins;
391  std::vector<double> idx;
393  std::vector<double> xVec;
395  std::vector<double> yVec;
397  std::function<double(double)> eval;
398  int loadData(const std::string& fileName);
399  };
400 
406  struct PyFuncTable
407  {
409  int type;
411  int colCnt;
413  int rowCnt;
426  type = ftab.type;
427  rowCnt = ftab.rowCnt;
428  colCnt = ftab.colCnt;
429  ranges = ftab.ranges;
430  nbins = ftab.nbins;
431  idx = ftab.idx;
432  xVec = ftab.xVec;
433  yVec = ftab.yVec;
434  return *this;
435  }
436  };
437 
442  {
444  uint32_t id;
446  const char* name;
448  const char* fileName;
450  uint32_t specieId;
452  uint32_t gasId;
454  double threshold;
456  int type;
458  std::vector<double> scatterAngle;
463  int calculateColFreq(const Specie & specie, const Gas& gas);
464  };
465 
471  {
473  uint32_t id;
475  const char* name;
477  const char* fileName;
479  uint32_t specieId;
481  uint32_t gasId;
483  double threshold;
485  int type;
494  id = gasCol.id;
495  name = gasCol.name;
496  fileName = gasCol.fileName;
497  specieId = gasCol.specieId;
498  gasId = gasCol.gasId;
499  threshold = gasCol.threshold;
500  type = gasCol.type;
501  scatterAngle = gasCol.scatterAngle;
502  xSecFtab = gasCol.xSecFtab;
503  freqFtab = gasCol.freqFtab;
504  return *this;
505  }
506  };
507 
508 
513  struct Field
514  {
523  };
524 
528  struct PyCfgData
529  {
530  int geometry;
531  double timestep;
532  Vec3D<double>* geometrySize;
533  Vec3D<double>* cellSize;
534  Vec3D<int>* periodicBoundary;
535  Vec3D<int>* cellCount;
536  PyVec<std::string> specieNameVec;
537  PyVec<std::string> gasNameVec;
538  PyVec<std::string> gasCollisionNameVec;
539  PyVec<std::string> gasCollisionFileNameVec;
540  };
541 
545  struct CfgData {
547  int geometry;
549  double timestep;
559  std::vector<std::string> specieNameVec;
561  std::vector<std::string> gasNameVec;
563  std::vector<std::string> gasCollisionNameVec;
565  std::vector<std::string> gasCollisionFileNameVec;
570  return cellCount.z * (cellCount.y * cellPos.x + cellPos.y ) + cellPos.z;
571  };
573  int setPyCfgData();
574  };
575 
580  struct PySimData
581  {
582  PyVec<State> stateVec;
583  PyVec<cellId_t> cellIdVec;
584  PyVec<cellId_t> cellIdAVec;
585  PyVec<cellId_t> cellIdBVec;
586  PyVec<Specie> specieVec;
587  PyVec<Cell> cellVec;
588  PyVec<nodeFlag_t> nodeFlagVec;
589  PyVec<stateId_t> headIdVec;
590  PyVec<Gas> gasVec;
591  PyVec<PyGasCollision> pyGasCollisionVec;
592  PyVec<PyFuncTable> pyGasCollisionProbVec;
593  };
594 
598  struct SimData {
600  std::vector<Cell> cellVec;
606  std::vector<nodeFlag_t> nodeFlagVec;
608  std::vector<cellId_t> cellIdVec;
615  std::vector<cellId_t> cellIdAVec;
617  std::vector<cellId_t> cellIdBVec;
619  std::vector<State> stateVec;
621  std::vector<stateFlag_t> stateFlagVec;
629  std::vector<stateId_t> headIdVec;
631  std::vector<Specie> specieVec;
633  std::vector<Gas> gasVec;
635  std::vector<randEngine_t> randomEngineVec;
637  std::vector<GasCollision> gasCollisionVec;
639  std::vector<PyGasCollision> pyGasCollisionVec;
641  std::vector<FuncTable> gasCollisionProbVec;
643  std::vector<PyFuncTable> pyGasCollisionProbVec;
649  uint64_t evolveCnt;
650  int setPySimData();
651  int calculateColProb(const CfgData * pCfgData);
652  };
661  struct Command
662  {
663  Command(std::string name = "") :
664  m_name(name), m_funcName(""), m_func(nullptr), m_pNext(nullptr) {}
665 
667  std::string m_name;
668 
670  std::string m_funcName;
671 
673  std::function<int()> m_func;
674 
677 
679  void setNext(Command& comRef) { m_pNext = &comRef; }
680 
682  Command* getNext() { return m_pNext; };
683  };
684 
688  struct CommandChain : public Command
689  {
691  std::map<std::string, std::unique_ptr<Command>> m_cmdMap;
692  };
693 
704  struct ParamBase
705  {
706  std::string m_name;
707  std::string m_type;
708  size_t m_size;
709  ParamBase* m_parent;
710  std::string getValueString(bool printType=false);
712  std::map<std::string, std::unique_ptr<ParamBase>> m_childMap;
713  template<class S>
714  void addChild(const std::string& name);
715  static void setValueVec(ParamBase* ppb, const std::string& valstr);
716  };
717 
723  template<class T>
724  struct Param : public ParamBase
725  {
726  Param();
728  std::vector<T> m_valueVec;
729  void setValueVec(const std::string& valstr);
730  };
731 
732  template<>
733  inline Param<double>::Param() { m_type = "double"; }
734 
735  template<>
736  inline Param<int>::Param() { m_type = "int"; }
737 
738  template<>
739  inline Param<std::string>::Param() { m_type = "std::string"; }
740 
741 
749  struct Domain: public Param<std::string> {
750  Domain() = default;
751  Domain(const std::string& dname, Logger& logger, CfgData& cfgData, SimData& simData,
752  std::map<std::string, std::unique_ptr<CommandChain>>& cmdChainMap)
753  : m_pLogger(&logger), m_pCfgData(&cfgData), m_pSimData(&simData),
754  m_pCmdChainMap(&cmdChainMap) { m_name = dname; };
755  Domain(const Domain&) = default;
756  Domain& operator=(const Domain&) = default;
757  virtual ~Domain() = default;
758 
759  parfis::Param<std::string>* getParent(const std::string& cstr);
760  int initialize(const std::string& cstr);
761  int configure(const std::string& cstr);
762  virtual int loadCfgData() = 0;
763  virtual int loadSimData() = 0;
764 
765  static std::unique_ptr<Domain> generateDomain(const std::string& dname, Logger& logger,
766  CfgData& cfgData, SimData& simData,
767  std::map<std::string, std::unique_ptr<CommandChain>>& cmdChainMap);
768 
769  template<class T>
770  int getParamToValue(const std::string& key, T& valRef);
771 
772  template<class T>
773  void getParamToVector(const std::string& key, std::vector<T>& vecRef);
774 
782  std::map<std::string, std::unique_ptr<CommandChain>>* m_pCmdChainMap;
783  };
785 }
786 
787 #endif // PARFIS_DATASTRUCT_H
parfis::SimData::setPySimData
int setPySimData()
Sets the PySimData pointers to coresponding references from SimData.
Definition: datastruct.cpp:255
parfis::Specie::velInitDistMin
Vec3D< double > velInitDistMin
Minimal velocity value for initial distribution.
Definition: datastruct.h:327
parfis::State::pos
Vec3D< state_t > pos
Position vector.
Definition: datastruct.h:298
parfis::PyGasCollision::specieId
uint32_t specieId
Id from the specie vector.
Definition: datastruct.h:479
parfis::PyGasCollision::name
const char * name
Collision name.
Definition: datastruct.h:475
parfis::NodeFlag
Definition: datastruct.h:69
parfis::PyFuncTable
Wrapper for the FuncTable structure to be used by ctypes in python.
Definition: datastruct.h:406
parfis::Specie::stateCount
uint32_t stateCount
Number of states;.
Definition: datastruct.h:341
parfis::SimData::gasVec
std::vector< Gas > gasVec
Vector of gases.
Definition: datastruct.h:633
parfis::randEngine_t
std::mt19937_64 randEngine_t
Type for random generator engine.
Definition: datastruct.h:62
parfis::CfgData::getAbsoluteCellId
cellId_t getAbsoluteCellId(Vec3D< cellPos_t > &cellPos)
Get absolute cell id from i,j,k.
Definition: datastruct.h:569
parfis::Gas::temperature
double temperature
Temperature in K.
Definition: datastruct.h:368
parfis::Specie::gasCollisionProbId
uint32_t gasCollisionProbId
Id for the total collision probability matrix, from gasCollisionProbVec.
Definition: datastruct.h:351
parfis::Logger::initialize
void initialize(const std::string &fname)
Initializes log string and file name.
Definition: datastruct.cpp:484
parfis::FuncTable::yVec
std::vector< double > yVec
Y values.
Definition: datastruct.h:395
parfis::FuncTable::colCnt
int colCnt
Definition: datastruct.h:383
parfis::Specie::randomSeed
int randomSeed
Seed for random engine.
Definition: datastruct.h:347
parfis::SimData::randomEngineVec
std::vector< randEngine_t > randomEngineVec
Engines used to generate random numbers.
Definition: datastruct.h:635
parfis::PyGasCollision::gasId
uint32_t gasId
Id from the gas vector.
Definition: datastruct.h:481
parfis::Gas::molDensity
double molDensity
Mol density mol/m^3.
Definition: datastruct.h:370
parfis::Field
Holds data about the electromagnetic field.
Definition: datastruct.h:513
parfis::Domain::m_pSimData
SimData * m_pSimData
Pointer to simulation data.
Definition: datastruct.h:780
parfis::GasCollision::calculateColFreq
int calculateColFreq(const Specie &specie, const Gas &gas)
Calculates the collision frequency.
Definition: datastruct.cpp:368
parfis::PyGasCollision::xSecFtab
PyFuncTable xSecFtab
Cross section in angstroms, with x-axis is in eV.
Definition: datastruct.h:489
LOG_LEVEL
#define LOG_LEVEL
Logging level defined from cmake is or-ed with bitmask to log strings.
Definition: datastruct.h:24
parfis::FuncTable::idx
std::vector< double > idx
Vector of 1/dx per range.
Definition: datastruct.h:391
parfis::CfgData::gasNameVec
std::vector< std::string > gasNameVec
Gas data.
Definition: datastruct.h:561
parfis::Specie::idt
double idt
1/dt
Definition: datastruct.h:321
parfis::LogMask::Info
@ Info
Log info messages (mask: 1000)
parfis::Command::getNext
Command * getNext()
Get the next command in the chain.
Definition: datastruct.h:682
parfis::Specie::eCharge
int eCharge
Charge in elemetary charge units.
Definition: datastruct.h:337
parfis::Specie::maxEv
double maxEv
Maximal energy in eV.
Definition: datastruct.h:325
parfis::FuncTable::rowCnt
int rowCnt
Row count.
Definition: datastruct.h:385
parfis::Specie::gasCollisionVecId
std::vector< uint32_t > gasCollisionVecId
Vector of ids from the gasCollisionVec.
Definition: datastruct.h:349
parfis::GasCollision::type
int type
Type of collision (elastic, inelastic)
Definition: datastruct.h:456
parfis::Domain::m_pCmdChainMap
std::map< std::string, std::unique_ptr< CommandChain > > * m_pCmdChainMap
Pointer to command map.
Definition: datastruct.h:782
parfis::SimData::nodeFlagVec
std::vector< nodeFlag_t > nodeFlagVec
Vector of pointers to the cellVec.
Definition: datastruct.h:607
parfis::SimData
Simulation data.
Definition: datastruct.h:598
parfis::state_t
STATE_TYPE state_t
Type of state space variables of each particle (float or double)
Definition: datastruct.h:50
parfis::SimData::stateVec
std::vector< State > stateVec
Vector of states.
Definition: datastruct.h:619
parfis::CfgData::gasCollisionNameVec
std::vector< std::string > gasCollisionNameVec
GasCollision names.
Definition: datastruct.h:563
parfis::SimData::cellVec
std::vector< Cell > cellVec
Vector of cells.
Definition: datastruct.h:600
parfis::GasCollision::specieId
uint32_t specieId
Id from the specie vector.
Definition: datastruct.h:450
parfis::PyVecContainer
Definition: datastruct.h:190
parfis::Logger::logToStr
void logToStr(LogMask mask, const std::string &msg)
Logs strings into Logger::m_str.
Definition: datastruct.cpp:499
parfis::PyVec
Structure used instead of std::vector<T> for python bindings.
Definition: datastruct.h:200
parfis::LogMask::Error
@ Error
Log error messages (mask: 0001)
parfis::PyCfgData
Configuration data in format suitable for Python ctypes.
Definition: datastruct.h:528
parfis::PyGasCollision::type
int type
Type of collision (elastic, inelastic)
Definition: datastruct.h:485
parfis::PyFuncTable::colCnt
int colCnt
Column count (index increase by 1, is column increase)
Definition: datastruct.h:411
parfis::nodeFlag_t
uint8_t nodeFlag_t
Type for node bitwise marking.
Definition: datastruct.h:58
parfis::Vec3D::z
T z
Variable z.
Definition: datastruct.h:149
parfis::PyFuncTable::idx
PyVec< double > idx
Vector of 1/dx per range.
Definition: datastruct.h:419
parfis::GasCollision::xSecFtab
FuncTable xSecFtab
Cross section in angstroms, with x-axis is in eV.
Definition: datastruct.h:460
parfis::FuncTable::loadData
int loadData(const std::string &fileName)
Loads data from the defined file name and based on the object type.
Definition: datastruct.cpp:326
parfis::PyFuncTable::yVec
PyVec< double > yVec
Y values.
Definition: datastruct.h:423
parfis::Vec3D::operator==
friend bool operator==(const Vec3D< T > &lhs, const Vec3D< T > &rhs)
Compares if vectors are equal.
Definition: datastruct.h:154
parfis::PyGasCollision
Wrapper for the GasCollilsion structure to be used by ctypes in python.
Definition: datastruct.h:470
parfis::Logger::getLogFileName
static std::string getLogFileName(uint32_t id, uint32_t cnt)
Constructs file name for the log files.
Definition: datastruct.cpp:476
parfis::PySimData
Simulation data in format suitable for Python ctypes.
Definition: datastruct.h:580
parfis::FuncTable
Tabulated function, linear and nonlinear tabulation is available.
Definition: datastruct.h:377
parfis::Vec3D::lenSq
T lenSq() const
Returns the squared vector length in Eucledian metric.
Definition: datastruct.h:187
parfis::StateFlag
Definition: datastruct.h:64
parfis::Param::m_valueVec
std::vector< T > m_valueVec
Vector of parameter values.
Definition: datastruct.h:728
parfis::Field::strengthB
Vec3D< double > strengthB
Strength of B field in T in a given direction (when uniform)
Definition: datastruct.h:522
parfis::Param
Class derived from ParamBase that holds parameter values.
Definition: datastruct.h:724
parfis::SimData::pyGasCollisionProbVec
std::vector< PyFuncTable > pyGasCollisionProbVec
Vector for the ctypes wrapper.
Definition: datastruct.h:643
parfis::Gas::id
uint32_t id
Id from the gas vector in CfgData.
Definition: datastruct.h:360
parfis::GasCollision
Holds information about collisions with gas particles.
Definition: datastruct.h:441
parfis::Command::m_name
std::string m_name
Name for the command.
Definition: datastruct.h:667
parfis::PyFuncTable::ranges
PyVec< double > ranges
Vector of ranges.
Definition: datastruct.h:415
parfis::CfgData::periodicBoundary
Vec3D< int > periodicBoundary
Periodic boundary 0-no, 1-yes.
Definition: datastruct.h:555
parfis::Vec3D::operator<<
friend std::ostream & operator<<(std::ostream &os, const Vec3D< T > &vec)
Oveload of std::out operator.
Definition: datastruct.h:172
parfis::SimData::specieVec
std::vector< Specie > specieVec
Vector of species.
Definition: datastruct.h:631
parfis::GasCollision::freqFtab
FuncTable freqFtab
Collision frequency, x-axis is in code velocity squared.
Definition: datastruct.h:462
parfis::Logger::printLogFile
void printLogFile()
Prints the log string to the defined file.
Definition: datastruct.cpp:516
parfis::LogMask::Memory
@ Memory
Log messages concerned with memory allocation/deallocation (mask: 0100)
parfis::Domain::m_pLogger
Logger * m_pLogger
Pointer to the Logger object from parfis.
Definition: datastruct.h:776
parfis::CfgData::specieNameVec
std::vector< std::string > specieNameVec
Specie names.
Definition: datastruct.h:559
parfis::GasCollision::threshold
double threshold
Threshold in eV.
Definition: datastruct.h:454
parfis::Cell::pos
Vec3D< cellPos_t > pos
Cell position is represented with three integers x,y,z.
Definition: datastruct.h:283
parfis::Gas
Holds information about each gas component.
Definition: datastruct.h:357
parfis::Cell
Structure used to represent space cells.
Definition: datastruct.h:280
parfis::Vec3D::y
T y
Variable y.
Definition: datastruct.h:147
parfis::PyFuncTable::rowCnt
int rowCnt
Row count.
Definition: datastruct.h:413
parfis::PyGasCollision::id
uint32_t id
Id from the gas collision vector in CfgData.
Definition: datastruct.h:473
parfis::SimData::cellIdAVec
std::vector< cellId_t > cellIdAVec
Vector of pointer to cells of group A.
Definition: datastruct.h:615
parfis::PyGasCollision::threshold
double threshold
Threshold in eV.
Definition: datastruct.h:483
parfis::CfgData::cellSize
Vec3D< double > cellSize
Single cell size in meters.
Definition: datastruct.h:553
parfis::CfgData::geometry
int geometry
Geometry type.
Definition: datastruct.h:547
parfis::Field::typeE
Vec3D< int > typeE
E field type in a given direction (0:none, 1:uniform)
Definition: datastruct.h:516
parfis::Specie::charge
double charge
Charge in Coulombs.
Definition: datastruct.h:339
parfis::Specie
Holds information about each specie.
Definition: datastruct.h:306
parfis::Specie::amuMass
double amuMass
Mass in amu.
Definition: datastruct.h:333
parfis::Specie::dvUniformE
Vec3D< double > dvUniformE
Increase in dv for uniform field e.
Definition: datastruct.h:345
parfis::PyFuncTable::type
int type
Type 0:linear, 1:nonlinear.
Definition: datastruct.h:409
parfis::Command::m_func
std::function< int()> m_func
Function to run in the command object.
Definition: datastruct.h:673
parfis::SimData::field
Field field
Field data.
Definition: datastruct.h:645
parfis::cellPos_t
uint16_t cellPos_t
Type for cell position vector components.
Definition: datastruct.h:56
parfis::Specie::velInitDistMax
Vec3D< double > velInitDistMax
Maximal velocity value for initial distribution.
Definition: datastruct.h:329
parfis::SimData::headIdVec
std::vector< stateId_t > headIdVec
Vector of pointers to head states.
Definition: datastruct.h:629
parfis::CfgData::geometrySize
Vec3D< double > geometrySize
Geometry size in meters (bounding box of the simulation space)
Definition: datastruct.h:551
parfis::CfgData::cellCount
Vec3D< int > cellCount
Number of cells in every direction.
Definition: datastruct.h:557
parfis::SimData::gasCollisionProbVec
std::vector< FuncTable > gasCollisionProbVec
Vector of total gas collision probability data.
Definition: datastruct.h:641
parfis::FuncTable::ranges
std::vector< double > ranges
Vector of ranges.
Definition: datastruct.h:387
parfis::State::next
stateId_t next
Pointer to the next state from the same cell, Const::noStateId for the last state.
Definition: datastruct.h:294
parfis::Field::typeB
Vec3D< int > typeB
B field type in a given direction (0:none, 1:uniform)
Definition: datastruct.h:518
parfis::GasCollision::scatterAngle
std::vector< double > scatterAngle
Scattering angle (random number sampled with scatterAngle gives deflection in radians)
Definition: datastruct.h:458
parfis::Specie::mass
double mass
Mass in kg.
Definition: datastruct.h:335
parfis::LogMask::None
@ None
No logging (mask: 0000)
parfis::Gas::volumeFraction
double volumeFraction
Gas (volume) fraction.
Definition: datastruct.h:366
parfis::PyGasCollision::scatterAngle
PyVec< double > scatterAngle
Scattering angle (random number sampled with scatterAngle gives deflection in radians)
Definition: datastruct.h:487
parfis::LogMask::Warning
@ Warning
Log warning messages (mask: 0010)
parfis::GasCollision::name
const char * name
Collision name.
Definition: datastruct.h:446
parfis::Command
Chain of commands.
Definition: datastruct.h:661
parfis::PyFuncTable::xVec
PyVec< double > xVec
X values.
Definition: datastruct.h:421
parfis::State::vel
Vec3D< state_t > vel
Velocity vector.
Definition: datastruct.h:300
parfis::FuncTable::type
int type
Type 0:linear, 1:nonlinear.
Definition: datastruct.h:380
parfis::Specie::maxVel
double maxVel
Maximal velocity allowed for the specie in m/s.
Definition: datastruct.h:323
parfis::CfgData::setPyCfgData
int setPyCfgData()
Set PyCfgData.
Definition: datastruct.cpp:223
STATE_TYPE
#define STATE_TYPE
Data type used for state_t (float or double) defined before compiling.
Definition: datastruct.h:44
parfis::Specie::qm
double qm
Charge/mass ratio in C/kg.
Definition: datastruct.h:331
parfis::SimData::cellIdBVec
std::vector< cellId_t > cellIdBVec
Vector of pointer to cells of group B.
Definition: datastruct.h:617
parfis::Command::setNext
void setNext(Command &comRef)
Set next command in the chain.
Definition: datastruct.h:679
parfis::GasCollision::fileName
const char * fileName
Cross section file name.
Definition: datastruct.h:448
parfis::ParamBase
Base class used for configurations.
Definition: datastruct.h:704
parfis::Specie::name
const char * name
Specie name.
Definition: datastruct.h:311
parfis::Logger::m_fname
std::string m_fname
File name where the log text is written.
Definition: datastruct.h:109
parfis::Gas::amuMass
double amuMass
Gas particle mass in amu.
Definition: datastruct.h:364
parfis::PyFuncTable::operator=
PyFuncTable & operator=(const FuncTable &ftab)
Overload of the equal operator for easier manipulation.
Definition: datastruct.h:425
parfis::CfgData::pyCfgData
PyCfgData pyCfgData
PyCfgData points to data of this object.
Definition: datastruct.h:567
parfis::api::loadCfgData
PARFIS_EXPORT int loadCfgData(uint32_t id)
Wrapper for calling member function with the same name from the Parfis object.
Definition: parfis.cpp:455
parfis::Vec3D::operator!=
friend bool operator!=(const Vec3D< T > &lhs, const Vec3D< T > &rhs)
Compares if vectors are not equal.
Definition: datastruct.h:161
parfis::SimData::stateFlagVec
std::vector< stateFlag_t > stateFlagVec
Vector of state flags - corresponds to stateVec.
Definition: datastruct.h:621
parfis::Specie::velInitDist
int velInitDist
Initial velocty random generator.
Definition: datastruct.h:313
parfis::PyFuncTable::nbins
PyVec< int > nbins
Vector of number of points per range.
Definition: datastruct.h:417
parfis::FuncTable::nbins
std::vector< int > nbins
Vector of number of points per range.
Definition: datastruct.h:389
parfis::cellId_t
uint32_t cellId_t
Type for cell id.
Definition: datastruct.h:52
parfis::Command::m_funcName
std::string m_funcName
Function name.
Definition: datastruct.h:670
parfis::SimData::pyGasCollisionVec
std::vector< PyGasCollision > pyGasCollisionVec
Vector for the ctypes wrapper.
Definition: datastruct.h:639
parfis::Vec3D
Struct that represents a 3d vector with components of type T.
Definition: datastruct.h:142
parfis::PyGasCollision::freqFtab
PyFuncTable freqFtab
Collision frequency, x-axis is in code velocity squared units.
Definition: datastruct.h:491
parfis::Specie::id
uint32_t id
Id from the specie vector.
Definition: datastruct.h:309
parfis::Logger::log
static void log(Logger &logger, LogMask mask, const std::string &msg)
Function for logging.
Definition: datastruct.h:123
parfis::FuncTable::xVec
std::vector< double > xVec
X values.
Definition: datastruct.h:393
parfis::FuncTable::eval
std::function< double(double)> eval
Function to run the evaluation based on type.
Definition: datastruct.h:397
parfis::CfgData::timestep
double timestep
Timestep for the system in seconds.
Definition: datastruct.h:549
parfis::SimData::calculateColProb
int calculateColProb(const CfgData *pCfgData)
Calculates collision probability from the cx.
Definition: datastruct.cpp:400
parfis::PyGasCollision::fileName
const char * fileName
Cross section file name.
Definition: datastruct.h:477
parfis::Command::m_pNext
Command * m_pNext
Pointer to the next command in the chain.
Definition: datastruct.h:676
parfis::Specie::dt
double dt
Timestep in seconds.
Definition: datastruct.h:319
parfis::Logger::m_str
std::string m_str
String with the log text.
Definition: datastruct.h:104
parfis::Domain::m_pCfgData
CfgData * m_pCfgData
Pointer to configuration data.
Definition: datastruct.h:778
parfis::SimData::evolveCnt
uint64_t evolveCnt
Evolution counter.
Definition: datastruct.h:649
parfis::Logger
Logger class.
Definition: datastruct.h:102
parfis::xyDistSq
double xyDistSq(Vec3D< double > &a, Vec3D< double > &b)
Squared distance between two points in the x-y plane.
Definition: datastruct.h:245
parfis::PyVec< std::string >
Overload of PyVec for type std::string.
Definition: datastruct.h:220
parfis::CommandChain::m_cmdMap
std::map< std::string, std::unique_ptr< Command > > m_cmdMap
Map of commands.
Definition: datastruct.h:691
parfis::Vec3D::x
T x
Variable x.
Definition: datastruct.h:145
parfis::CfgData::gasCollisionFileNameVec
std::vector< std::string > gasCollisionFileNameVec
GasCollision file names.
Definition: datastruct.h:565
parfis::Specie::headIdOffset
size_t headIdOffset
Offset for headIdVec.
Definition: datastruct.h:343
parfis::Specie::statesPerCell
int statesPerCell
States per cell for creating initial particles.
Definition: datastruct.h:315
parfis::Domain
Class is used as a base class.
Definition: datastruct.h:749
parfis::SimData::pySimData
PySimData pySimData
PySimData points to data of this object.
Definition: datastruct.h:647
parfis::Gas::name
const char * name
Gas name.
Definition: datastruct.h:362
parfis
Main namespace of the library.
Definition: datastruct.h:47
parfis::CfgData
Configuration parameters data.
Definition: datastruct.h:545
parfis::GasCollision::id
uint32_t id
Id from the gas collision vector in CfgData.
Definition: datastruct.h:444
parfis::Field::strengthE
Vec3D< double > strengthE
Strength of E field in V/m in a given direction (when uniform)
Definition: datastruct.h:520
parfis::ParamBase::m_childMap
std::map< std::string, std::unique_ptr< ParamBase > > m_childMap
Map of children ParamBase objects (functions as a data containter)
Definition: datastruct.h:712
parfis::State::prev
stateId_t prev
Pointer to the previous state from the same cell, Const::noStateId for the head state.
Definition: datastruct.h:296
parfis::PyGasCollision::operator=
PyGasCollision & operator=(const GasCollision &gasCol)
Overload of the equal operator for easier manipulation.
Definition: datastruct.h:493
parfis::GasCollision::gasId
uint32_t gasId
Id from the gas vector.
Definition: datastruct.h:452
parfis::State
Specie state.
Definition: datastruct.h:291
parfis::Vec3D::len
T len() const
Returns the vector length in Eucledian metric.
Definition: datastruct.h:181
parfis::CommandChain
Defines the whole command chain.
Definition: datastruct.h:688
parfis::SimData::gasCollisionVec
std::vector< GasCollision > gasCollisionVec
Vector of gas collision data.
Definition: datastruct.h:637
parfis::stateFlag_t
uint8_t stateFlag_t
Type for state flags.
Definition: datastruct.h:60
parfis::Specie::timestepRatio
int timestepRatio
Number of CfgData.timestep for one specie timestep.
Definition: datastruct.h:317
parfis::LogMask
LogMask
Log bitmask that corresponds to log level.
Definition: datastruct.h:86
parfis::stateId_t
uint32_t stateId_t
Type for the state id.
Definition: datastruct.h:54