Commit 002d134b authored by Dominik Thoennes's avatar Dominik Thoennes
Browse files

first steps in removing PetscInt

parent 11984379
Pipeline #34423 failed with stages
in 40 minutes and 25 seconds
......@@ -551,7 +551,7 @@ void tokamak( TokamakDomain tokamakDomain,
{
const auto relativeResidualToleranceCoarseGrid = 1e-30;
const auto absoluteResidualToleranceCoarseGrid = 1e-12;
const auto maxIterationsCoarseGrid = static_cast< PetscInt >( solverSettings.maxCoarseGridSolverIterations );
const auto maxIterationsCoarseGrid = static_cast< idx_t >( solverSettings.maxCoarseGridSolverIterations );
auto actualCoarseGridSolver =
std::make_shared< PETScCGSolver< LaplaceOperator_T > >( storage,
minLevel,
......
......@@ -100,7 +100,7 @@ public:
storage_( storage ), velocityUBC_( velocityUBC ), velocityVBC_( velocityVBC )
{
tmpRHS_ = std::make_shared< Function_T< real_t > >( "tmpRHS", storage, minLevel, maxLevel );
numerator_ = std::make_shared< Function_T< PetscInt > >( "numerator", storage, minLevel, maxLevel );
numerator_ = std::make_shared< Function_T< idx_t > >( "numerator", storage, minLevel, maxLevel );
}
void solve( const Operator_T & A,
......@@ -119,11 +119,11 @@ public:
}
private:
std::shared_ptr< Function_T< PetscInt > > numerator_;
std::shared_ptr< Function_T< real_t > > tmpRHS_;
std::shared_ptr< PrimitiveStorage > storage_;
std::function< real_t ( const hyteg::Point3D & ) > velocityUBC_;
std::function< real_t ( const hyteg::Point3D & ) > velocityVBC_;
std::shared_ptr< Function_T< idx_t > > numerator_;
std::shared_ptr< Function_T< real_t > > tmpRHS_;
std::shared_ptr< PrimitiveStorage > storage_;
std::function< real_t( const hyteg::Point3D& ) > velocityUBC_;
std::function< real_t( const hyteg::Point3D& ) > velocityVBC_;
#else
public:
PetscSolver( const std::shared_ptr< hyteg::PrimitiveStorage > &,
......
......@@ -84,10 +84,10 @@ void solveProblem( std::shared_ptr< hyteg::PrimitiveStorage >& storage, uint_t l
opType lapOp( storage, level, level );
// determine indices and dimensions
funcType< PetscInt > enumerator( "enumerator", storage, level, level );
funcType< idx_t > enumerator( "enumerator", storage, level, level );
enumerator.enumerate( level );
typedef typename FunctionTrait< funcType< PetscInt > >::Tag enumTag;
typedef typename FunctionTrait< funcType< idx_t > >::Tag enumTag;
uint_t globalDoFs = numberOfGlobalDoFs< enumTag >( *storage, level );
uint_t localDoFs = numberOfLocalDoFs< enumTag >( *storage, level );
......
......@@ -180,7 +180,7 @@ caseResult analyseCase( std::shared_ptr< PrimitiveStorage > storage,
funcType& u,
funcType& error )
{
typedef typename FunctionTrait< typename funcType::template FunctionType< PetscInt > >::Tag funcTag;
typedef typename FunctionTrait< typename funcType::template FunctionType< idx_t > >::Tag funcTag;
// embed numeric solution in next finer space
embedInRefinedSpace( u, level );
......@@ -379,7 +379,7 @@ void solve_using_pimped_form( uint_t minLevel, uint_t maxLevel, bool outputVTK )
{
// perform some template magic
typedef typename opType::srcType funcType;
// typedef typename FunctionTrait< typename opType::srcType::template FunctionType<PetscInt> >::Tag funcTag;
// typedef typename FunctionTrait< typename opType::srcType::template FunctionType<idx_t> >::Tag funcTag;
// generate annulus mesh in polar coordinates
real_t rmin = 1.0;
......
......@@ -63,7 +63,7 @@ caseResult analyseCase( std::shared_ptr< PrimitiveStorage > storage,
const funcType& u,
funcType& error )
{
typedef typename FunctionTrait< typename funcType::template FunctionType< PetscInt > >::Tag funcTag;
typedef typename FunctionTrait< typename funcType::template FunctionType< idx_t > >::Tag funcTag;
// embed numeric solution in next finer space
P2toP2QuadraticProlongation embeddor;
......
......@@ -111,7 +111,7 @@ int main( int argc, char* argv[] )
hyteg::P2Function< double > y( "y", storage, level, level );
hyteg::P2Function< double > z( "z", storage, level, level );
hyteg::P2Function< double > diff( "diff", storage, level, level );
hyteg::P2Function< PetscInt > numerator( "numerator", storage, level, level );
hyteg::P2Function< idx_t > numerator( "numerator", storage, level, level );
wcTimingTreeApp.stop( "Function allocation" );
const uint_t totalDoFs = numberOfGlobalDoFs< hyteg::P2FunctionTag >( *storage, level );
......
......@@ -108,7 +108,7 @@ int main( int argc, char* argv[] )
hyteg::P1Function< double > y( "y", storage, level, level );
hyteg::P1Function< double > z( "z", storage, level, level );
hyteg::P1Function< double > diff( "diff", storage, level, level );
hyteg::P1Function< PetscInt > numerator( "numerator", storage, level, level );
hyteg::P1Function< idx_t > numerator( "numerator", storage, level, level );
wcTimingTreeApp.stop( "Function allocation" );
const uint_t totalDoFs = numberOfGlobalDoFs< hyteg::P1FunctionTag >( *storage, level );
......
......@@ -114,7 +114,7 @@ int main( int argc, char* argv[] )
hyteg::P1Function< double > diff( "diff", storage, level, level );
x.interpolate( exact, level, hyteg::Inner );
//hyteg::communication::syncFunctionBetweenPrimitives(x,level);
hyteg::P1Function< PetscInt > numerator( "numerator", storage, level, level );
hyteg::P1Function< idx_t > numerator( "numerator", storage, level, level );
hyteg::P1ConstantLaplaceOperator mass( storage, level, level );
// for (const auto & faceIT : storage->getFaces()) {
......@@ -155,7 +155,7 @@ int main( int argc, char* argv[] )
// WALBERLA_CRITICAL_SECTION_START
// for (auto &edgeIT : storage->getEdges()) {
// auto edge = edgeIT.second;
// hyteg::vertexdof::macroedge::printFunctionMemory< PetscInt >(level, *edge, numerator.getEdgeDataID());
// hyteg::vertexdof::macroedge::printFunctionMemory< idx_t >(level, *edge, numerator.getEdgeDataID());
// }
// WALBERLA_CRITICAL_SECTION_END
......
......@@ -281,7 +281,7 @@ int main( int argc, char* argv[] )
}
#if 0
auto numerator = std::make_shared< hyteg::P1StokesFunction< PetscInt > >( "numerator", storage, level, level );
auto numerator = std::make_shared< hyteg::P1StokesFunction< idx_t > >( "numerator", storage, level, level );
uint_t globalSize = 0;
const uint_t localSize = numerator->enumerate(level, globalSize);
PETScManager petscManager( &argc, &argv );
......
......@@ -21,7 +21,8 @@
#include "core/DataTypes.h"
#include "core/uid/all.h"
#include "hyteg/types/flags.hpp"
#include "hyteg/types/types.hpp"
namespace hyteg {
......
......@@ -103,11 +103,11 @@ class StrongFreeSlipWrapper : public Operator< typename OpType::srcType, typenam
/// \param level level in mesh hierarchy for which local operator is to be assembled
/// \param flag determines on which primitives this operator is assembled
///
void assembleLocalMatrix( const std::shared_ptr< SparseMatrixProxy >& mat,
const typename OpType::srcType::template FunctionType< PetscInt >& numeratorSrc,
const typename OpType::dstType::template FunctionType< PetscInt >& numeratorDst,
uint_t level,
DoFType flag ) const
void assembleLocalMatrix( const std::shared_ptr< SparseMatrixProxy >& mat,
const typename OpType::srcType::template FunctionType< idx_t >& numeratorSrc,
const typename OpType::dstType::template FunctionType< idx_t >& numeratorDst,
uint_t level,
DoFType flag ) const
{
auto matProxyOp = mat->createCopy();
hyteg::petsc::createMatrix< OpType >( *op_, numeratorSrc, numeratorDst, matProxyOp, level, flag );
......@@ -153,30 +153,30 @@ namespace petsc {
template <>
inline void createMatrix( const StrongFreeSlipWrapper< P1BlendingStokesOperator, P1ProjectNormalOperator, true >& opr,
const P1StokesFunction< PetscInt >& src,
const P1StokesFunction< PetscInt >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
const P1StokesFunction< idx_t >& src,
const P1StokesFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
{
WALBERLA_ABORT( "Not implemented." );
}
template <>
inline void createMatrix( const StrongFreeSlipWrapper< P1BlendingStokesOperator, P1ProjectNormalOperator, false >& opr,
const P1StokesFunction< PetscInt >& src,
const P1StokesFunction< PetscInt >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
const P1StokesFunction< idx_t >& src,
const P1StokesFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
{
WALBERLA_ABORT( "Not implemented." );
}
template <>
inline void createMatrix( const StrongFreeSlipWrapper< P2P1TaylorHoodStokesOperator, P2ProjectNormalOperator, true >& opr,
const P2P1TaylorHoodFunction< PetscInt >& src,
const P2P1TaylorHoodFunction< PetscInt >& dst,
const P2P1TaylorHoodFunction< idx_t >& src,
const P2P1TaylorHoodFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......@@ -186,8 +186,8 @@ inline void createMatrix( const StrongFreeSlipWrapper< P2P1TaylorHoodStokesOpera
template <>
inline void createMatrix( const StrongFreeSlipWrapper< P2P1TaylorHoodStokesOperator, P2ProjectNormalOperator, false >& opr,
const P2P1TaylorHoodFunction< PetscInt >& src,
const P2P1TaylorHoodFunction< PetscInt >& dst,
const P2P1TaylorHoodFunction< idx_t >& src,
const P2P1TaylorHoodFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......@@ -196,23 +196,25 @@ inline void createMatrix( const StrongFreeSlipWrapper< P2P1TaylorHoodStokesOpera
}
template <>
inline void createMatrix( const StrongFreeSlipWrapper< P2P1ElementwiseBlendingStokesOperator, P2ProjectNormalOperator, true >& opr,
const P2P1TaylorHoodFunction< PetscInt >& src,
const P2P1TaylorHoodFunction< PetscInt >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
inline void
createMatrix( const StrongFreeSlipWrapper< P2P1ElementwiseBlendingStokesOperator, P2ProjectNormalOperator, true >& opr,
const P2P1TaylorHoodFunction< idx_t >& src,
const P2P1TaylorHoodFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
{
opr.assembleLocalMatrix( mat, src, dst, level, flag );
}
template <>
inline void createMatrix( const StrongFreeSlipWrapper< P2P1ElementwiseBlendingStokesOperator, P2ProjectNormalOperator, false >& opr,
const P2P1TaylorHoodFunction< PetscInt >& src,
const P2P1TaylorHoodFunction< PetscInt >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
inline void
createMatrix( const StrongFreeSlipWrapper< P2P1ElementwiseBlendingStokesOperator, P2ProjectNormalOperator, false >& opr,
const P2P1TaylorHoodFunction< idx_t >& src,
const P2P1TaylorHoodFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
{
opr.assembleLocalMatrix( mat, src, dst, level, flag );
}
......
......@@ -267,8 +267,8 @@ typedef UnsteadyDiffusionOperator< P2Function< real_t >,
namespace petsc {
template <>
inline void createMatrix< P1ConstantUnsteadyDiffusionOperator >( const P1ConstantUnsteadyDiffusionOperator& opr,
const P1Function< PetscInt >& src,
const P1Function< PetscInt >& dst,
const P1Function< idx_t >& src,
const P1Function< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
uint_t level,
DoFType flag )
......@@ -278,8 +278,8 @@ inline void createMatrix< P1ConstantUnsteadyDiffusionOperator >( const P1Constan
template <>
inline void createMatrix< P2ConstantUnsteadyDiffusionOperator >( const P2ConstantUnsteadyDiffusionOperator& opr,
const P2Function< PetscInt >& src,
const P2Function< PetscInt >& dst,
const P2Function< idx_t >& src,
const P2Function< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
uint_t level,
DoFType flag )
......@@ -289,8 +289,8 @@ inline void createMatrix< P2ConstantUnsteadyDiffusionOperator >( const P2Constan
template <>
inline void createMatrix< P2ElementwiseUnsteadyDiffusionOperator >( const P2ElementwiseUnsteadyDiffusionOperator& opr,
const P2Function< PetscInt >& src,
const P2Function< PetscInt >& dst,
const P2Function< idx_t >& src,
const P2Function< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
uint_t level,
DoFType flag )
......
......@@ -32,7 +32,7 @@ namespace hyteg {
namespace petsc {
inline void createVectorFromFunction( const P1StokesFunction< PetscReal >& function,
const P1StokesFunction< PetscInt >& numerator,
const P1StokesFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
......@@ -47,7 +47,7 @@ inline void createVectorFromFunction( const P1StokesFunction< PetscReal >& func
}
inline void createFunctionFromVector( const P1StokesFunction< PetscReal >& function,
const P1StokesFunction< PetscInt >& numerator,
const P1StokesFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
......@@ -61,7 +61,7 @@ inline void createFunctionFromVector( const P1StokesFunction< PetscReal >& func
createFunctionFromVector( function.p, numerator.p, vec, level, flag );
}
inline void applyDirichletBC( const P1StokesFunction< PetscInt >& numerator, std::vector< PetscInt >& mat, uint_t level )
inline void applyDirichletBC( const P1StokesFunction< idx_t >& numerator, std::vector< PetscInt >& mat, uint_t level )
{
applyDirichletBC( numerator.uvw[0], mat, level );
applyDirichletBC( numerator.uvw[1], mat, level );
......@@ -74,8 +74,8 @@ inline void applyDirichletBC( const P1StokesFunction< PetscInt >& numerator, std
template < class OperatorType >
inline void createMatrix( const OperatorType& opr,
const P1StokesFunction< PetscInt >& src,
const P1StokesFunction< PetscInt >& dst,
const P1StokesFunction< idx_t >& src,
const P1StokesFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......@@ -103,8 +103,8 @@ inline void createMatrix( const OperatorType& opr,
template <>
inline void createMatrix< P1StokesBlockPreconditioner >( const P1StokesBlockPreconditioner& opr,
const P1StokesFunction< PetscInt >& src,
const P1StokesFunction< PetscInt >& dst,
const P1StokesFunction< idx_t >& src,
const P1StokesFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......
......@@ -33,7 +33,7 @@ namespace hyteg {
namespace petsc {
inline void createVectorFromFunction( const P2P1TaylorHoodFunction< PetscReal >& function,
const P2P1TaylorHoodFunction< PetscInt >& numerator,
const P2P1TaylorHoodFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
......@@ -48,7 +48,7 @@ inline void createVectorFromFunction( const P2P1TaylorHoodFunction< PetscReal >&
}
inline void createFunctionFromVector( const P2P1TaylorHoodFunction< PetscReal >& function,
const P2P1TaylorHoodFunction< PetscInt >& numerator,
const P2P1TaylorHoodFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
......@@ -62,7 +62,7 @@ inline void createFunctionFromVector( const P2P1TaylorHoodFunction< PetscReal >&
createFunctionFromVector( function.p, numerator.p, vec, level, flag );
}
inline void applyDirichletBC( const P2P1TaylorHoodFunction< PetscInt >& numerator, std::vector< PetscInt >& mat, uint_t level )
inline void applyDirichletBC( const P2P1TaylorHoodFunction< idx_t >& numerator, std::vector< PetscInt >& mat, uint_t level )
{
applyDirichletBC( numerator.uvw[0], mat, level );
applyDirichletBC( numerator.uvw[1], mat, level );
......@@ -75,8 +75,8 @@ inline void applyDirichletBC( const P2P1TaylorHoodFunction< PetscInt >& numerato
template < class OperatorType >
inline void createMatrix( const OperatorType& opr,
const P2P1TaylorHoodFunction< PetscInt >& src,
const P2P1TaylorHoodFunction< PetscInt >& dst,
const P2P1TaylorHoodFunction< idx_t >& src,
const P2P1TaylorHoodFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......@@ -112,8 +112,8 @@ inline void createMatrix( const OperatorType& opr,
template <>
inline void createMatrix< P2P1TaylorHoodStokesBlockPreconditioner >( const P2P1TaylorHoodStokesBlockPreconditioner& opr,
const P2P1TaylorHoodFunction< PetscInt >& src,
const P2P1TaylorHoodFunction< PetscInt >& dst,
const P2P1TaylorHoodFunction< idx_t >& src,
const P2P1TaylorHoodFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......
......@@ -28,7 +28,7 @@ namespace hyteg {
namespace petsc {
inline void createVectorFromFunction( const P2P2StokesFunction< PetscReal >& function,
const P2P2StokesFunction< PetscInt >& numerator,
const P2P2StokesFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
......@@ -43,7 +43,7 @@ inline void createVectorFromFunction( const P2P2StokesFunction< PetscReal >& fun
}
inline void createFunctionFromVector( const P2P2StokesFunction< PetscReal >& function,
const P2P2StokesFunction< PetscInt >& numerator,
const P2P2StokesFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
......@@ -57,7 +57,7 @@ inline void createFunctionFromVector( const P2P2StokesFunction< PetscReal >& fun
createFunctionFromVector( function.p, numerator.p, vec, level, flag );
}
inline void applyDirichletBC( const P2P2StokesFunction< PetscInt >& numerator, std::vector< PetscInt >& mat, uint_t level )
inline void applyDirichletBC( const P2P2StokesFunction< idx_t >& numerator, std::vector< PetscInt >& mat, uint_t level )
{
applyDirichletBC( numerator.uvw[0], mat, level );
applyDirichletBC( numerator.uvw[1], mat, level );
......@@ -70,8 +70,8 @@ inline void applyDirichletBC( const P2P2StokesFunction< PetscInt >& numerator, s
template < class OperatorType >
inline void createMatrix( const OperatorType& opr,
const P2P2StokesFunction< PetscInt >& src,
const P2P2StokesFunction< PetscInt >& dst,
const P2P2StokesFunction< idx_t >& src,
const P2P2StokesFunction< idx_t >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
size_t level,
DoFType flag )
......
......@@ -29,7 +29,7 @@
#include "hyteg/p1functionspace/VertexDoFIndexing.hpp"
#include "hyteg/petsc/PETScWrapper.hpp"
#include "hyteg/primitives/Cell.hpp"
#include "hyteg/types/flags.hpp"
#include "hyteg/types/types.hpp"
namespace hyteg {
namespace vertexdof {
......
......@@ -29,7 +29,7 @@
#include "hyteg/p1functionspace/VertexDoFIndexing.hpp"
#include "hyteg/petsc/PETScWrapper.hpp"
#include "hyteg/primitives/Edge.hpp"
#include "hyteg/types/flags.hpp"
#include "hyteg/types/types.hpp"
namespace hyteg {
namespace vertexdof {
......
......@@ -31,7 +31,7 @@
#include "hyteg/p1functionspace/VertexDoFMacroFace.hpp"
#include "hyteg/petsc/PETScWrapper.hpp"
#include "hyteg/primitives/Face.hpp"
#include "hyteg/types/flags.hpp"
#include "hyteg/types/types.hpp"
namespace hyteg {
namespace vertexdof {
......
......@@ -29,7 +29,7 @@
#include "hyteg/p1functionspace/VertexDoFIndexing.hpp"
#include "hyteg/petsc/PETScWrapper.hpp"
#include "hyteg/primitives/Vertex.hpp"
#include "hyteg/types/flags.hpp"
#include "hyteg/types/types.hpp"
namespace hyteg {
namespace vertexdof {
......
......@@ -30,21 +30,21 @@ namespace hyteg {
namespace petsc {
inline void createVectorFromFunction( const DGFunction< PetscReal >& function,
const DGFunction< PetscInt >& numerator,
const DGFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
{
WALBERLA_ABORT( "Congrats :( You have detected another unimplemented feature of DGFunction" );
WALBERLA_ABORT( "Congrats :( You have detected another unimplemented feature of DGFunction" );
}
inline void createFunctionFromVector( const DGFunction< PetscReal >& function,
const DGFunction< PetscInt >& numerator,
const DGFunction< idx_t >& numerator,
const std::shared_ptr< VectorProxy >& vec,
uint_t level,
DoFType flag )
{
WALBERLA_ABORT( "Congrats :( You have detected another unimplemented feature of DGFunction" );
WALBERLA_ABORT( "Congrats :( You have detected another unimplemented feature of DGFunction" );
}
} // namespace petsc
......
Markdown is supported
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