Commit 9cf76f47 authored by steffen.schotthoefer's avatar steffen.schotthoefer
Browse files

cleanup of header files for solvers

parent e3b0681c
Pipeline #96792 failed with stages
in 8 minutes and 9 seconds
#ifndef CSDSNSOLVER_H #ifndef CSDSNSOLVER_H
#define CSDSNSOLVER_H #define CSDSNSOLVER_H
#include <mpi.h>
#include "solvers/solverbase.h" #include "solvers/solverbase.h"
class CSDSNSolver : public Solver class CSDSNSolver : public Solver
......
#ifndef MNSOLVER_H #ifndef MNSOLVER_H
#define MNSOLVER_H #define MNSOLVER_H
#include "entropies/entropybase.h"
#include "optimizers/optimizerbase.h"
#include "solverbase.h" #include "solverbase.h"
#include "sphericalharmonics.h"
class EntropyBase;
class QuadratureBase;
class SphericalHarmonics;
class OptimizerBase;
class MNSolver : public Solver class MNSolver : public Solver
{ {
...@@ -31,8 +33,8 @@ class MNSolver : public Solver ...@@ -31,8 +33,8 @@ class MNSolver : public Solver
VectorVector _sigmaA; /*! @brief: Absorbtion coefficient for all energies */ VectorVector _sigmaA; /*! @brief: Absorbtion coefficient for all energies */
SphericalHarmonics _basis; /*! @brief: Class to compute and store current spherical harmonics basis */ SphericalHarmonics* _basis; /*! @brief: Class to compute and store current spherical harmonics basis */
VectorVector _moments; /*! @brief: Moment Vector pre-computed at each quadrature point: dim= _nq x _nTotalEntries */ VectorVector _moments; /*! @brief: Moment Vector pre-computed at each quadrature point: dim= _nq x _nTotalEntries */
Vector _scatterMatDiag; /*! @brief: Diagonal of the scattering matrix (its a diagonal matrix by construction) */ Vector _scatterMatDiag; /*! @brief: Diagonal of the scattering matrix (its a diagonal matrix by construction) */
......
#ifndef PNSOLVER_H #ifndef PNSOLVER_H
#define PNSOLVER_H #define PNSOLVER_H
#include <cmath> #include "solverbase.h"
#include "solvers/solverbase.h"
class PNSolver : public Solver class PNSolver : public Solver
{ {
......
#ifndef SOLVER_H #ifndef SOLVER_H
#define SOLVER_H #define SOLVER_H
#include <string>
// include Matrix, Vector definitions // include Matrix, Vector definitions
#include "fluxes/numericalflux.h" #include "settings/globalconstants.h"
#include "io.h"
#include "kernels/scatteringkernelbase.h"
#include "problems/problembase.h"
#include "quadratures/quadraturebase.h"
#include "settings/config.h"
#include "settings/typedef.h" #include "settings/typedef.h"
// Forward Declarations // Forward Declarations
// class NumericalFlux; class NumericalFlux;
// class Mesh; class Mesh;
// class Config; class Config;
// class ProblemBase; class ProblemBase;
// class QuadratureBase; class QuadratureBase;
class Solver class Solver
{ {
......
#include "fluxes/numericalflux.h"
#include "io.h"
#include "settings/config.h"
#include "solvers/csdsnsolver.h" #include "solvers/csdsnsolver.h"
CSDSNSolver::CSDSNSolver( Config* settings ) : Solver( settings ) { _dose = std::vector<double>( _settings->GetNCells(), 0.0 ); } CSDSNSolver::CSDSNSolver( Config* settings ) : Solver( settings ) { _dose = std::vector<double>( _settings->GetNCells(), 0.0 ); }
......
#include "solvers/mnsolver.h" #include "solvers/mnsolver.h"
#include "entropies/entropybase.h"
#include "fluxes/numericalflux.h"
#include "io.h"
#include "optimizers/optimizerbase.h"
#include "quadratures/quadraturebase.h"
#include "settings/config.h"
#include "solvers/sphericalharmonics.h"
#include "toolboxes/textprocessingtoolbox.h" #include "toolboxes/textprocessingtoolbox.h"
#include <mpi.h> #include <mpi.h>
//#include <chrono> //#include <chrono>
MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder( settings->GetMaxMomentDegree() ), _basis( _nMaxMomentsOrder ) { MNSolver::MNSolver( Config* settings ) : Solver( settings ) {
// Is this good (fast) code using a constructor list?
_nTotalEntries = GlobalIndex( _nMaxMomentsOrder, int( _nMaxMomentsOrder ) ) + 1; // Is this good (fast) code using a constructor list?
_quadrature = QuadratureBase::CreateQuadrature( _settings->GetQuadName(), settings->GetQuadOrder() ); _nMaxMomentsOrder = settings->GetMaxMomentDegree();
_nTotalEntries = GlobalIndex( _nMaxMomentsOrder, int( _nMaxMomentsOrder ) ) + 1;
_quadrature = QuadratureBase::CreateQuadrature( _settings->GetQuadName(), settings->GetQuadOrder() );
// transform sigmaT and sigmaS in sigmaA. // transform sigmaT and sigmaS in sigmaA.
_sigmaA = VectorVector( _nEnergies, Vector( _nCells, 0 ) ); // Get rid of this extra vektor! _sigmaA = VectorVector( _nEnergies, Vector( _nCells, 0 ) ); // Get rid of this extra vektor!
...@@ -34,6 +43,8 @@ MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder( ...@@ -34,6 +43,8 @@ MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder(
_alpha = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) ); _alpha = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) );
// Initialize and Pre-Compute Moments at quadrature points // Initialize and Pre-Compute Moments at quadrature points
_basis = new SphericalHarmonics( _nMaxMomentsOrder );
_moments = VectorVector( _nq, Vector( _nTotalEntries, 0.0 ) ); _moments = VectorVector( _nq, Vector( _nTotalEntries, 0.0 ) );
ComputeMoments(); ComputeMoments();
} }
...@@ -42,6 +53,7 @@ MNSolver::~MNSolver() { ...@@ -42,6 +53,7 @@ MNSolver::~MNSolver() {
delete _quadrature; delete _quadrature;
delete _entropy; delete _entropy;
delete _optimizer; delete _optimizer;
delete _basis;
} }
int MNSolver::GlobalIndex( int l, int k ) const { int MNSolver::GlobalIndex( int l, int k ) const {
...@@ -57,7 +69,7 @@ void MNSolver::ComputeMoments() { ...@@ -57,7 +69,7 @@ void MNSolver::ComputeMoments() {
my = _quadrature->GetPointsSphere()[idx_quad][0]; my = _quadrature->GetPointsSphere()[idx_quad][0];
phi = _quadrature->GetPointsSphere()[idx_quad][1]; phi = _quadrature->GetPointsSphere()[idx_quad][1];
_moments[idx_quad] = _basis.ComputeSphericalBasis( my, phi ); _moments[idx_quad] = _basis->ComputeSphericalBasis( my, phi );
} }
} }
......
#include "solvers/pnsolver.h" #include "solvers/pnsolver.h"
#include "fluxes/numericalflux.h"
#include "io.h"
#include "settings/config.h"
#include "toolboxes/errormessages.h" #include "toolboxes/errormessages.h"
#include "toolboxes/textprocessingtoolbox.h" #include "toolboxes/textprocessingtoolbox.h"
#include <mpi.h> #include <mpi.h>
PNSolver::PNSolver( Config* settings ) : Solver( settings ) { PNSolver::PNSolver( Config* settings ) : Solver( settings ) {
......
#include "solvers/snsolver.h" #include "solvers/snsolver.h"
#include "fluxes/numericalflux.h"
#include "io.h"
#include "mesh.h"
#include "settings/config.h"
#include <mpi.h> #include <mpi.h>
SNSolver::SNSolver( Config* settings ) : Solver( settings ) {} SNSolver::SNSolver( Config* settings ) : Solver( settings ) {}
...@@ -135,19 +140,19 @@ void SNSolver::Solve() { ...@@ -135,19 +140,19 @@ void SNSolver::Solve() {
} }
void SNSolver::Save() const { void SNSolver::Save() const {
std::vector<std::string> fieldNames{"flux"}; std::vector<std::string> fieldNames{ "flux" };
std::vector<double> flux( _nCells, 0.0 ); std::vector<double> flux( _nCells, 0.0 );
for( unsigned i = 0; i < _nCells; ++i ) { for( unsigned i = 0; i < _nCells; ++i ) {
flux[i] = dot( _psi[i], _weights ); flux[i] = dot( _psi[i], _weights );
} }
std::vector<std::vector<double>> scalarField( 1, flux ); std::vector<std::vector<double>> scalarField( 1, flux );
std::vector<std::vector<std::vector<double>>> results{scalarField}; std::vector<std::vector<std::vector<double>>> results{ scalarField };
ExportVTK( _settings->GetOutputFile(), results, fieldNames, _mesh ); ExportVTK( _settings->GetOutputFile(), results, fieldNames, _mesh );
} }
void SNSolver::Save( int currEnergy ) const { void SNSolver::Save( int currEnergy ) const {
std::vector<std::string> fieldNames{"flux"}; std::vector<std::string> fieldNames{ "flux" };
std::vector<std::vector<double>> scalarField( 1, _solverOutput ); std::vector<std::vector<double>> scalarField( 1, _solverOutput );
std::vector<std::vector<std::vector<double>>> results{scalarField}; std::vector<std::vector<std::vector<double>>> results{ scalarField };
ExportVTK( _settings->GetOutputFile() + "_" + std::to_string( currEnergy ), results, fieldNames, _mesh ); ExportVTK( _settings->GetOutputFile() + "_" + std::to_string( currEnergy ), results, fieldNames, _mesh );
} }
#include "io.h"
#include "settings/config.h"
#include "solvers/snsolverMPI.h" #include "solvers/snsolverMPI.h"
#include <mpi.h> #include <mpi.h>
......
#include "solvers/solverbase.h" #include "solvers/solverbase.h"
#include "fluxes/numericalflux.h"
#include "io.h" #include "io.h"
#include "kernels/scatteringkernelbase.h"
#include "mesh.h" #include "mesh.h"
#include "problems/problembase.h"
#include "quadratures/quadraturebase.h" #include "quadratures/quadraturebase.h"
#include "settings/globalconstants.h" #include "settings/globalconstants.h"
#include "solvers/mnsolver.h" #include "solvers/mnsolver.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment