28#ifndef dftefeMixingScheme_h
29#define dftefeMixingScheme_h
59 template <
typename ValueTypeMixingVariable,
typename ValueTypeWeights>
65 ValueTypeMixingVariable>;
79 const std::vector<mixingVariable> mixingVariablesList,
81 &linAlgOpContextHost);
117 const bool performMPIReduce,
118 const double mixingValue,
119 const bool isAdaptiveMixing);
125 template <utils::MemorySpace memorySpace>
128 const ValueTypeMixingVariable *inputVariableToInHist,
135 template <utils::MemorySpace memorySpace>
139 const ValueTypeMixingVariable *inputVariableToResidualHist,
146 template <utils::MemorySpace memorySpace>
149 ValueTypeMixingVariable *outputVariable,
161 const std::deque<std::vector<ValueTypeMixingVariable>> &inHist,
162 const std::deque<std::vector<ValueTypeMixingVariable>> &outHist,
165 const bool isPerformMixing,
166 const bool isMPIAllReduce,
167 std::vector<ValueType> &A,
168 std::vector<ValueType> &c);
173 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:61
std::vector< ValueType > d_A
Definition: MixingScheme.h:170
ValueType d_cFinal
Definition: MixingScheme.h:171
void computeAdaptiveAndersonMixingParameter()
Computes the adaptive mixing parameter.
Definition: MixingScheme.t.cpp:251
std::map< mixingVariable, bool > d_performMixing
Definition: MixingScheme.h:189
void addVariableToInHist(const mixingVariable mixingVariableName, const ValueTypeMixingVariable *inputVariableToInHist, const size_type length)
Adds to the input history.
Definition: MixingScheme.t.cpp:315
std::vector< ValueType > d_c
Definition: MixingScheme.h:170
std::map< mixingVariable, utils::MemoryStorage< ValueTypeWeights, utils::MemorySpace::HOST > > d_vectorDotProductWeights
Definition: MixingScheme.h:177
linearAlgebra::blasLapack::scalar_type< ValueTypeWeights, ValueTypeMixingVariable > ValueType
Definition: MixingScheme.h:65
size_type d_mixingHistory
Definition: MixingScheme.h:188
std::map< mixingVariable, bool > d_performMPIReduce
Definition: MixingScheme.h:178
void popOldHistory(size_type mixingHistory)
Deletes the old history if the length exceeds max length of history.
Definition: MixingScheme.t.cpp:426
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:363
void clearHistory()
Clears all the the history.
Definition: MixingScheme.t.cpp:410
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
std::map< mixingVariable, double > d_mixingParameter
Definition: MixingScheme.h:182
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:184
bool d_adaptiveMixingParameterIncAllIterations
Definition: MixingScheme.h:187
const MPI_Comm & d_mpiComm
Definition: MixingScheme.h:180
std::map< mixingVariable, std::deque< std::vector< ValueTypeMixingVariable > > > d_variableHistoryResidual
Definition: MixingScheme.h:174
utils::ConditionalOStream d_rootCout
Definition: MixingScheme.h:190
bool d_adaptiveMixingParameterDecLastIteration
Definition: MixingScheme.h:185
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:338
bool d_adaptiveMixingParameterDecAllIterations
Definition: MixingScheme.h:186
std::map< mixingVariable, std::deque< std::vector< ValueTypeMixingVariable > > > d_variableHistoryIn
Definition: MixingScheme.h:174
std::map< mixingVariable, bool > d_isAdaptiveMixing
Definition: MixingScheme.h:183
Definition: LinAlgOpContext.h:38
Provides an interface to print based on whether a certain condition is met or not....
Definition: ConditionalOStream.h:45
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
blas::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:70
int MPIComm
Definition: MPITypes.h:83
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8