MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
lscartesiansolverfactory.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
10
11template <MInt nDim>
12std::unique_ptr<LsCartesianSolver<nDim>>
13LsCartesianSolverFactory<nDim>::create(const MInt solverId, const MBool* propertiesGroups, GridProxy& gridProxy,
14 Geometry<nDim>& geometry, const MPI_Comm comm) {
15 MInt solverMethodInt = -1;
16 if(Context::propertyExists("solverMethod", solverId)) {
17 solverMethodInt = string2enum(Context::getSolverProperty<MString>("solverMethod", solverId, AT_));
18 }
19 // TODO labels:LS More relevant input to trigger correct built of desired LS solver version is necessary
20 const MBool isSemiLagrange =
21 (solverMethodInt == MAIA_SEMI_LAGRANGE_LEVELSET || solverMethodInt == MAIA_RUNGE_KUTTA_MB_SEMI_LAGRANGE_LEVELSET
22 || solverMethodInt == MAIA_SEMI_LAGRANGE_LEVELSET_LB);
23 const MBool isFreeAdvection = (solverMethodInt == MAIA_LEVELSET_SURFACE);
24 if(isSemiLagrange) {
25 return std::make_unique<LsCartesianSolverSemiLagrangian<nDim>>(solverId, propertiesGroups, gridProxy, geometry,
26 comm);
27 } else if(isFreeAdvection) {
28 return std::make_unique<LsCartesianSolverFreeAdvection<nDim>>(solverId, propertiesGroups, gridProxy, geometry,
29 comm);
30 } else {
31 return std::make_unique<LsCartesianSolver<nDim>>(solverId, propertiesGroups, gridProxy, geometry, comm);
32 }
33}
34
35template class LsCartesianSolverFactory<2>;
36template class LsCartesianSolverFactory<3>;
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
Definition: context.cpp:494
static std::unique_ptr< LsCartesianSolver< nDim > > create(MInt solverId_, const MBool *propertiesGroups, GridProxy &gridProxy_, Geometry< nDim > &geometry_, const MPI_Comm comm)
Factory method for LsCartesianSolver.
typename CartesianSolver::GridProxy GridProxy
MInt string2enum(MString theString)
This global function translates strings in their corresponding enum values (integer values)....
Definition: enums.cpp:20
@ MAIA_SEMI_LAGRANGE_LEVELSET_LB
Definition: enums.h:68
@ MAIA_RUNGE_KUTTA_MB_SEMI_LAGRANGE_LEVELSET
Definition: enums.h:71
@ MAIA_LEVELSET_SURFACE
Definition: enums.h:70
@ MAIA_SEMI_LAGRANGE_LEVELSET
Definition: enums.h:67
int32_t MInt
Definition: maiatypes.h:62
bool MBool
Definition: maiatypes.h:58