Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade BOUT++ to latest next #233

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ else()
cmake_policy(VERSION 3.12)
endif()

project(hermes-3 LANGUAGES CXX)
project(hermes-3 LANGUAGES CXX C)

# Extra CMake scripts in cmake/ subdirectory
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
Expand Down
2 changes: 1 addition & 1 deletion external/BOUT-dev
Submodule BOUT-dev updated 250 files
45 changes: 23 additions & 22 deletions tests/unit/test_extras.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@

#include "gtest/gtest.h"

#include <numeric>
#include <functional>
#include <iostream>
#include <numeric>
#include <vector>

#include "bout/boutcomm.hxx"
#include "bout/field3d.hxx"
#include "bout/unused.hxx"
#include "bout/coordinates.hxx"
#include "bout/field3d.hxx"
#include "bout/mesh.hxx"
#include "bout/mpi_wrapper.hxx"
#include "bout/operatorstencil.hxx"
#include "bout/unused.hxx"

static constexpr BoutReal BoutRealTolerance{1e-15};
// FFTs have a slightly looser tolerance than other functions
static constexpr BoutReal FFTTolerance{1.e-12};

/// Does \p str contain \p substring?
::testing::AssertionResult IsSubString(const std::string &str,
const std::string &substring);
::testing::AssertionResult IsSubString(const std::string& str,
const std::string& substring);

void fillField(Field3D& f, std::vector<std::vector<std::vector<BoutReal>>> values);
void fillField(Field2D& f, std::vector<std::vector<BoutReal>> values);
Expand All @@ -45,8 +45,8 @@ T makeField(const std::function<BoutReal(typename T::ind_type&)>& fill_function,
}

/// Teach googletest how to print SpecificInds
template<IND_TYPE N>
inline std::ostream& operator<< (std::ostream &out, const SpecificInd<N> &index) {
template <IND_TYPE N>
inline std::ostream& operator<<(std::ostream& out, const SpecificInd<N>& index) {
return out << index.ind;
}

Expand Down Expand Up @@ -146,8 +146,8 @@ public:
zstart = 0;
zend = nz - 1;

StaggerGrids=false;
StaggerGrids = false;

// Unused variables
periodicX = false;
NXPE = 1;
Expand All @@ -160,13 +160,12 @@ public:
mpi = bout::globals::mpi;
}

void setCoordinates(std::shared_ptr<Coordinates> coords, CELL_LOC location = CELL_CENTRE) {
void setCoordinates(std::shared_ptr<Coordinates> coords,
CELL_LOC location = CELL_CENTRE) {
coords_map[location] = coords;
}

void setGridDataSource(GridDataSource* source_in) {
source = source_in;
}
void setGridDataSource(GridDataSource* source_in) { source = source_in; }

// Use this if the FakeMesh needs x- and y-boundaries
void createBoundaries() {
Expand All @@ -181,8 +180,8 @@ public:
bool UNUSED(disable_corners) = false) override {
return nullptr;
}
comm_handle sendY(FieldGroup& UNUSED(g), comm_handle UNUSED(handle) = nullptr) override
{
comm_handle sendY(FieldGroup& UNUSED(g),
comm_handle UNUSED(handle) = nullptr) override {
return nullptr;
}
int wait(comm_handle UNUSED(handle)) override { return 0; }
Expand Down Expand Up @@ -233,8 +232,9 @@ public:
RangeIterator iterateBndryUpperInnerY() const override { return RangeIterator(); }
void addBoundary(BoundaryRegion* region) override { boundaries.push_back(region); }
std::vector<BoundaryRegion*> getBoundaries() override { return boundaries; }
std::vector<BoundaryRegionPar*> getBoundariesPar() override {
return std::vector<BoundaryRegionPar*>();
std::vector<std::shared_ptr<BoundaryRegionPar>>
getBoundariesPar(BoundaryParType UNUSED(type) = BoundaryParType::all) override {
return std::vector<std::shared_ptr<BoundaryRegionPar>>();
}
BoutReal GlobalX(int jx) const override { return jx; }
BoutReal GlobalY(int jy) const override { return jy; }
Expand All @@ -253,8 +253,8 @@ public:
int getLocalZIndex(int) const override { return 0; }
int getLocalZIndexNoBoundaries(int) const override { return 0; }

void initDerivs(Options * opt){
StaggerGrids=true;
void initDerivs(Options* opt) {
StaggerGrids = true;
derivs_init(opt);
}

Expand Down Expand Up @@ -322,7 +322,7 @@ public:
using Mesh::msg_len;

private:
std::vector<BoundaryRegion *> boundaries;
std::vector<BoundaryRegion*> boundaries;
};

/// FakeGridDataSource provides a non-null GridDataSource* source to use with FakeMesh, to
Expand Down Expand Up @@ -412,6 +412,7 @@ public:
bool hasXBoundaryGuards(Mesh* UNUSED(m)) override { return true; }

bool hasYBoundaryGuards() override { return true; }

private:
Options values; ///< Store values to be returned by get()
};
Expand Down Expand Up @@ -455,8 +456,8 @@ public:

// No call to Coordinates::geometry() needed here
static_cast<FakeMesh*>(bout::globals::mesh)->setCoordinates(test_coords);
static_cast<FakeMesh*>(bout::globals::mesh)->setGridDataSource(
new FakeGridDataSource());
static_cast<FakeMesh*>(bout::globals::mesh)
->setGridDataSource(new FakeGridDataSource());
// May need a ParallelTransform to create fields, because create3D calls
// fromFieldAligned
test_coords->setParallelTransform(
Expand Down
Loading