Commit 527af378 authored by Nils Kohl's avatar Nils Kohl 🌝
Browse files

Removing another call to createMatrix(). Some cleanup.

parent bb355727
......@@ -38,15 +38,8 @@ class P2P1TaylorHoodStokesOperator : public Operator< P2P1TaylorHoodFunction< re
P2P1TaylorHoodStokesOperator( const std::shared_ptr< PrimitiveStorage >& storage, size_t minLevel, size_t maxLevel )
: Operator( storage, minLevel, maxLevel )
, A( storage, minLevel, maxLevel )
, Lapl( storage, minLevel, maxLevel )
, div_x( storage, minLevel, maxLevel )
, div_y( storage, minLevel, maxLevel )
, div_z( storage, minLevel, maxLevel )
, div( storage, minLevel, maxLevel )
, divT_x( storage, minLevel, maxLevel )
, divT_y( storage, minLevel, maxLevel )
, divT_z( storage, minLevel, maxLevel )
, divT( storage, minLevel, maxLevel )
, pspg_( storage, minLevel, maxLevel )
, pspg_inv_diag_( storage, minLevel, maxLevel )
......@@ -69,48 +62,16 @@ class P2P1TaylorHoodStokesOperator : public Operator< P2P1TaylorHoodFunction< re
size_t level,
DoFType flag ) const
{
A.toMatrix( mat, src.uvw[0], dst.uvw[0], level, flag );
divT_x.getVertexToVertexOpr().toMatrix( mat, src.p, dst.uvw[0].getVertexDoFFunction(), level, flag );
divT_x.getVertexToEdgeOpr().toMatrix( mat, src.p, dst.uvw[0].getEdgeDoFFunction(), level, flag );
A.toMatrix( mat, src.uvw[1], dst.uvw[1], level, flag );
divT_y.getVertexToVertexOpr().toMatrix( mat, src.p, dst.uvw[1].getVertexDoFFunction(), level, flag );
divT_y.getVertexToEdgeOpr().toMatrix( mat, src.p, dst.uvw[1].getEdgeDoFFunction(), level, flag );
if ( src.uvw[0].getStorage()->hasGlobalCells() )
{
A.toMatrix( mat, src.uvw[2], dst.uvw[2], level, flag );
divT_z.getVertexToVertexOpr().toMatrix( mat, src.p, dst.uvw[2].getVertexDoFFunction(), level, flag );
divT_z.getVertexToEdgeOpr().toMatrix( mat, src.p, dst.uvw[2].getEdgeDoFFunction(), level, flag );
}
div_x.getVertexToVertexOpr().toMatrix( mat, src.uvw[0].getVertexDoFFunction(), dst.p, level, flag | DirichletBoundary );
div_x.getEdgeToVertexOpr().toMatrix( mat, src.uvw[0].getEdgeDoFFunction(), dst.p, level, flag | DirichletBoundary );
div_y.getVertexToVertexOpr().toMatrix( mat, src.uvw[1].getVertexDoFFunction(), dst.p, level, flag | DirichletBoundary );
div_y.getEdgeToVertexOpr().toMatrix( mat, src.uvw[1].getEdgeDoFFunction(), dst.p, level, flag | DirichletBoundary );
if ( src.uvw[0].getStorage()->hasGlobalCells() )
{
div_z.getVertexToVertexOpr().toMatrix( mat, src.uvw[2].getVertexDoFFunction(), dst.p, level, flag | DirichletBoundary );
div_z.getEdgeToVertexOpr().toMatrix( mat, src.uvw[2].getEdgeDoFFunction(), dst.p, level, flag | DirichletBoundary );
}
Lapl.toMatrix( mat, src.uvw, dst.uvw, level, flag );
divT.toMatrix( mat, src.p, dst.uvw, level, flag );
div.toMatrix( mat, src.uvw, dst.p, level, flag );
}
P2ConstantVectorLaplaceOperator Lapl;
P2ToP1ConstantDivOperator div;
P1ToP2ConstantDivTOperator divT;
// currently need these for being able to call createMatrix()
P2ConstantLaplaceOperator A;
P2ToP1ConstantDivxOperator div_x;
P2ToP1ConstantDivyOperator div_y;
P2ToP1ConstantDivzOperator div_z;
P1ToP2ConstantDivTxOperator divT_x;
P1ToP2ConstantDivTyOperator divT_y;
P1ToP2ConstantDivTzOperator divT_z;
/// this operator is need in the uzawa smoother
// this operator is needed in the uzawa smoother
P1PSPGOperator pspg_;
P1PSPGInvDiagOperator pspg_inv_diag_;
bool hasGlobalCells_;
......
......@@ -67,24 +67,14 @@ class P2P1UzawaDampingFactorEstimationOperator : public Operator< P1Function< re
tmp_solution_.uvw[1].interpolate( 0, level, All );
tmp_solution_.uvw[2].interpolate( 0, level, All );
A.divT_x.apply( src, tmp_rhs_.uvw[0], level, flag, Replace );
A.divT_y.apply( src, tmp_rhs_.uvw[1], level, flag, Replace );
if ( hasGlobalCells_ )
{
A.divT_z.apply( src, tmp_rhs_.uvw[2], level, flag, Replace );
}
A.divT.apply( src, tmp_rhs_.uvw, level, flag, Replace );
for ( uint_t i = 0; i < numGSIterationsVelocity_; i++ )
{
velocitySmoother_->solve( A, tmp_solution_, tmp_rhs_, level );
}
A.div_x.apply( tmp_solution_.uvw[0], tmp_schur_, level, flag, Replace );
A.div_y.apply( tmp_solution_.uvw[1], tmp_schur_, level, flag, Add );
if ( hasGlobalCells_ )
{
A.div_z.apply( tmp_solution_.uvw[2], tmp_schur_, level, flag, Add );
}
A.div.apply( tmp_solution_.uvw, tmp_schur_, level, flag, Replace );
mass_inv_diag_.apply( tmp_schur_, dst, level, flag, Replace );
}
......
......@@ -29,11 +29,6 @@
#include "hyteg/p2functionspace/P2Function.hpp"
#include "hyteg/solvers/Smoothables.hpp"
// This include can be removed once the implementation of createMatrix() was moved into toMatrix()
#ifdef HYTEG_BUILD_WITH_PETSC
#include "hyteg/p2functionspace/P2Petsc.hpp"
#endif
namespace hyteg {
using walberla::real_t;
......
......@@ -97,23 +97,6 @@ inline void applyDirichletBC( const P2VectorFunction< PetscInt >& numerator, std
}
}
// =============
// P2Operators
// =============
template < class OperatorType >
inline void createMatrix( const OperatorType& opr,
const P2Function< PetscInt >& src,
const P2Function< PetscInt >& dst,
const std::shared_ptr< SparseMatrixProxy >& mat,
uint_t level,
DoFType flag )
{
createMatrix( opr.getVertexToVertexOpr(), src.getVertexDoFFunction(), dst.getVertexDoFFunction(), mat, level, flag );
createMatrix( opr.getEdgeToVertexOpr(), src.getEdgeDoFFunction(), dst.getVertexDoFFunction(), mat, level, flag );
createMatrix( opr.getVertexToEdgeOpr(), src.getVertexDoFFunction(), dst.getEdgeDoFFunction(), mat, level, flag );
createMatrix( opr.getEdgeToEdgeOpr(), src.getEdgeDoFFunction(), dst.getEdgeDoFFunction(), mat, level, flag );
}
} // namespace petsc
} // namespace hyteg
......
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