Skip to content
Draft
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
1 change: 1 addition & 0 deletions Components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ quicc_add_component(Transform/ViewOps)
quicc_add_component(Transform)
quicc_add_component(TimestepLegacy)
quicc_add_component(TimestepPc)
quicc_add_component(TimestepPcViews)
quicc_add_component(TimestepRkcb)
quicc_add_component(Framework)
quicc_add_component(Graph)
Expand Down
1 change: 1 addition & 0 deletions Components/Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target_link_libraries(${QUICC_CURRENT_COMPONENT_LIB}
QuICC::Profiling
QuICC::Environment
QuICC::TimestepPc
QuICC::TimestepPcViews
QuICC::TimestepRkcb
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set(tags
Lhs
Influence
Rhs
)

include(RegisterTags)
Expand Down
16 changes: 16 additions & 0 deletions Components/Framework/include/QuICC/Equations/IEquation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ namespace Equations {
class IEquation : public EquationData
{
public:
/// Typedef for the the spectral field component ID iterator
typedef std::vector<FieldComponents::Spectral::Id>::const_iterator SpectralComponent_iterator;

/// Typedef for the the spectral field component ID iterator range
typedef std::pair<SpectralComponent_iterator,SpectralComponent_iterator> SpectralComponent_range;

/**
* @brief Simple constructor
*
Expand Down Expand Up @@ -77,6 +83,16 @@ namespace Equations {
*/
virtual const Resolution& res() const = 0;

/**
* @brief Get the number of spectral components
*/
virtual int nSpectral() const = 0;

/**
* @brief Get vector spectral component range
*/
virtual SpectralComponent_range spectralRange() const = 0;

/**
* @brief Initialise the equation
*/
Expand Down
10 changes: 10 additions & 0 deletions Components/Framework/include/QuICC/Equations/IScalarEquation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ namespace Equations {
*/
virtual const Resolution& res() const override;

/**
* @brief Get the number of spectral components
*/
int nSpectral() const final;

/**
* @brief Get vector spectral component range
*/
SpectralComponent_range spectralRange() const final;

/**
* @brief Transfer solver solution to equation unknown
*
Expand Down
10 changes: 2 additions & 8 deletions Components/Framework/include/QuICC/Equations/IVectorEquation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ namespace Equations {
class IVectorEquation: public IFieldEquation
{
public:
/// Typedef for the the spectral field component ID iterator
typedef std::vector<FieldComponents::Spectral::Id>::const_iterator SpectralComponent_iterator;

/// Typedef for the the spectral field component ID iterator range
typedef std::pair<SpectralComponent_iterator,SpectralComponent_iterator> SpectralComponent_range;

/**
* @brief Simple constructor
*
Expand Down Expand Up @@ -86,12 +80,12 @@ namespace Equations {
/**
* @brief Get the number of spectral components
*/
int nSpectral() const;
int nSpectral() const final;

/**
* @brief Get vector spectral component range
*/
SpectralComponent_range spectralRange() const;
SpectralComponent_range spectralRange() const final;

/**
* @brief Transfer solver solution to equation unknown
Expand Down
5 changes: 0 additions & 5 deletions Components/Framework/include/QuICC/Timestep/Coordinator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ namespace Timestep {
*/
bool finishedStep() const;

/**
* @brief Set solve time
*/
void setSolveTime(const std::size_t timeId);

/**
* @brief Update equation explicit linear input to solver
*
Expand Down
5 changes: 0 additions & 5 deletions Components/Framework/include/QuICC/Timestep/Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ namespace Timestep {
*/
virtual bool finishedStep() const = 0;

/**
* @brief Set solve time
*/
virtual void setSolveTime(const std::size_t timeId) = 0;

/**
* @brief Update equation explicit linear input to solver
*
Expand Down
10 changes: 10 additions & 0 deletions Components/Framework/src/Equations/IScalarEquation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ namespace Equations {
return std::visit([](auto&& p)->const Resolution& {return p->dom(0).res();}, this->spUnknown());
}

int IScalarEquation::nSpectral() const
{
return this->mRequirements.field(this->name()).spectralIds().size();
}

typename IScalarEquation::SpectralComponent_range IScalarEquation::spectralRange() const
{
return std::make_pair(this->mRequirements.field(this->name()).spectralIds().begin(), this->mRequirements.field(this->name()).spectralIds().end());
}

void IScalarEquation::initSpectralMatrices()
{
// Make sure it is safe to do nothing
Expand Down
12 changes: 7 additions & 5 deletions Components/Framework/src/Timestep/Coordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "QuICC/Debug/DebuggerMacro.h"
#include "Timestep/RungeKuttaCB/Factory.hpp"
#include "Timestep/PredictorCorrector/Factory.hpp"
#include "Timestep/PredictorCorrector/FactoryViews.hpp"

namespace QuICC {

Expand Down Expand Up @@ -44,11 +45,6 @@ namespace Timestep {
return this->mpImpl->finishedStep();
}

void Coordinator::setSolveTime(const std::size_t timeId)
{
this->mpImpl->setSolveTime(timeId);
}

void Coordinator::getExplicitInput(const std::size_t opId, const ScalarEquation_range& scalEq, const VectorEquation_range& vectEq, const ScalarVariable_map& scalVar, const VectorVariable_map& vectVar)
{
this->mpImpl->getExplicitInput(opId, scalEq, vectEq, scalVar, vectVar);
Expand Down Expand Up @@ -79,6 +75,12 @@ namespace Timestep {

// Try Predictor-Corrector schemes
if(!this->mpImpl)
{
this->mpImpl = PredictorCorrector::makeInterfaceViews(schemeId, time, cfl, maxError, scalEq, vectEq, pseudo);
}

// Try old Predictor-Corrector schemes
if(!this->mpImpl)
{
this->mpImpl = PredictorCorrector::makeInterface(schemeId, time, cfl, maxError, scalEq, vectEq, pseudo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ template <typename TScheme> class Interface : public Timestep::Interface
*/
bool finishedStep() const final;

/**
* @brief Set solve time
*/
void setSolveTime(const std::size_t timeId) final;

/**
* @brief Update equation explicit linear input to solver
*
Expand Down Expand Up @@ -127,6 +122,10 @@ template <typename TScheme> class Interface : public Timestep::Interface
void printInfo(std::ostream& stream) final;

protected:
/**
* @brief Set solve time
*/
void setSolveTime(const std::size_t timeId);
private:
/**
* @brief Update time dependence
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(tags
ImexPc2
ImexPc2b
)

include(RegisterTags)
Expand Down
55 changes: 55 additions & 0 deletions Components/TimestepPcViews/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# CMake setup for TimestepPc
set(QUICC_CURRENT_COMPONENT_LIB TimestepPcViews)
set(QUICC_CURRENT_COMPONENT_DIR Components/TimestepPcViews)
set(QUICC_CURRENT_COMPONENT_LIB_NAMESPACE "${QUICC_CURRENT_COMPONENT_LIB}::")
message(DEBUG "QUICC_CURRENT_COMPONENT_LIB_NAMESPACE: ${QUICC_CURRENT_COMPONENT_LIB_NAMESPACE}" )

# Set library sources visibility
set(QUICC_CMAKE_SRC_VISIBILITY PRIVATE)

include(cmake.d/setup/RegisterTimestepId.cmake)

add_library(${QUICC_CURRENT_COMPONENT_LIB} "")
set_target_properties(${QUICC_CURRENT_COMPONENT_LIB} PROPERTIES LINKER_LANGUAGE CXX)

target_include_directories(${QUICC_CURRENT_COMPONENT_LIB}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

set(PHS
Timestep/PredictorCorrector/FactoryViews.hpp
)

# Add public header
set_target_properties(${QUICC_CURRENT_COMPONENT_LIB}
PROPERTIES
PUBLIC_HEADER "${PHS}"
)

add_subdirectory(Timestep)

# Dependencies
target_link_libraries(${QUICC_CURRENT_COMPONENT_LIB}
PUBLIC
QuICC::Framework
)

# Alias
add_library(${QUICC_NAMESPACE}${QUICC_CURRENT_COMPONENT_LIB} ALIAS
"${QUICC_CURRENT_COMPONENT_LIB}")

# TestSuite
string(TOUPPER "${QUICC_CURRENT_COMPONENT_LIB}" _tstag)
option(QUICC_TESTSUITE_${_tstag} "Enable Timestep/PredictorCorrector component testsuite?" OFF)
if(QUICC_TESTSUITE_${_tstag})
add_subdirectory(TestSuite)
endif(QUICC_TESTSUITE_${_tstag})

# Export info
quicc_export_target(${QUICC_CURRENT_COMPONENT_LIB}
COMPONENT ${QUICC_CURRENT_COMPONENT_LIB}
DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}
)
24 changes: 24 additions & 0 deletions Components/TimestepPcViews/TestSuite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
include(BundleCatch2)

# Set component test library name
set(QUICC_CURRENT_COMPONENT_TEST_LIB ${QUICC_CURRENT_COMPONENT_LIB}_ts)

# Create component Testsuite library
add_library(${QUICC_CURRENT_COMPONENT_TEST_LIB} "")
set_target_properties(${QUICC_CURRENT_COMPONENT_TEST_LIB} PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(${QUICC_CURRENT_COMPONENT_TEST_LIB}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

target_link_libraries(${QUICC_CURRENT_COMPONENT_TEST_LIB}
PUBLIC
${QUICC_CURRENT_COMPONENT_LIB}
QuICC::TestSuite
Catch2::Catch2
)

# Add source and tests directories
add_subdirectory(Timestep)
add_subdirectory(Tests)
33 changes: 33 additions & 0 deletions Components/TimestepPcViews/TestSuite/Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
message(VERBOSE "Enabling Timestep/PredictorCorrector tests:")

set(TestExe TimestepPcTests)

# Add target for all tests
add_executable(${TestExe} TimestepPcTests.cpp)

target_link_libraries(${TestExe}
${QUICC_CURRENT_COMPONENT_TEST_LIB}
)

set(QUICC_WORK_DIR "${CMAKE_BINARY_DIR}/${QUICC_CURRENT_COMPONENT_DIR}/TestSuite")

set_target_properties(
${TestExe}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
"${QUICC_WORK_DIR}"
)
list(APPEND CMAKE_MESSAGE_INDENT "${QUICC_CMAKE_INDENT}")

include(ConfigureTests)
set(_tests
ImExPC2
)
foreach(_test ${_tests})
quicc_add_test(${_test}
COMMAND ${TestExe}
KEYWORD Scheme
)
endforeach()

list(POP_BACK CMAKE_MESSAGE_INDENT)
44 changes: 44 additions & 0 deletions Components/TimestepPcViews/TestSuite/Tests/TemplateTest.cpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @file @[email protected]
* @brief Tests for the @Scheme@ timestepper
*/


// System includes
//
#include <catch2/catch.hpp>
#include <fstream>

// Project includes
//
#include "Environment/QuICCEnv.hpp"
#include "Timestep/PredictorCorrector/@[email protected]"
#include "TestSuite/Timestep/PredictorCorrector/TestArgs.hpp"
#include "TestSuite/Timestep/PredictorCorrector/TestHelper.hpp"

namespace currentts = ::QuICC::TestSuite::Timestep::PredictorCorrector;
typedef ::QuICC::Timestep::PredictorCorrector::@Scheme@ SchemeType;

TEST_CASE( "@Scheme@ timestepper test", "[@Scheme@]" ){

// Init Environment
QuICC::QuICCEnv();

Catch::StringMaker<double>::precision = 15;

for(auto&& id: currentts::args().params)
{
currentts::Test test(id);

auto spStepper = currentts::createTimestepper<SchemeType>(test);
currentts::setupTimestepper<SchemeType>(test, spStepper);

// Test a single step forward
currentts::singleStepForward<SchemeType>(test, spStepper);

// Test multiple steps forward
currentts::multiStepForward<SchemeType>(test, spStepper, 4);

CHECK( true );
}
}
Loading