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
#define CSDSNSOLVER_H
#include <mpi.h>
#include "solvers/solverbase.h"
class CSDSNSolver : public Solver
......
#ifndef MNSOLVER_H
#define MNSOLVER_H
#include "entropies/entropybase.h"
#include "optimizers/optimizerbase.h"
#include "solverbase.h"
#include "sphericalharmonics.h"
class EntropyBase;
class QuadratureBase;
class SphericalHarmonics;
class OptimizerBase;
class MNSolver : public Solver
{
......@@ -31,8 +33,8 @@ class MNSolver : public Solver
VectorVector _sigmaA; /*! @brief: Absorbtion coefficient for all energies */
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 */
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 */
Vector _scatterMatDiag; /*! @brief: Diagonal of the scattering matrix (its a diagonal matrix by construction) */
......
#ifndef PNSOLVER_H
#define PNSOLVER_H
#include <cmath>
#include "solvers/solverbase.h"
#include "solverbase.h"
class PNSolver : public Solver
{
......
#ifndef SOLVER_H
#define SOLVER_H
#include <string>
// include Matrix, Vector definitions
#include "fluxes/numericalflux.h"
#include "io.h"
#include "kernels/scatteringkernelbase.h"
#include "problems/problembase.h"
#include "quadratures/quadraturebase.h"
#include "settings/config.h"
#include "settings/globalconstants.h"
#include "settings/typedef.h"
// Forward Declarations
// class NumericalFlux;
// class Mesh;
// class Config;
// class ProblemBase;
// class QuadratureBase;
class NumericalFlux;
class Mesh;
class Config;
class ProblemBase;
class QuadratureBase;
class Solver
{
......
#include "fluxes/numericalflux.h"
#include "io.h"
#include "settings/config.h"
#include "solvers/csdsnsolver.h"
CSDSNSolver::CSDSNSolver( Config* settings ) : Solver( settings ) { _dose = std::vector<double>( _settings->GetNCells(), 0.0 ); }
......
#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 <mpi.h>
//#include <chrono>
MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder( settings->GetMaxMomentDegree() ), _basis( _nMaxMomentsOrder ) {
// Is this good (fast) code using a constructor list?
MNSolver::MNSolver( Config* settings ) : Solver( settings ) {
_nTotalEntries = GlobalIndex( _nMaxMomentsOrder, int( _nMaxMomentsOrder ) ) + 1;
_quadrature = QuadratureBase::CreateQuadrature( _settings->GetQuadName(), settings->GetQuadOrder() );
// Is this good (fast) code using a constructor list?
_nMaxMomentsOrder = settings->GetMaxMomentDegree();
_nTotalEntries = GlobalIndex( _nMaxMomentsOrder, int( _nMaxMomentsOrder ) ) + 1;
_quadrature = QuadratureBase::CreateQuadrature( _settings->GetQuadName(), settings->GetQuadOrder() );
// transform sigmaT and sigmaS in sigmaA.
_sigmaA = VectorVector( _nEnergies, Vector( _nCells, 0 ) ); // Get rid of this extra vektor!
......@@ -34,6 +43,8 @@ MNSolver::MNSolver( Config* settings ) : Solver( settings ), _nMaxMomentsOrder(
_alpha = VectorVector( _nCells, Vector( _nTotalEntries, 0.0 ) );
// Initialize and Pre-Compute Moments at quadrature points
_basis = new SphericalHarmonics( _nMaxMomentsOrder );
_moments = VectorVector( _nq, Vector( _nTotalEntries, 0.0 ) );
ComputeMoments();
}
......@@ -42,6 +53,7 @@ MNSolver::~MNSolver() {
delete _quadrature;
delete _entropy;
delete _optimizer;
delete _basis;
}
int MNSolver::GlobalIndex( int l, int k ) const {
......@@ -57,7 +69,7 @@ void MNSolver::ComputeMoments() {
my = _quadrature->GetPointsSphere()[idx_quad][0];
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 "fluxes/numericalflux.h"
#include "io.h"
#include "settings/config.h"
#include "toolboxes/errormessages.h"
#include "toolboxes/textprocessingtoolbox.h"
#include <mpi.h>
PNSolver::PNSolver( Config* settings ) : Solver( settings ) {
......
#include "solvers/snsolver.h"
#include "fluxes/numericalflux.h"
#include "io.h"
#include "mesh.h"
#include "settings/config.h"
#include <mpi.h>
SNSolver::SNSolver( Config* settings ) : Solver( settings ) {}
......@@ -135,19 +140,19 @@ void SNSolver::Solve() {
}
void SNSolver::Save() const {
std::vector<std::string> fieldNames{"flux"};
std::vector<std::string> fieldNames{ "flux" };
std::vector<double> flux( _nCells, 0.0 );
for( unsigned i = 0; i < _nCells; ++i ) {
flux[i] = dot( _psi[i], _weights );
}
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 );
}
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<std::vector<double>>> results{scalarField};
std::vector<std::vector<std::vector<double>>> results{ scalarField };
ExportVTK( _settings->GetOutputFile() + "_" + std::to_string( currEnergy ), results, fieldNames, _mesh );
}
#include "io.h"
#include "settings/config.h"
#include "solvers/snsolverMPI.h"
#include <mpi.h>
......
#include "solvers/solverbase.h"
#include "fluxes/numericalflux.h"
#include "io.h"
#include "kernels/scatteringkernelbase.h"
#include "mesh.h"
#include "problems/problembase.h"
#include "quadratures/quadraturebase.h"
#include "settings/globalconstants.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