Esempio n. 1
0
void Foam::data::setSolverPerformance
(
    const word& name,
    const lduMatrix::solverPerformance& sp
) const
{
    dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());

    List<lduMatrix::solverPerformance> perfs;

    if (prevTimeIndex_ != this->time().timeIndex())
    {
        // reset solver performance between iterations
        prevTimeIndex_ = this->time().timeIndex();
        dict.clear();
    }
    else
    {
        dict.readIfPresent(name, perfs);
    }

    // append to list
    perfs.setSize(perfs.size()+1, sp);

    dict.set(name, perfs);
}
Esempio n. 2
0
void Foam::data::setSolverPerformance
(
    const word& name,
    const SolverPerformance<Type>& sp
) const
{
    dictionary& dict = const_cast<dictionary&>(solverPerformanceDict());

    // Use a DynamicList to improve performance of the append
    DynamicList<SolverPerformance<Type>> perfs;

    const label timeIndex =
        this->time().subCycling()
      ? this->time().prevTimeState().timeIndex()
      : this->time().timeIndex();

    if (prevTimeIndex_ != timeIndex)
    {
        // Reset solver performance between iterations
        prevTimeIndex_ = timeIndex;
        dict.clear();
    }
    else
    {
        dict.readIfPresent(name, perfs);
    }

    // Append to list
    perfs.append(sp);

    dict.set(name, perfs);
}