-
Notifications
You must be signed in to change notification settings - Fork 4
/
DarcyArgs.C
101 lines (89 loc) · 2.92 KB
/
DarcyArgs.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// $Id$
//==============================================================================
//!
//! \file DarcyArgs.C
//!
//! \date Sep 15 2021
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Preparsing of input files for the Darcy application.
//!
//==============================================================================
#include "DarcyArgs.h"
#include "ASMmxBase.h"
#include "Utilities.h"
#include <string>
#include <strings.h>
#include "tinyxml2.h"
bool DarcyArgs::parseArg (const char* argv)
{
TimeIntegration::Method tmp;
if (argv[0] != '-')
return false;
else if (strcasecmp(argv, "-tracer") == 0)
tracer = true;
else if ((tmp = TimeIntegration::get(argv+1)) > TimeIntegration::NONE)
timeMethod = tmp;
else
return this->SIMargsBase::parseArg(argv);
return true;
}
bool DarcyArgs::parseArgComplex (int argc, char** argv, int& i)
{
if (!strcmp(argv[i],"-adap")) {
adNorm = DCY::PRESSURE_H1;
adap = true;
if (i+1 < argc && argv[i+1][0] != '-' &&
strcasecmp(argv[i+1], "pressure") == 0)
adNorm = DCY::PRESSURE_H1, ++i;
else if (i+1 < argc && argv[i+1][0] != '-' &&
strcasecmp(argv[i+1], "recovery_press") == 0)
adNorm = DCY::RECOVERY_PRESSURE, ++i;
else if (i+1 < argc && argv[i+1][0] != '-' &&
strcasecmp(argv[i+1], "concentration") == 0)
adNorm = DCY::CONCENTRATION_H1, ++i;
else if (i+1 < argc && argv[i+1][0] != '-' &&
strcasecmp(argv[i+1], "recovery_conc") == 0)
adNorm = DCY::RECOVERY_CONCENTRATION, ++i;
else if (i+1 < argc && argv[i+1][0] != '-' &&
strcasecmp(argv[i+1], "total") == 0)
adNorm = DCY::TOTAL_H1, ++i;
else if (i+1 < argc && argv[i+1][0] != '-' &&
strcasecmp(argv[i+1], "recovery") == 0)
adNorm = DCY::RECOVERY, ++i;
} else
return false;
return true;
}
bool DarcyArgs::parse (const tinyxml2::XMLElement* elem)
{
if (!strcasecmp(elem->Value(),"timestepping")) {
std::string type;
if (utl::getAttribute(elem,"type",type))
timeMethod = TimeIntegration::get(type);
}
if (!strcasecmp(elem->Value(),"darcy")) {
utl::getAttribute(elem,"tracer",tracer);
ASMmxBase::Type = ASMmxBase::NONE;
const char* ad = elem->Attribute("adap");
if (ad) {
if (strcasecmp(ad,"pressure") == 0)
adNorm = DCY::PRESSURE_H1;
else if (strcasecmp(ad,"recovery_press") == 0)
adNorm = DCY::RECOVERY_PRESSURE;
else if (strcasecmp(ad,"concentration") == 0)
adNorm = DCY::CONCENTRATION_H1;
else if (strcasecmp(ad,"recovery_conc") == 0)
adNorm = DCY::RECOVERY_CONCENTRATION;
else if (strcasecmp(ad,"total") == 0)
adNorm = DCY::TOTAL_H1;
else if (strcasecmp(ad,"recovery") == 0)
adNorm = DCY::RECOVERY;
}
const tinyxml2::XMLElement* child = elem->FirstChildElement("schedule");
if (child)
scheduled = true;
}
return this->SIMargsBase::parse(elem);
}