-
Notifications
You must be signed in to change notification settings - Fork 2
/
ElectricPotentialDriverFactory.C
51 lines (46 loc) · 1.55 KB
/
ElectricPotentialDriverFactory.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*************************************************************************
*
* Copyright (c) 2018-2022, Lawrence Livermore National Security, LLC.
* See the top-level LICENSE file for details.
* Produced at the Lawrence Livermore National Laboratory
*
* SPDX-License-Identifier: MIT
*
************************************************************************/
#include "ElectricPotentialDriverFactory.H"
#include "LokiInputParser.H"
#include "Loki_Defines.H"
// Add new derived ElectricPotentialDriver headers here
#include "ShapedRampedCosinePotentialDriver.H"
namespace Loki {
ElectricPotentialDriver*
ElectricPotentialDriverFactory::create(
LokiInputParser& a_pp)
{
// Get the name of the electric potential driver. This is required.
string name("none");
a_pp.query("name", name);
ElectricPotentialDriver* driver = 0;
// If the user forgot the name, error. Otherwise try to build what they
// asked for.
if (name.compare("none") == 0) {
LOKI_ABORT("Missing external electric potential driver ... quitting");
}
else {
if (ShapedRampedCosinePotentialDriver::isType(name)) {
driver = new ShapedRampedCosinePotentialDriver(a_pp);
}
// Add new cases here in this form:
// else if (NewDriver::isType(name)) {
// driver = new NewDriver(a_pp);
// }
else {
ostringstream error_msg;
error_msg << "Unknown external electric potential \"" << name
<< "\" ... quitting";
LOKI_ABORT(error_msg);
}
}
return driver;
}
} // end namespace Loki