Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MostafaMollaali
dynamic
Commits
03fbcd1f
Commit
03fbcd1f
authored
8 years ago
by
Norihiro Watanabe
Browse files
Options
Downloads
Patches
Plain Diff
move to cpp: TimeDiscretizationBuilder
parent
a90e906f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NumLib/ODESolver/TimeDiscretizationBuilder.cpp
+53
-0
53 additions, 0 deletions
NumLib/ODESolver/TimeDiscretizationBuilder.cpp
NumLib/ODESolver/TimeDiscretizationBuilder.h
+1
-36
1 addition, 36 deletions
NumLib/ODESolver/TimeDiscretizationBuilder.h
with
54 additions
and
36 deletions
NumLib/ODESolver/TimeDiscretizationBuilder.cpp
0 → 100644
+
53
−
0
View file @
03fbcd1f
/**
* \copyright
* Copyright (c) 2012-2016, 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
"TimeDiscretizationBuilder.h"
#include
"BaseLib/Error.h"
namespace
NumLib
{
std
::
unique_ptr
<
TimeDiscretization
>
createTimeDiscretization
(
BaseLib
::
ConfigTree
const
&
config
)
{
using
T
=
std
::
unique_ptr
<
TimeDiscretization
>
;
//! \ogs_file_param{process__time_discretization__type}
auto
const
type
=
config
.
getConfigParameter
<
std
::
string
>
(
"type"
);
if
(
type
==
"BackwardEuler"
)
{
using
ConcreteTD
=
BackwardEuler
;
return
T
(
new
ConcreteTD
);
}
else
if
(
type
==
"ForwardEuler"
)
{
using
ConcreteTD
=
ForwardEuler
;
return
T
(
new
ConcreteTD
);
}
else
if
(
type
==
"CrankNicolson"
)
{
//! \ogs_file_param{process__time_discretization__CrankNicolson__theta}
auto
const
theta
=
config
.
getConfigParameter
<
double
>
(
"theta"
);
using
ConcreteTD
=
CrankNicolson
;
return
T
(
new
ConcreteTD
(
theta
));
}
else
if
(
type
==
"BackwardDifferentiationFormula"
)
{
//! \ogs_file_param{process__time_discretization__BackwardDifferentiationFormula__order}
auto
const
order
=
config
.
getConfigParameter
<
unsigned
>
(
"order"
);
using
ConcreteTD
=
BackwardDifferentiationFormula
;
return
T
(
new
ConcreteTD
(
order
));
}
else
{
OGS_FATAL
(
"Unrecognized time discretization type `%s'"
,
type
.
c_str
());
}
}
}
This diff is collapsed.
Click to expand it.
NumLib/ODESolver/TimeDiscretizationBuilder.h
+
1
−
36
View file @
03fbcd1f
...
@@ -19,42 +19,7 @@ namespace NumLib
...
@@ -19,42 +19,7 @@ namespace NumLib
{
{
std
::
unique_ptr
<
TimeDiscretization
>
createTimeDiscretization
(
std
::
unique_ptr
<
TimeDiscretization
>
createTimeDiscretization
(
BaseLib
::
ConfigTree
const
&
config
)
BaseLib
::
ConfigTree
const
&
config
);
{
using
T
=
std
::
unique_ptr
<
TimeDiscretization
>
;
//! \ogs_file_param{process__time_discretization__type}
auto
const
type
=
config
.
getConfigParameter
<
std
::
string
>
(
"type"
);
if
(
type
==
"BackwardEuler"
)
{
using
ConcreteTD
=
BackwardEuler
;
return
T
(
new
ConcreteTD
);
}
else
if
(
type
==
"ForwardEuler"
)
{
using
ConcreteTD
=
ForwardEuler
;
return
T
(
new
ConcreteTD
);
}
else
if
(
type
==
"CrankNicolson"
)
{
//! \ogs_file_param{process__time_discretization__CrankNicolson__theta}
auto
const
theta
=
config
.
getConfigParameter
<
double
>
(
"theta"
);
using
ConcreteTD
=
CrankNicolson
;
return
T
(
new
ConcreteTD
(
theta
));
}
else
if
(
type
==
"BackwardDifferentiationFormula"
)
{
//! \ogs_file_param{process__time_discretization__BackwardDifferentiationFormula__order}
auto
const
order
=
config
.
getConfigParameter
<
unsigned
>
(
"order"
);
using
ConcreteTD
=
BackwardDifferentiationFormula
;
return
T
(
new
ConcreteTD
(
order
));
}
else
{
OGS_FATAL
(
"Unrecognized time discretization type `%s'"
,
type
.
c_str
());
}
}
}
}
#endif // NUMLIB_TIMEDISCRETIZATION_BUILDER_H
#endif // NUMLIB_TIMEDISCRETIZATION_BUILDER_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment