Skip to content

Commit

Permalink
all test run: update headers and class names
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningScheufler committed Jul 14, 2024
1 parent a81b4e5 commit b12c40f
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 152 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(
DESCRIPTION "An implementation of FOAM")

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

# Add the cmake folder so the find_package command finds custom packages
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
Expand All @@ -24,4 +24,4 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(NeoFOAM)
add_subdirectory(src)

add_subdirectory(test)
2 changes: 1 addition & 1 deletion NeoFOAM
Submodule NeoFOAM updated 55 files
+2 −2 doc/api/fields.rst
+3 −3 doc/basics/containers.rst
+2 −2 doc/finiteVolume/cellCentred/boundaryConditions.rst
+4 −0 include/NeoFOAM/core/dictionary.hpp
+2 −2 include/NeoFOAM/core/parallelAlgorithms.hpp
+3 −0 include/NeoFOAM/core/primitives/scalar.hpp
+17 −8 include/NeoFOAM/core/primitives/vector.hpp
+0 −2 include/NeoFOAM/core/time.hpp
+3 −3 include/NeoFOAM/fields/operations/sum.hpp
+0 −1 include/NeoFOAM/finiteVolume/cellCentred/boundary.hpp
+0 −74 include/NeoFOAM/finiteVolume/cellCentred/boundary/surface/fixedGradient.hpp
+24 −29 include/NeoFOAM/finiteVolume/cellCentred/boundary/surface/fixedValue.hpp
+5 −4 include/NeoFOAM/finiteVolume/cellCentred/boundary/surfaceBoundaryFactory.hpp
+36 −31 include/NeoFOAM/finiteVolume/cellCentred/boundary/volume/fixedGradient.hpp
+27 −30 include/NeoFOAM/finiteVolume/cellCentred/boundary/volume/fixedValue.hpp
+5 −3 include/NeoFOAM/finiteVolume/cellCentred/boundary/volumeBoundaryFactory.hpp
+10 −56 include/NeoFOAM/finiteVolume/cellCentred/fields/geometricField.hpp
+64 −1 include/NeoFOAM/finiteVolume/cellCentred/fields/surfaceField.hpp
+49 −1 include/NeoFOAM/finiteVolume/cellCentred/fields/volumeField.hpp
+19 −19 include/NeoFOAM/finiteVolume/interpolation/linear.hpp
+0 −50 include/NeoFOAM/finiteVolume/interpolation/surfaceInterpolationSelector.hpp
+22 −21 include/NeoFOAM/finiteVolume/interpolation/upwind.hpp
+31 −17 include/NeoFOAM/finiteVolume/operators/gaussGreenDiv.hpp
+21 −16 include/NeoFOAM/finiteVolume/operators/gaussGreenGrad.hpp
+60 −0 include/NeoFOAM/mesh/stencil/basicFvccGeometryScheme.hpp
+123 −0 include/NeoFOAM/mesh/stencil/fvccGeometryScheme.hpp
+1 −1 include/NeoFOAM/mesh/unstructured/unstructuredMesh.hpp
+8 −2 src/CMakeLists.txt
+14 −0 src/core/dictionary.cpp
+17 −0 src/core/primitives/vector.cpp
+4 −0 src/core/time.cpp
+0 −3 src/finiteVolume/cellCentred/boundary/boundary.cpp
+44 −52 src/finiteVolume/cellCentred/interpolation/linear.cpp
+0 −77 src/finiteVolume/cellCentred/interpolation/surfaceInterpolation.cpp
+0 −58 src/finiteVolume/cellCentred/interpolation/surfaceInterpolationSelector.cpp
+50 −58 src/finiteVolume/cellCentred/interpolation/upwind.cpp
+41 −42 src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp
+41 −36 src/finiteVolume/cellCentred/operators/gaussGreenGrad.cpp
+211 −0 src/mesh/stencil/basicFvccGeometryScheme.cpp
+111 −0 src/mesh/stencil/fvccGeometryScheme.cpp
+2 −4 src/mesh/unstructured/unstructuredMesh.cpp
+8 −0 test/core/dictionary.cpp
+20 −0 test/core/parallelAlgorithms.cpp
+30 −10 test/fields/field.cpp
+2 −5 test/finiteVolume/cellCentred/boundary/CMakeLists.txt
+0 −45 test/finiteVolume/cellCentred/boundary/surfFixedGradient.cpp
+4 −0 test/finiteVolume/cellCentred/boundary/surface/CMakeLists.txt
+1 −1 test/finiteVolume/cellCentred/boundary/surface/surfFixedValue.cpp
+0 −45 test/finiteVolume/cellCentred/boundary/volFixedGradient.cpp
+5 −0 test/finiteVolume/cellCentred/boundary/volume/CMakeLists.txt
+92 −0 test/finiteVolume/cellCentred/boundary/volume/volFixedGradient.cpp
+19 −1 test/finiteVolume/cellCentred/boundary/volume/volFixedValue.cpp
+5 −5 test/finiteVolume/cellCentred/fields/surfaceField.cpp
+5 −5 test/finiteVolume/cellCentred/fields/volumeField.cpp
+11 −6 test/mesh/unstructured/unstructuredMesh.cpp
17 changes: 6 additions & 11 deletions applications/test_treeAMR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ add_executable(test_treeAMR "test_treeAMR.cpp")
find_package(MPI REQUIRED)
find_package(ZLIB REQUIRED)

