ABLATE Source Documentation  0.12.34
field.hpp
1 #ifndef ABLATELIBRARY_PARTICLEFIELD_HPP
2 #define ABLATELIBRARY_PARTICLEFIELD_HPP
3 
4 #include <petsc.h>
5 #include <string>
6 #include <vector>
7 #include "domain/field.hpp"
8 
9 namespace ablate::particles {
10 
11 struct Field {
13  const std::string name;
14 
16  const PetscInt numberComponents;
17 
19  const std::vector<std::string> components;
20 
22  enum domain::FieldLocation location = domain::FieldLocation::AUX;
23 
25  const PetscDataType dataType;
26 
28  const PetscInt offset = 0;
29 
31  PetscInt dataSize = 0;
32 
34  template <class IndexType>
35  inline IndexType operator[](IndexType particle) const {
36  return particle * dataSize + offset;
37  }
38 };
39 
40 } // namespace ablate::particles
41 #endif // ABLATELIBRARY_PARTICLEFIELD_HPP
Definition: field.hpp:11
enum domain::FieldLocation location
The field location (sol or aux)
Definition: field.hpp:22
const PetscDataType dataType
The type of field.
Definition: field.hpp:25
const PetscInt numberComponents
The number of the components.
Definition: field.hpp:16
const std::string name
The unique name of the particle field.
Definition: field.hpp:13
const PetscInt offset
The offset in the local array, 0 for aux, computed for sol.
Definition: field.hpp:28
PetscInt dataSize
The size of the component for this data.
Definition: field.hpp:31
IndexType operator[](IndexType particle) const
Inline function to compute offset.
Definition: field.hpp:35
const std::vector< std::string > components
The name of the components.
Definition: field.hpp:19