Skip to content

Commit

Permalink
wip refactor timeintegration
Browse files Browse the repository at this point in the history
  • Loading branch information
greole committed Oct 8, 2024
1 parent 9c604a8 commit 7d24306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2023 NeoFOAM authors

#pragma once

#include <functional>

#include "NeoFOAM/fields/field.hpp"
#include "NeoFOAM/core/executor/executor.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/timeIntegration/timeIntegration.hpp"
#include "NeoFOAM/mesh/unstructured.hpp"

#include <functional>


namespace NeoFOAM::finiteVolume::cellCentred
{


class ForwardEuler : public TimeIntegrationFactory::Register<ForwardEuler>
{

Expand All @@ -28,7 +28,6 @@ class ForwardEuler : public TimeIntegrationFactory::Register<ForwardEuler>

static std::string schema() { return "none"; }


void solve() override;

std::unique_ptr<TimeIntegrationFactory> clone() const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@

#include <functional>

namespace dsl = NeoFOAM::DSL;

namespace NeoFOAM::finiteVolume::cellCentred
namespace NeoFOAM
{

class TimeIntegrationFactory :
public NeoFOAM::RuntimeSelectionFactory<
public RuntimeSelectionFactory<
TimeIntegrationFactory,
Parameters<const dsl::Equation&, const Dictionary&>>
Parameters<const DSL::Equation&, const Dictionary&>>
{

public:

static std::string name() { return "timeIntegrationFactory"; }

TimeIntegrationFactory(const dsl::Equation& eqnSystem, const Dictionary& dict)
TimeIntegrationFactory(const DSL::Equation& eqnSystem, const Dictionary& dict)
: eqnSystem_(eqnSystem), dict_(dict)
{}

virtual ~TimeIntegrationFactory() {} // Virtual destructor
virtual ~TimeIntegrationFactory() {}

virtual void solve() = 0; // Pure virtual function for solving

Expand Down Expand Up @@ -62,12 +60,10 @@ class TimeIntegration
TimeIntegrationFactory::create(dict.get<std::string>("type"), eqnSystem, dict)
) {};


void solve() { timeIntegrateStrategy_->solve(); }

private:


std::unique_ptr<TimeIntegrationFactory> timeIntegrateStrategy_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#define CATCH_CONFIG_RUNNER // Define this before including catch.hpp to create
// a custom main
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators_all.hpp>

#include "common.hpp"
#include "NeoFOAM/core/dictionary.hpp"
#include "NeoFOAM/core/parallelAlgorithms.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/timeIntegration/timeIntegration.hpp"
Expand Down Expand Up @@ -71,7 +71,9 @@ class TimeOperator
std::size_t nCells() const { return nCells_; }

dsl::Operator::Type termType_;

const NeoFOAM::Executor exec_;

std::size_t nCells_;
};

Expand Down

0 comments on commit 7d24306

Please sign in to comment.