Skip to content

Commit

Permalink
fixed compilation error in DealiiMatrixFree PoissonSolve
Browse files Browse the repository at this point in the history
  • Loading branch information
Avirup Sircar committed Feb 16, 2025
1 parent 48904ae commit 19d813a
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 103 deletions.
78 changes: 34 additions & 44 deletions src/basis/DealiiFEEvaluationWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
******************************************************************************/

/*
* @author DFTFE
* @author dftefe
*/
#include <DealiiFEEvaluationWrapper.h>
#include <basis/DealiiFEEvaluationWrapper.h>



namespace dftfe
namespace dftefe
{
namespace dftUtils
namespace basis
{
template <int FEOrder,
unsigned int num_1d_quadPoints,
Expand Down Expand Up @@ -108,26 +106,6 @@ namespace dftfe
}
}

// template <int FEOrder,
// unsigned int num_1d_quadPoints,
// unsigned int n_components>
// void FEEvaluationWrapperDerived<FEOrder, num_1d_quadPoints,
// n_components>::
// submitInterpolatedGradientsAndMultiply(
// dealii::AlignedVector<
// dealii::Tensor<1, 3, dealii::VectorizedArray<double>>> &alpha)
// {
// AssertThrow(false, dftUtils::ExcNotImplementedYet());
// // if (positiveFlag)
// // for (unsigned int q = 0; q < d_dealiiFEEvaluation->n_q_points;
// ++q)
// // {
// // d_dealiiFEEvaluation->submit_gradient(
// // alpha[q] * d_dealiiFEEvaluation->get_gradient(q), q);
// // }
// }


template <int FEOrder,
unsigned int num_1d_quadPoints,
unsigned int n_components>
Expand Down Expand Up @@ -463,14 +441,16 @@ namespace dftfe
{
d_dealiiFEEvaluation->distribute_local_to_global(tempvec);
}
#ifdef DFTFE_MINIMAL_COMPILE
# define RANGE_FEORDER ((1)(2)(3)(4)(5)(6)(7))
# define RANGE_QUADRATURE ((2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14))
#else
# define RANGE_FEORDER ((1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14))
# define RANGE_QUADRATURE \
((2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16)(18))
#endif
// #ifdef DFTEFE_MINIMAL_COMPILE
// # define RANGE_FEORDER ((1)(2)(3)(4)(5)(6)(7))
// # define RANGE_QUADRATURE ((2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14))
// #else
#define RANGE_FEORDER \
((3)(4)(5)(6)(7)) //(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)
#define RANGE_QUADRATURE \
((10)(12)(14)(16)(18)( \
20)) //(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16)(18)(19)(20)
// #endif
#define MACRO(r, p) \
template class FEEvaluationWrapperDerived<BOOST_PP_SEQ_ELEM(0, p), \
BOOST_PP_SEQ_ELEM(1, p), \
Expand Down Expand Up @@ -499,14 +479,16 @@ namespace dftfe
d_matrixFreeVectorComponent = matrixFreeVectorComponent;
d_matrixFreeQuadratureComponent = matrixFreeQuadratureComponent;
d_matrix_free_data = &matrixFreeData;
#ifdef DFTFE_MINIMAL_COMPILE
# define RANGE_FEORDER ((1)(2)(3)(4)(5)(6)(7))
# define RANGE_QUADRATURE ((2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14))
#else
# define RANGE_FEORDER ((1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14))
# define RANGE_QUADRATURE \
((2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16)(18))
#endif
// #ifdef DFTEFE_MINIMAL_COMPILE
// # define RANGE_FEORDER ((1)(2)(3)(4)(5)(6)(7))
// # define RANGE_QUADRATURE ((2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14))
// #else
#define RANGE_FEORDER \
((3)(4)(5)(6)(7)) //(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)
#define RANGE_QUADRATURE \
((10)(12)(14)(16)(18)( \
20)) //(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16)(18)(19)(20)
// #endif
#define MACRO(r, p) \
if (BOOST_PP_SEQ_ELEM(0, p) == d_feDegree && \
BOOST_PP_SEQ_ELEM(1, p) == d_num1dQuad) \
Expand All @@ -529,8 +511,16 @@ namespace dftfe
#undef RANGE_QUADRATURE
}