set_target_properties(test_treeAMR PROPERTIES CXX_STANDARD 17)
set_target_properties(test_treeAMR PROPERTIES CXX_STANDARD 20)

# target_compile_definitions(test_treeAMR PUBLIC WM_LABEL_SIZE=32 NoRepository WM_DP OPENFOAM=2306 OMPI_SKIP_MPICXX)
# target_compile_definitions(test_treeAMR PUBLIC WM_LABEL_SIZE=32 NoRepository WM_DP OPENFOAM=2306
# OMPI_SKIP_MPICXX)

target_include_directories(
test_treeAMR
SYSTEM
PUBLIC ${CMAKE_SOURCE_DIR}/FoamAdapter/include
${CMAKE_SOURCE_DIR}/NeoFOAM/include
${MPI_INCLUDE_PATH}
${ZLIB_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
test_treeAMR SYSTEM
PUBLIC ${CMAKE_SOURCE_DIR}/FoamAdapter/include ${CMAKE_SOURCE_DIR}/NeoFOAM/include
${MPI_INCLUDE_PATH} ${ZLIB_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(
Expand All @@ -29,6 +26,4 @@ target_link_libraries(
Kokkos::kokkos
${ZLIB_LIBRARIES})


install(TARGETS test_treeAMR DESTINATION bin)

2 changes: 1 addition & 1 deletion benchmarks/explicitOperators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

add_executable(explicitOperators "explicitOperators.cpp")

set_target_properties(explicitOperators PROPERTIES CXX_STANDARD 17)
set_target_properties(explicitOperators PROPERTIES CXX_STANDARD 20)
target_compile_definitions(explicitOperators PUBLIC WM_LABEL_SIZE=32 NoRepository WM_DP
OPENFOAM=2306 OMPI_SKIP_MPICXX)

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/gradOperator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2023 NeoFOAM authors
add_executable(gradOperator "gradOperator.cpp")

set_target_properties(gradOperator PROPERTIES CXX_STANDARD 17)
set_target_properties(gradOperator PROPERTIES CXX_STANDARD 20)

target_compile_definitions(gradOperator PUBLIC WM_LABEL_SIZE=32 NoRepository WM_DP OPENFOAM=2306
OMPI_SKIP_MPICXX)
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/gradOperator/gradOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ template<typename T>
void print_field(NeoFOAM::Field<T> a)
{
std::cout << "a has a size of: " << a.size() << std::endl;
auto tmp_view = a.copyToHost().field();
auto tmp_view = a.copyToHost().span();
for (int i = 0; i < a.size(); i++)
{
std::cout << "tmp_view: " << tmp_view[i] << " at: " << i << std::endl;
Expand All @@ -56,7 +56,7 @@ template<>
void print_field(NeoFOAM::Field<NeoFOAM::Vector> a)
{
std::cout << "a has a size of: " << a.size() << std::endl;
auto tmp_view = a.copyToHost().field();
auto tmp_view = a.copyToHost().span();
for (int i = 0; i < a.size(); i++)
{
std::cout << "tmp_view: " << tmp_view[i](0) << " " << tmp_view[i](1) << " "
Expand Down Expand Up @@ -95,7 +95,7 @@ int main(int argc, char* argv[])
{
NeoFOAM::Executor exec = NeoFOAM::GPUExecutor();
Foam::Info << "reading mesh" << Foam::endl;
NeoFOAM::unstructuredMesh uMesh = readOpenFOAMMesh(exec, mesh);
NeoFOAM::UnstructuredMesh uMesh = readOpenFOAMMesh(exec, mesh);

NeoFOAM::scalarField Temperature(exec, T.internalField().size());
Temperature.apply(KOKKOS_LAMBDA(int i) { return i; });
Expand All @@ -113,7 +113,7 @@ int main(int argc, char* argv[])
{
NeoFOAM::Executor exec = NeoFOAM::CPUExecutor();
Foam::Info << "reading mesh" << Foam::endl;
NeoFOAM::unstructuredMesh uMesh = readOpenFOAMMesh(exec, mesh);
NeoFOAM::UnstructuredMesh uMesh = readOpenFOAMMesh(exec, mesh);

NeoFOAM::scalarField Temperature(exec, T.internalField().size());
Temperature.apply(KOKKOS_LAMBDA(int i) { return i; });
Expand All @@ -131,7 +131,7 @@ int main(int argc, char* argv[])
{
NeoFOAM::Executor exec = NeoFOAM::OMPExecutor();
Foam::Info << "reading mesh" << Foam::endl;
NeoFOAM::unstructuredMesh uMesh = readOpenFOAMMesh(exec, mesh);
NeoFOAM::UnstructuredMesh uMesh = readOpenFOAMMesh(exec, mesh);

NeoFOAM::scalarField Temperature(exec, T.internalField().size());
Temperature.apply(KOKKOS_LAMBDA(int i) { return i; });
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/matrixAssembly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

add_executable(matrixAssembly "matrixAssembly.cpp")

set_target_properties(matrixAssembly PROPERTIES CXX_STANDARD 17)
set_target_properties(matrixAssembly PROPERTIES CXX_STANDARD 20)

target_compile_definitions(matrixAssembly PUBLIC WM_LABEL_SIZE=32 NoRepository WM_DP OPENFOAM=2306
OMPI_SKIP_MPICXX)
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/scalarAdvection/NeoFoamScalarAdvection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "NeoFOAM/mesh/unstructuredMesh/unstructuredMesh.hpp"
#include "NeoFOAM/cellCentredFiniteVolume/grad/gaussGreenGrad.hpp"
#include "NeoFOAM/cellCentredFiniteVolume/div/gaussGreenDiv.hpp"
#include "NeoFOAM/cellCentredFiniteVolume/surfaceInterpolation/surfaceInterpolationSelector.hpp"
#include "NeoFOAM/finiteVolume/interpolation/surfaceInterpolationSelector.hpp"

#define namespaceFoam // Suppress <using namespace Foam;>
#include "fvCFD.H"
Expand Down Expand Up @@ -52,8 +52,8 @@ int main(int argc, char* argv[])
T.write();
// creating neofoam fields
Foam::Info << "creating neofoam mesh" << Foam::endl;
NeoFOAM::unstructuredMesh uMesh = Foam::readOpenFOAMMesh(exec, mesh);
NeoFOAM::fvccVolField<NeoFOAM::scalar> neoT = Foam::constructFrom(exec, uMesh, T);
NeoFOAM::UnstructuredMesh uMesh = Foam::readOpenFOAMMesh(exec, mesh);
fvcc::VolumeField<NeoFOAM::scalar> neoT = Foam::constructFrom(exec, uMesh, T);
neoT.correctBoundaryConditions();

NeoFOAM::fvccSurfaceField<NeoFOAM::scalar> neoPhi = constructSurfaceField(exec, uMesh, phi);
Expand Down Expand Up @@ -88,7 +88,7 @@ int main(int argc, char* argv[])

Foam::volScalarField ofDivT("ofDivT", Foam::fvc::div(phi, T));

NeoFOAM::fvccVolField<NeoFOAM::scalar> neoDivT = constructFrom(exec, uMesh, ofDivT);
fvcc::VolumeField<NeoFOAM::scalar> neoDivT = constructFrom(exec, uMesh, ofDivT);
NeoFOAM::fill(neoDivT.internalField(), 0.0);
NeoFOAM::fill(neoDivT.boundaryField().value(), 0.0);

Expand Down Expand Up @@ -134,8 +134,8 @@ int main(int argc, char* argv[])
// neoT.internalField() = neoT.internalField() - neoDivT.internalField() *
// runTime.deltaT().value();
double dt = runTime.deltaT().value();
auto s_neoT = neoT.internalField().field();
auto s_neoDivT = neoDivT.internalField().field();
auto s_neoT = neoT.internalField().span();
auto s_neoDivT = neoDivT.internalField().span();
neoT.internalField().apply(KOKKOS_LAMBDA(const int celli) {
return s_neoT[celli] + dt * s_neoDivT[celli];
});
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/scalarAdvection/scalarAdvection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "NeoFOAM/mesh/unstructuredMesh/unstructuredMesh.hpp"
#include "NeoFOAM/cellCentredFiniteVolume/grad/gaussGreenGrad.hpp"
#include "NeoFOAM/cellCentredFiniteVolume/div/gaussGreenDiv.hpp"
#include "NeoFOAM/cellCentredFiniteVolume/surfaceInterpolation/surfaceInterpolationSelector.hpp"
#include "NeoFOAM/finiteVolume/interpolation/surfaceInterpolationSelector.hpp"

#define namespaceFoam // Suppress <using namespace Foam;>
#include "fvCFD.H"
Expand Down Expand Up @@ -52,12 +52,12 @@ int main(int argc, char* argv[])
T.write();
// creating neofoam fields
Foam::Info << "creating neofoam mesh" << Foam::endl;
NeoFOAM::unstructuredMesh uMesh = Foam::readOpenFOAMMesh(exec, mesh);
NeoFOAM::fvccVolField<NeoFOAM::scalar> neoT = Foam::constructFrom(exec, uMesh, T);
NeoFOAM::UnstructuredMesh uMesh = Foam::readOpenFOAMMesh(exec, mesh);
fvcc::VolumeField<NeoFOAM::scalar> neoT = Foam::constructFrom(exec, uMesh, T);
neoT.correctBoundaryConditions();
// NeoFOAM::fvccVolField<NeoFOAM::Vector> neoU = constructFrom(exec, uMesh, U);
// fvcc::VolumeField<NeoFOAM::Vector> neoU = constructFrom(exec, uMesh, U);

// auto s_cc = uMesh.cellCentres().field();
// auto s_cc = uMesh.cellCentres().span();
// neoT.internalField().apply(KOKKOS_LAMBDA(int celli)
// {
// return std::exp(-0.5 * (std::pow((s_cc[celli][0] - 0.5) / spread, 2.0) +
Expand Down Expand Up @@ -100,7 +100,7 @@ int main(int argc, char* argv[])

Foam::volScalarField ofDivT("ofDivT", Foam::fvc::div(phi, T));

NeoFOAM::fvccVolField<NeoFOAM::scalar> neoDivT = constructFrom(exec, uMesh, ofDivT);
fvcc::VolumeField<NeoFOAM::scalar> neoDivT = constructFrom(exec, uMesh, ofDivT);
NeoFOAM::fill(neoDivT.internalField(), 0.0);
NeoFOAM::fill(neoDivT.boundaryField().value(), 0.0);

Expand Down
18 changes: 10 additions & 8 deletions include/FoamAdapter/comparison/fieldComparison.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
#include "Field.H"
#include "FoamAdapter/conversion/convert.hpp"
#include "FoamAdapter/conversion/type_conversion.hpp"
#include "NeoFOAM/fields/Field.hpp"
#include "NeoFOAM/primitives/label.hpp"
#include "NeoFOAM/fields/field.hpp"
#include "NeoFOAM/core/primitives/label.hpp"
#include "surfaceFields.H"
#include "volFields.H"
#include <span>

namespace Foam
{

namespace fvcc = NeoFOAM::finiteVolume::cellCentred;

#define FIELD_EQUALITY_OPERATOR(NFIELD_TYPE, FFIELD_TYPE) \
bool operator==(NeoFOAM::Field<NFIELD_TYPE>& nfield, const Foam::Field<FFIELD_TYPE>& ffield) \
{ \
auto hostSpan = nfield.copyToHost().field(); \
auto hostSpan = nfield.copyToHost().span(); \
\
for (int i = 0; i < hostSpan.size(); i++) \
{ \
Expand All @@ -34,11 +36,11 @@ FIELD_EQUALITY_OPERATOR(NeoFOAM::Vector, Foam::vector)

#define VOLGEOFIELD_EQUALITY_OPERATOR(NFIELD_TYPE, FFIELD_TYPE) \
bool operator==( \
NeoFOAM::fvccVolField<NFIELD_TYPE>& nfield, \
fvcc::VolumeField<NFIELD_TYPE>& nfield, \
const Foam::GeometricField<FFIELD_TYPE, Foam::fvPatchField, Foam::volMesh>& ffield \
) \
{ \
auto hostSpan = nfield.internalField().copyToHost().field(); \
auto hostSpan = nfield.internalField().copyToHost().span(); \
const auto& internalFField = ffield.internalField(); \
/* compare internalField*/ \
for (int i = 0; i < hostSpan.size(); i++) \
Expand All @@ -51,7 +53,7 @@ FIELD_EQUALITY_OPERATOR(NeoFOAM::Vector, Foam::vector)
/* compare boundaryField */ \
/* NeoFOAM boundaries are stored in contiguous memory */ \
/* whereas OpenFOAM boundaries are stored in a vector of patches */ \
auto patchValueSpan = nfield.boundaryField().value().copyToHost().field(); \
auto patchValueSpan = nfield.boundaryField().value().copyToHost().span(); \
NeoFOAM::label pFacei = 0; \
for (const auto& patch : ffield.boundaryField()) \
{ \
Expand All @@ -74,11 +76,11 @@ VOLGEOFIELD_EQUALITY_OPERATOR(NeoFOAM::Vector, Foam::vector)

#define SURFGEOFIELD_EQUALITY_OPERATOR(NFIELD_TYPE, FFIELD_TYPE) \
bool operator==( \
NeoFOAM::fvccSurfaceField<NFIELD_TYPE>& nfield, \
fvcc::SurfaceField<NFIELD_TYPE>& nfield, \
const Foam::GeometricField<FFIELD_TYPE, Foam::fvsPatchField, Foam::surfaceMesh>& ffield \
) \
{ \
auto hostSpan = nfield.internalField().copyToHost().field(); \
auto hostSpan = nfield.internalField().copyToHost().span(); \
const auto& internalFField = ffield.internalField(); \
/* compare internalField the fvccSurfaceField contains the boundaryValues \
*/ \
Expand Down
2 changes: 1 addition & 1 deletion include/FoamAdapter/fvcc/mesh/fvccNeoMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class fvccNeoMesh : public Foam::fvMesh
virtual ~fvccNeoMesh() = default;

NeoFOAM::UnstructuredMesh& uMesh() { return uMesh_; }
// const NeoFOAM::unstructuredMesh &uMesh() { return uMesh_; } const
// const NeoFOAM::UnstructuredMesh &uMesh() { return uMesh_; } const
};

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Expand Down
21 changes: 17 additions & 4 deletions include/FoamAdapter/readers/foamFields.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ auto readVolBoundaryConditions(const NeoFOAM::UnstructuredMesh& uMesh, const Foa
Foam::word type = patchDict.get<Foam::word>("type");
NeoFOAM::Dictionary neoPatchDict;
neoPatchDict.insert("type", std::string(type));
bcs.push_back(VolumeBoundary<type_primitive_t>(uMesh, patchi, neoPatchDict));
if (type == "zeroGradient")
{
neoPatchDict.insert("type", std::string("fixedGradient"));
neoPatchDict.insert("fixedGradient", type_primitive_t {});
}
if (type == "extrapolatedCalculated")
{
neoPatchDict.insert("type", std::string("calculated"));
}
bcs.push_back(
std::make_unique<fvcc::VolumeBoundary<type_primitive_t>>(uMesh, neoPatchDict, patchi)
);
patchi++;
}
return bcs;
Expand Down Expand Up @@ -117,9 +128,11 @@ auto readSurfaceBoundaryConditions(
Foam::dictionary patchDict = bDict.subDict(bName);
Foam::Info << "Boundary type: " << patchDict.get<Foam::word>("type") << Foam::endl;
Foam::word type = patchDict.get<Foam::word>("type");
NeoFOAM::Dictionary npatchDict;
npatchDict.insert("type", std::string(type));
bcs.push_back(SurfaceBoundary<type_primitive_t>(uMesh, patchi, npatchDict));
NeoFOAM::Dictionary neoPatchDict;
neoPatchDict.insert("type", std::string(type));
bcs.push_back(
std::make_unique<fvcc::SurfaceBoundary<type_primitive_t>>(uMesh, neoPatchDict, patchi)
);
patchi++;
}
return bcs;
Expand Down
10 changes: 5 additions & 5 deletions include/FoamAdapter/writers/writers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include "FoamAdapter/conversion/convert.hpp"
#include "NeoFOAM/fields/FieldTypeDefs.hpp"
#include "NeoFOAM/fields/field.hpp"
#include "fvMesh.H"
#include "volFields.H"

Expand All @@ -16,7 +16,7 @@ void write(NeoFOAM::scalarField& sf, const Foam::fvMesh& mesh, const std::string
if (field)
{
// field is already present and needs to be updated
auto sf_host = sf.copyToHost().field();
auto sf_host = sf.copyToHost().span();
Foam::scalarField& field_ref = field->ref();
for (int i = 0; i < field_ref.size(); i++)
{
Expand All @@ -37,7 +37,7 @@ void write(NeoFOAM::scalarField& sf, const Foam::fvMesh& mesh, const std::string
mesh,
Foam::dimensionedScalar(Foam::dimless, 0)
);
auto sf_host = sf.copyToHost().field();
auto sf_host = sf.copyToHost().span();
Foam::scalarField& field_ref = foamField.ref();
for (int i = 0; i < field_ref.size(); i++)
{
Expand All @@ -53,7 +53,7 @@ void write(NeoFOAM::vectorField& sf, const Foam::fvMesh& mesh, const std::string
if (field)
{
// field is already present and needs to be updated
auto sf_host = sf.copyToHost().field();
auto sf_host = sf.copyToHost().span();
Foam::vectorField& field_ref = field->ref();
for (int i = 0; i < field_ref.size(); i++)
{
Expand All @@ -74,7 +74,7 @@ void write(NeoFOAM::vectorField& sf, const Foam::fvMesh& mesh, const std::string
mesh,
Foam::dimensionedVector(Foam::dimless, Foam::Zero)
);
auto sf_host = sf.copyToHost().field();
auto sf_host = sf.copyToHost().span();
Foam::vectorField& field_ref = foamField.ref();
for (int i = 0; i < field_ref.size(); i++)
{
Expand Down
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)

FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0 # or a later release
)
FetchContent_MakeAvailable(Catch2)

add_executable(test_geometricFields "test_geometricFields.cpp")
set_target_properties(test_geometricFields PROPERTIES CXX_STANDARD 20)

Expand Down
Loading

0 comments on commit b12c40f

Please sign in to comment.