28#ifndef dftefeMixingScheme_h
29#define dftefeMixingScheme_h
70 template <
typename ValueTypeMixingVariable,
typename ValueTypeWeights>
76 ValueTypeMixingVariable>;
92 const std::vector<mixingVariable> mixingVariablesList,
94 &linAlgOpContextHost);
130 const bool performMPIReduce,
131 const double mixingValue,
132 const bool isAdaptiveMixing);
138 template <utils::MemorySpace memorySpace>
141 const ValueTypeMixingVariable *inputVariableToInHist,
148 template <utils::MemorySpace memorySpace>
152 const ValueTypeMixingVariable *inputVariableToResidualHist,
159 template <utils::MemorySpace memorySpace>
162 ValueTypeMixingVariable *outputVariable,
176 const std::deque<std::vector<ValueTypeMixingVariable>> &inHist,
177 const std::deque<std::vector<ValueTypeMixingVariable>> &outHist,
180 const bool isPerformMixing,
181 const bool isMPIAllReduce,
182 std::vector<ValueType> &A,
183 std::vector<ValueType> &c);
188 std::map<mixingVariable, std::deque<std::vector<ValueTypeMixingVariable>>>
This class performs the anderson mixing in a variable agnostic way This class takes can take differen...
Definition: MixingScheme.h:72
std::vector< ValueType > d_A
Definition: MixingScheme.h:185
ValueType d_cFinal
Definition: MixingScheme.h:186
void computeAdaptiveAndersonMixingParameter()
Computes the adaptive mixing parameter.
Definition: MixingScheme.t.cpp:250
std::map< mixingVariable, bool > d_performMixing
Definition: MixingScheme.h:204
void addVariableToInHist(const mixingVariable mixingVariableName, const ValueTypeMixingVariable *inputVariableToInHist, const size_type length)
Adds to the input history.
Definition: MixingScheme.t.cpp:314
std::vector< ValueType > d_c
Definition: MixingScheme.h:185
std::map< mixingVariable, utils::MemoryStorage< ValueTypeWeights, utils::MemorySpace::HOST > > d_vectorDotProductWeights
Definition: MixingScheme.h:192
linearAlgebra::blasLapack::scalar_type< ValueTypeWeights, ValueTypeMixingVariable > ValueType
Definition: MixingScheme.h:76
size_type d_mixingHistory
Definition: MixingScheme.h:203
std::map< mixingVariable, bool > d_performMPIReduce
Definition: MixingScheme.h:193
void popOldHistory(size_type mixingHistory)
Deletes the old history if the length exceeds max length of history.
Definition: MixingScheme.t.cpp:425
void mixVariable(const mixingVariable mixingVariableName, ValueTypeMixingVariable *outputVariable, const size_type lenVar)
Computes the input for the next iteration based on the anderson coefficients.
Definition: MixingScheme.t.cpp:362
void clearHistory()
Clears all the the history.
Definition: MixingScheme.t.cpp:409
void computeMixingMatrices(const std::deque< std::vector< ValueTypeMixingVariable > > &inHist, const std::deque< std::vector< ValueTypeMixingVariable > > &outHist, const utils::MemoryStorage< ValueTypeWeights, utils::MemorySpace::HOST > &weightDotProducts, const bool isPerformMixing, const bool isMPIAllReduce, std::vector< ValueType > &A, std::vector< ValueType > &c)
Computes the matrix A and c vector that will be needed for anderson mixing. This function computes th...
Definition: MixingScheme.t.cpp:93
bool hasVariable(mixingVariable var) const
Definition: MixingScheme.t.cpp:439
std::map< mixingVariable, double > d_mixingParameter
Definition: MixingScheme.h:197
void addMixingVariable(const mixingVariable mixingVariableList, const utils::MemoryStorage< ValueTypeWeights, utils::MemorySpace::HOST > &weightDotProducts, const bool performMPIReduce, const double mixingValue, const bool isAdaptiveMixing)
This function is used to add the mixing variables and its corresponding JxW values For dependent vari...
Definition: MixingScheme.t.cpp:43
bool d_anyMixingParameterAdaptive
Definition: MixingScheme.h:199
bool d_adaptiveMixingParameterIncAllIterations
Definition: MixingScheme.h:202
const MPI_Comm & d_mpiComm
Definition: MixingScheme.h:195
std::map< mixingVariable, std::deque< std::vector< ValueTypeMixingVariable > > > d_variableHistoryResidual
Definition: MixingScheme.h:189
utils::ConditionalOStream d_rootCout
Definition: MixingScheme.h:205
bool d_adaptiveMixingParameterDecLastIteration
Definition: MixingScheme.h:200
size_type lengthOfHistory()
Definition: MixingScheme.t.cpp:196
void computeAndersonMixingCoeff(const std::vector< mixingVariable > mixingVariablesList, linearAlgebra::LinAlgOpContext< utils::MemorySpace::HOST > &linAlgOpContextHost)
Computes the mixing coefficients.
Definition: MixingScheme.t.cpp:206
void addVariableToResidualHist(const mixingVariable mixingVariableName, const ValueTypeMixingVariable *inputVariableToResidualHist, const size_type length)
Adds to the residual history.
Definition: MixingScheme.t.cpp:337
bool d_adaptiveMixingParameterDecAllIterations
Definition: MixingScheme.h:201
std::map< mixingVariable, std::deque< std::vector< ValueTypeMixingVariable > > > d_variableHistoryIn
Definition: MixingScheme.h:189
std::map< mixingVariable, bool > d_isAdaptiveMixing
Definition: MixingScheme.h:198
Definition: LinAlgOpContext.h:52
Provides an interface to print based on whether a certain condition is met or not....
Definition: ConditionalOStream.h:47
Definition: MemoryStorage.h:38
mixingVariable
Enum class that stores he list of variables that will can be used in the mixing scheme.
Definition: MixingScheme.h:47
typeInternal::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:183
int MPIComm
Definition: MPITypes.h:84
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9