PRISMS-PF  v2.1
fields.h
Go to the documentation of this file.
1 //fields class
2 #ifndef FIELDS_H
3 #define FIELDS_H
4 #include <deal.II/base/conditional_ostream.h>
5 
6 #include "userInputParameters.h"
7 
8 template<int dim>
9 class Field
10 {
11  public:
12  Field(fieldType _type, PDEType _pdetype, std::string _name);
15  std::string name;
16  unsigned int index;
17  unsigned int startIndex;
18  unsigned int numComponents;
19 
20  private:
21  static unsigned int fieldCount;
22  static unsigned int indexCount;
23 };
24 
25 //initialize static variables
26 template <int dim> unsigned int Field<dim>::fieldCount = 0;
27 template <int dim> unsigned int Field<dim>::indexCount = 0;
28 
29 //constructor
30 template<int dim>
31 Field<dim>::Field(fieldType _type, PDEType _pdetype, std::string _name): type(_type), pdetype(_pdetype), name(_name)
32 {
33  //increment field count as new field is being created
35  fieldCount++;
37 
38  //assign index to this field
39  switch (type){
40  case SCALAR:{
41  //increment index count by one
42  indexCount+=1;
43  numComponents=1;
44  break;
45  }
46  case VECTOR:{
47  //increment index count by dim
48  indexCount+=dim;
49  numComponents=dim;
50  break;
51  }
52  default:{
53  std::cout << "fields.h: unknown field type\n";
54  exit(-1);
55  }
56  }
57 }
58 
59 #endif
unsigned int numComponents
Definition: fields.h:18
fieldType type
Definition: fields.h:13
static unsigned int fieldCount
Definition: fields.h:21
static unsigned int indexCount
Definition: fields.h:22
PDEType
Definition: varTypeEnums.h:5
unsigned int index
Definition: fields.h:16
Definition: fields.h:9
std::string name
Definition: fields.h:15
Field(fieldType _type, PDEType _pdetype, std::string _name)
Definition: fields.h:31
unsigned int startIndex
Definition: fields.h:17
PDEType pdetype
Definition: fields.h:14
fieldType
Definition: varTypeEnums.h:4