#ifndef TESTSTOCHASTICCOLLOCATION_HPP #define TESTSTOCHASTICCOLLOCATION_HPP #include "StochasticCollocation.hpp" #include "TestEnvironment.hpp" struct TestParams { std::string problemName; std::string quantity; std::string model; }; Logging &operator<<(Logging &s, const TestParams &testParams) { return s << "Problem Name: " << testParams.problemName << endl << "Quantity: " << testParams.quantity << endl << "Model: " << testParams.model << endl; } class TestStochasticCollocation : public TestWithParam { protected: bool onlyFine = true; int level = 3; int samples; double epsilon; MeshesCreator meshesCreator; PDESolverCreator pdeSolverCreator; std::unique_ptr scSeriell; std::unique_ptr scParallel; double MeanTolerance() const { return sqrt(1.0 / samples); } double SVarTolerance() const { return sqrt(10.0 / samples); } TestStochasticCollocation(double epsilon, int samples) : samples(samples), epsilon(epsilon), meshesCreator(MeshesCreator(). WithDistribute("RCB"). WithoutOverlap()), pdeSolverCreator(PDESolverCreator(). WithProblem(GetParam().problemName). WithQuantity(GetParam().quantity). WithModel(GetParam().model)), scSeriell(EstimatorCreator("MonteCarlo"). WithPDESolverCreator(pdeSolverCreator). WithMeshesCreator(meshesCreator). WithInitSamples(samples). WithOnlyFine(onlyFine). WithInitLevel(level). WithEpsilon(epsilon). WithParallel(false). CreateUnique()), scParallel(EstimatorCreator("MonteCarlo"). WithPDESolverCreator(pdeSolverCreator). WithMeshesCreator(meshesCreator). WithInitSamples(samples). WithOnlyFine(onlyFine). WithEpsilon(epsilon). WithInitLevel(level). WithParallel(true). CreateUnique()) {} }; #endif //TESTSTOCHASTICCOLLOCATION_HPP