NeoN
A framework for CFD software
Loading...
Searching...
No Matches
domain.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 - 2025 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
12
14{
15
26template<typename ValueType>
28{
29public:
30
31
32 typedef ValueType ElementType;
33
43 const Executor& exec,
44 std::string fieldName,
46 const Field<ValueType>& field
47 )
48 : name(fieldName), exec_(exec), mesh_(mesh), field_(field)
49 {}
50
61 const Executor& exec,
62 std::string fieldName,
65 const BoundaryData<ValueType>& boundaryVectors
66 )
67 : name(fieldName), exec_(exec), mesh_(mesh), field_({exec, internalVector, boundaryVectors})
68 {
69 if (mesh.nCells() != internalVector.size())
70 {
71 NF_ERROR_EXIT("Inconsistent size of mesh and internal field detected");
72 }
73 }
74
80 const Vector<ValueType>& internalVector() const { return field_.internalVector(); }
81
87 Vector<ValueType>& internalVector() { return field_.internalVector(); }
88
94 localIdx size() const { return field_.internalVector().size(); }
95
101 const BoundaryData<ValueType>& boundaryData() const { return field_.boundaryData(); }
102
108 BoundaryData<ValueType>& boundaryData() { return field_.boundaryData(); }
109
115 const Executor& exec() const { return exec_; }
116
122 const UnstructuredMesh& mesh() const { return mesh_; }
123
124 std::string name; // The name of the field
125
126protected:
127
128 Executor exec_; // The executor object
129 const UnstructuredMesh& mesh_; // The unstructured mesh object
130 Field<ValueType> field_; // The domain field object
131};
132
133} // namespace NeoN
Represents the boundary fields for a computational domain.
Represents the domain fields for a computational domain.
Definition field.hpp:36
Represents an unstructured mesh in NeoN.
localIdx nCells() const
Get the number of cells in the mesh.
A class to contain the data and executors for a field and define some basic operations.
Definition vector.hpp:30
This class represents a mixin for a geometric field.
Definition domain.hpp:28
DomainMixin(const Executor &exec, std::string fieldName, const UnstructuredMesh &mesh, const Vector< ValueType > &internalVector, const BoundaryData< ValueType > &boundaryVectors)
Constructor for DomainMixin.
Definition domain.hpp:60
BoundaryData< ValueType > & boundaryData()
Returns a reference to the boundary field.
Definition domain.hpp:108
const UnstructuredMesh & mesh() const
Returns a const reference to the unstructured mesh object.
Definition domain.hpp:122
localIdx size() const
Returns the size of the internal field.
Definition domain.hpp:94
const BoundaryData< ValueType > & boundaryData() const
Returns a const reference to the boundary field.
Definition domain.hpp:101
Vector< ValueType > & internalVector()
Returns a reference to the internal field.
Definition domain.hpp:87
DomainMixin(const Executor &exec, std::string fieldName, const UnstructuredMesh &mesh, const Field< ValueType > &field)
Constructor for DomainMixin.
Definition domain.hpp:42
const Executor & exec() const
Returns a const reference to the executor object.
Definition domain.hpp:115
const Vector< ValueType > & internalVector() const
Returns a const reference to the internal field.
Definition domain.hpp:80
#define NF_ERROR_EXIT(message)
Macro for printing an error message and aborting the program.
Definition error.hpp:110
int32_t localIdx
Definition label.hpp:32
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:18