Revision 222a6ea4f79fdf2c2abb6d91d809be0893c61e28 authored by Dmitry Yu. Naumov on 11 October 2021, 09:48:37 UTC, committed by Dmitry Yu. Naumov on 11 October 2021, 09:48:37 UTC
[MeL] Use array of nodes instead of heap allocated array

See merge request ogs/ogs!3837
2 parent s 0119183 + 0d9019d
Raw File
CreateJacobianAssembler.cpp
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "CreateJacobianAssembler.h"

#include "AnalyticalJacobianAssembler.h"
#include "BaseLib/Error.h"
#include "CentralDifferencesJacobianAssembler.h"
#include "CompareJacobiansJacobianAssembler.h"

namespace ProcessLib
{
std::unique_ptr<AbstractJacobianAssembler> createJacobianAssembler(
    std::optional<BaseLib::ConfigTree> const& config)
{
    if (!config)
    {
        return std::make_unique<AnalyticalJacobianAssembler>();
    }

    //! \ogs_file_param{prj__processes__process__jacobian_assembler__type}
    auto const type = config->peekConfigParameter<std::string>("type");

    if (type == "Analytical")
    {
        config->ignoreConfigParameter("type");
        return std::make_unique<AnalyticalJacobianAssembler>();
    }
    if (type == "CentralDifferences")
    {
        return createCentralDifferencesJacobianAssembler(*config);
    }
    if (type == "CompareJacobians")
    {
        return createCompareJacobiansJacobianAssembler(*config);
    }

    OGS_FATAL("Unknown Jacobian assembler type: `{:s}'.", type);
}
}  // namespace ProcessLib
back to top