Commit 4f9bc7a2 authored by Marcus Mohr's avatar Marcus Mohr
Browse files

Fixes building of apps and tests without PETSc

A lot of auxilliary functions called by the matrix creation methods where
still wrapped inside HYTEG_BUILD_WITH_PETSC. This is no longer necessary,
as they do no longer depend directly on PETSC. They don't use PetscInt or
PetscReal and work with the general SparseMatrixProxy.
parent 07b957ab
......@@ -114,7 +114,7 @@ class StrongFreeSlipWrapper : public Operator< typename OpType::srcType, typenam
projOp_->toMatrix( matProxyProjectionPost, numeratorSrc.uvw, numeratorDst.uvw, level, projFlag_ );
// we need the Id also in the pressure block
petsc::saveIdentityOperator( numeratorDst.p, matProxyProjectionPost, level, All );
saveIdentityOperator( numeratorDst.p, matProxyProjectionPost, level, All );
std::vector< std::shared_ptr< SparseMatrixProxy > > matrices;
matrices.push_back( matProxyProjectionPost );
......@@ -126,7 +126,7 @@ class StrongFreeSlipWrapper : public Operator< typename OpType::srcType, typenam
projOp_->toMatrix( matProxyProjectionPre, numeratorSrc.uvw, numeratorDst.uvw, level, projFlag_ );
petsc::saveIdentityOperator( numeratorDst.p, matProxyProjectionPre, level, All );
saveIdentityOperator( numeratorDst.p, matProxyProjectionPre, level, All );
matrices.push_back( matProxyProjectionPre );
}
......
......@@ -35,8 +35,6 @@ namespace edgedof {
using walberla::real_t;
using walberla::uint_t;
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveEdgeOperator( const uint_t& Level,
const Edge& edge,
const PrimitiveDataID< StencilMemory< real_t >, Edge >& operatorId,
......@@ -47,9 +45,9 @@ inline void saveEdgeOperator( const uint_t&
using namespace hyteg::edgedof::macroedge;
size_t rowsize = levelinfo::num_microedges_per_edge( Level );
real_t* opr_data = edge.getData( operatorId )->getPointer( Level );
idx_t* src = edge.getData( srcId )->getPointer( Level );
idx_t* dst = edge.getData( dstId )->getPointer( Level );
real_t* opr_data = edge.getData( operatorId )->getPointer( Level );
idx_t* src = edge.getData( srcId )->getPointer( Level );
idx_t* dst = edge.getData( dstId )->getPointer( Level );
idx_t srcInt;
idx_t dstInt;
......@@ -232,9 +230,9 @@ inline void saveFaceOperator( const uint_t&
const PrimitiveDataID< FunctionMemory< idx_t >, Face >& dstId,
const std::shared_ptr< SparseMatrixProxy >& mat )
{
real_t* opr_data = face.getData( operatorId )->getPointer( Level );
idx_t* src = face.getData( srcId )->getPointer( Level );
idx_t* dst = face.getData( dstId )->getPointer( Level );
real_t* opr_data = face.getData( operatorId )->getPointer( Level );
idx_t* src = face.getData( srcId )->getPointer( Level );
idx_t* dst = face.getData( dstId )->getPointer( Level );
idx_t srcInt;
idx_t dstInt;
......@@ -507,6 +505,8 @@ inline void saveCellIdentityOperator( const uint_t&
} // namespace edgedof
#ifdef HYTEG_BUILD_WITH_PETSC
namespace petsc {
inline void createVectorFromFunction( const EdgeDoFFunction< PetscReal >& function,
......@@ -626,8 +626,8 @@ inline void applyDirichletBC( const EdgeDoFFunction< idx_t >& numerator, std::ve
}
}
#endif
} // namespace petsc
} // namespace edgedof
#endif
} // namespace hyteg
......@@ -124,8 +124,6 @@ void EdgeDoFProjectNormalOperator::project( const EdgeDoFFunction< real_t >& dst
this->stopTiming( "Project" );
}
#ifdef HYTEG_BUILD_WITH_PETSC
void EdgeDoFProjectNormalOperator::assembleLocalMatrix( const std::shared_ptr< SparseMatrixProxy >& mat,
const EdgeDoFFunction< idx_t >& numU,
const EdgeDoFFunction< idx_t >& numV,
......@@ -204,6 +202,4 @@ void EdgeDoFProjectNormalOperator::assembleLocalMatrix( const std::shared_ptr< S
}
}
#endif
} // namespace hyteg
......@@ -46,7 +46,6 @@ class EdgeDoFProjectNormalOperator final : public Operator< hyteg::EdgeDoFFuncti
uint_t level,
DoFType flag ) const;
#ifdef HYTEG_BUILD_WITH_PETSC
/// Assemble operator as sparse matrix
///
/// \param mat a sparse matrix proxy
......@@ -62,7 +61,6 @@ class EdgeDoFProjectNormalOperator final : public Operator< hyteg::EdgeDoFFuncti
const EdgeDoFFunction< idx_t >& numW,
uint_t level,
DoFType flag ) const;
#endif
private:
const std::function< void( const Point3D&, Point3D& ) > normal_function_;
......
......@@ -256,8 +256,6 @@ inline void projectNormal3D( uint_t
}
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveProjectNormalOperator2D( uint_t level,
const Edge& edge,
const std::shared_ptr< PrimitiveStorage >& storage,
......@@ -301,8 +299,6 @@ inline void saveProjectNormalOperator2D( uint_t
}
}
#endif
} // namespace macroedge
} // namespace edgedof
......
......@@ -20,8 +20,6 @@
#include "DiagonalNonConstantOperator.hpp"
#ifdef HYTEG_BUILD_WITH_PETSC
namespace hyteg {
namespace workaround {
......@@ -93,5 +91,3 @@ void externalDiagonalAssembly< P2Function< real_t > >( const std::shared_ptr< Sp
} // namespace workaround
} // namespace hyteg
#endif
......@@ -34,8 +34,6 @@ namespace hyteg {
using walberla::real_t;
#ifdef HYTEG_BUILD_WITH_PETSC
// As long as we cannot use FunctionIterator< P2Function > we use a specialised external template function
namespace workaround {
......@@ -48,8 +46,6 @@ void externalDiagonalAssembly( const std::shared_ptr< SparseMatrixProxy >&
} // namespace workaround
#endif
/// Provides an operator with only "diagonal" values that may change from DoF to DoF
///
/// The DiagonalNonConstantOperator provides an implementation of an operator that is
......
......@@ -118,7 +118,6 @@ class P1ToP2ElementwiseOperator : public Operator< P1Function< real_t >, P2Funct
real_t* const dstEdgeData,
const Matrixr< 10, 4 >& elMat ) const;
#ifdef HYTEG_BUILD_WITH_PETSC
void localMatrixAssembly2D( const std::shared_ptr< SparseMatrixProxy >& mat,
const Face& face,
const uint_t level,
......@@ -137,7 +136,6 @@ class P1ToP2ElementwiseOperator : public Operator< P1Function< real_t >, P2Funct
const idx_t* const srcVertexIdx,
const idx_t* const dstVertexIdx,
const idx_t* const dstEdgeIdx ) const;
#endif
void assembleLocalElementMatrix2D( const Face& face,
uint_t level,
......
......@@ -106,7 +106,6 @@ class P2ToP1ElementwiseOperator : public Operator< P2Function< real_t >, P1Funct
real_t* const dstVertexData,
const Matrixr< 4, 10 >& elMat ) const;
#ifdef HYTEG_BUILD_WITH_PETSC
void localMatrixAssembly2D( const std::shared_ptr< SparseMatrixProxy >& mat,
const Face& face,
const uint_t level,
......@@ -125,7 +124,6 @@ class P2ToP1ElementwiseOperator : public Operator< P2Function< real_t >, P1Funct
const idx_t* const srcVertexIdx,
const idx_t* const srcEdgeIdx,
const idx_t* const dstVertexIdx ) const;
#endif
void assembleLocalElementMatrix2D( const Face& face,
uint_t level,
......
......@@ -31,8 +31,6 @@ namespace EdgeDoFToVertexDoF {
using walberla::real_t;
using walberla::uint_t;
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveVertexOperator( const uint_t& level,
const Vertex& vertex,
const PrimitiveDataID< StencilMemory< real_t >, Vertex >& operatorId,
......@@ -433,7 +431,5 @@ inline void
}
}
#endif
} // namespace EdgeDoFToVertexDoF
} // namespace hyteg
......@@ -227,6 +227,13 @@ inline void applyDirichletBC( const P1VectorFunction< idx_t >& numerator, std::v
}
}
} // namespace petsc
} // namespace hyteg
#endif
namespace hyteg {
// =============
// P1Operators
// =============
......@@ -285,7 +292,4 @@ inline void saveIdentityOperator( const P1Function< idx_t >& ds
}
}
} // namespace petsc
} // namespace hyteg
#endif
......@@ -700,9 +700,6 @@ inline ValueType getMaxMagnitude( const uint_t & level, Cell &cell, const Primit
return localMax;
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveOperator( const uint_t& Level,
Cell& cell,
const PrimitiveDataID< LevelWiseMemory< vertexdof::macrocell::StencilMap_T >, Cell >& operatorId,
......@@ -745,6 +742,8 @@ inline void saveIdentityOperator( const uint_t&
}
}
#ifdef HYTEG_BUILD_WITH_PETSC
template < typename ValueType >
inline void createVectorFromFunction( const uint_t& Level,
Cell& cell,
......
......@@ -693,9 +693,6 @@ inline ValueType getMinValue( const uint_t & level, Edge &edge, const PrimitiveD
return localMin;
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveOperator( const uint_t& level,
Edge& edge,
const PrimitiveStorage& storage,
......@@ -772,6 +769,8 @@ inline void saveIdentityOperator( const uint_t&
}
}
#ifdef HYTEG_BUILD_WITH_PETSC
template < typename ValueType >
inline void createVectorFromFunction( const uint_t& level,
Edge& edge,
......
......@@ -1088,8 +1088,6 @@ inline ValueType getMinValue( const uint_t& level, Face& face, const PrimitiveDa
return localMin;
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveOperator( const uint_t& Level,
Face& face,
const PrimitiveDataID< StencilMemory< real_t >, Face >& operatorId,
......@@ -1211,6 +1209,8 @@ inline void saveOperator3D( const uint_t&
}
}
#ifdef HYTEG_BUILD_WITH_PETSC
template < typename ValueType >
inline void createVectorFromFunction( const uint_t& Level,
Face& face,
......
......@@ -343,7 +343,6 @@ inline ValueType
return src[0];
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveOperator( Vertex& vertex,
const PrimitiveDataID< StencilMemory< real_t >, Vertex >& operatorId,
const PrimitiveDataID< FunctionMemory< idx_t >, Vertex >& srcId,
......@@ -370,6 +369,8 @@ inline void saveIdentityOperator( Vertex&
mat->addValue( uint_c( dst[0] ), uint_c( dst[0] ), 1.0 );
}
#ifdef HYTEG_BUILD_WITH_PETSC
template < typename ValueType >
inline void createVectorFromFunction( const Vertex& vertex,
const PrimitiveDataID< FunctionMemory< ValueType >, Vertex >& srcId,
......
......@@ -205,8 +205,6 @@ inline void projectNormal3D( uint_t
}
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveProjectNormalOperator2D( uint_t level,
const Edge& edge,
const std::shared_ptr< PrimitiveStorage >& storage,
......@@ -249,8 +247,6 @@ inline void saveProjectNormalOperator2D( uint_t
}
}
#endif
} // namespace macroedge
namespace macrovertex {
......@@ -336,8 +332,6 @@ inline void projectNormal3D( uint_t
dstW[0] = out[2];
}
#ifdef HYTEG_BUILD_WITH_PETSC
inline void saveProjectNormalOperator2D( uint_t level,
const Vertex& vertex,
const std::shared_ptr< PrimitiveStorage >& storage,
......@@ -368,8 +362,6 @@ inline void saveProjectNormalOperator2D( uint_t
mat->addValue( uint_c( idxV ), uint_c( idxV ), 1.0 - normal[1] * normal[1] );
}
#endif
} // namespace macrovertex
} // namespace vertexdof
......
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