template <unsigned int numberOfComponents>
const FEEvaluationWrapperBase &
DealiiFEEvaluationWrapper<numberOfComponents>::getFEEvaluationWrapperBase()
const
{
return *d_feEvaluationBase;
}

template class DealiiFEEvaluationWrapper<1>;
// template class DealiiFEEvaluationWrapper<3>;

} // End of namespace dftUtils
} // End of namespace dftfe
} // End of namespace basis
} // End of namespace dftefe
27 changes: 17 additions & 10 deletions src/basis/DealiiFEEvaluationWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,31 @@
******************************************************************************/

/*
* @author DFTFE
* @author dftefe
*/

#ifndef FEEvaluationWrapper_h
#define FEEvaluationWrapper_h

#include <dftUtils.h>
#include <any>
#include <boost/preprocessor.hpp>
#include <cmath>
#include <memory>
#include <constraintMatrixInfo.h>
#include <constraintMatrixInfo.h>
#include <headers.h>

namespace dftfe
#include <deal.II/matrix_free/matrix_free.h>
#include <deal.II/matrix_free/fe_evaluation.h>

namespace dftefe
{
namespace dftUtils
namespace basis
{
class FEEvaluationWrapperBase
{
public:
template <typename T>
using distributedCPUVec =
dealii::LinearAlgebra::distributed::Vector<T,
dealii::MemorySpace::Host>;

/**
* @brief Returns the total number of quadrature points in all 3 directions
*/
Expand Down Expand Up @@ -285,6 +288,10 @@ namespace dftfe
const unsigned int matrixFreeVectorComponent,
const unsigned int matrixFreeQuadratureComponent);

const FEEvaluationWrapperBase &
getFEEvaluationWrapperBase() const;

private:
unsigned int d_feDegree;
unsigned int d_num1dQuad;
unsigned int d_matrixFreeVectorComponent;
Expand All @@ -297,9 +304,9 @@ namespace dftfe

}; // end of DealiiFEEvaluationWrapper

} // end of namespace dftUtils
} // end of namespace basis

} // end of namespace dftfe
} // end of namespace dftefe


#endif // FEEvaluationWrapper_h
14 changes: 9 additions & 5 deletions src/electrostatics/PoissonSolverDealiiMatrixFreeFE.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include <basis/FEBasisOperations.h>
#include <basis/FEBasisDataStorage.h>
#include <quadrature/QuadratureValuesContainer.h>
#include <basis/DealiiFEEvaluationWrapper.h>
#include <basis/CFEBasisDataStorageDealii.h>
#include <basis/CFEConstraintsLocalDealii.h>
#include <basis/CFEBDSOnTheFlyComputeDealii.h>
#include <vector>
#include <memory>
#include <utils/Profiler.h>
Expand Down Expand Up @@ -77,8 +81,7 @@ namespace dftefe

template <typename T>
using distributedCPUVec =
dealii::LinearAlgebra::distributed::Vector<T,
dealii::MemorySpace::Host>;
basis::FEEvaluationWrapperBase::distributedCPUVec<T>;

using ValueType =
linearAlgebra::blasLapack::scalar_type<ValueTypeOperator,
Expand Down Expand Up @@ -152,7 +155,7 @@ namespace dftefe
~PoissonSolverDealiiMatrixFreeFE() = default;

void
solve();
solve(const double absTolerance, const unsigned int maxNumberIterations);

void
getSolution(linearAlgebra::MultiVector<ValueType, memorySpace> &solution);
Expand Down Expand Up @@ -216,9 +219,10 @@ namespace dftefe
d_dealiiMatrixFree;
std::shared_ptr<const dealii::DoFHandler<dim>> d_dealiiDofHandler;
dealii::AffineConstraints<ValueTypeOperand>
* d_dealiiAffineConstraintMatrix;
*d_dealiiAffineConstraintMatrix;
dealii::AffineConstraints<ValueTypeOperand> *d_constraintsInfo;
unsigned int d_num1DQuadPointsStiffnessMatrix;
std::map<std::string, unsigned int> d_num1DPointsRhs;
std::map<std::string, unsigned int> d_num1DQuadPointsRhs;
size_type d_feOrder;
unsigned int d_dofHandlerIndex;

Expand Down
Loading

0 comments on commit 19d813a

Please sign in to comment.