Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
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
Feliks Kiszkurno
ogs-feliks
Commits
a6ac6a1b
Commit
a6ac6a1b
authored
9 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[PL] clang-format ProcessVariable.
parent
e118b539
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ProcessLib/ProcessVariable.cpp
+74
-78
74 additions, 78 deletions
ProcessLib/ProcessVariable.cpp
ProcessLib/ProcessVariable.h
+42
-40
42 additions, 40 deletions
ProcessLib/ProcessVariable.h
with
116 additions
and
118 deletions
ProcessLib/ProcessVariable.cpp
+
74
−
78
View file @
a6ac6a1b
...
@@ -18,81 +18,76 @@
...
@@ -18,81 +18,76 @@
#include
"UniformDirichletBoundaryCondition.h"
#include
"UniformDirichletBoundaryCondition.h"
#include
"InitialCondition.h"
#include
"InitialCondition.h"
namespace
ProcessLib
namespace
ProcessLib
{
{
ProcessVariable
::
ProcessVariable
(
ConfigTree
const
&
config
,
ProcessVariable
::
ProcessVariable
(
MeshLib
::
Mesh
const
&
mesh
,
ConfigTree
const
&
config
,
GeoLib
::
GEOObjects
const
&
geometries
)
MeshLib
::
Mesh
const
&
mesh
,
:
_name
(
config
.
get
<
std
::
string
>
(
"name"
)),
_mesh
(
mesh
)
GeoLib
::
GEOObjects
const
&
geometries
)
:
_name
(
config
.
get
<
std
::
string
>
(
"name"
)),
_mesh
(
mesh
)
{
{
DBUG
(
"Constructing process variable %s"
,
this
->
_name
.
c_str
());
DBUG
(
"Constructing process variable %s"
,
this
->
_name
.
c_str
());
// Initial condition
// Initial condition
{
{
auto
const
&
ic_config
=
config
.
find
(
"initial_condition"
);
auto
const
&
ic_config
=
config
.
find
(
"initial_condition"
);
if
(
ic_config
==
config
.
not_found
())
if
(
ic_config
==
config
.
not_found
())
INFO
(
"No initial condition found."
);
INFO
(
"No initial condition found."
);
std
::
string
const
type
=
std
::
string
const
type
=
config
.
get
<
std
::
string
>
(
"initial_condition.type"
);
config
.
get
<
std
::
string
>
(
"initial_condition.type"
);
if
(
type
==
"Uniform"
)
if
(
type
==
"Uniform"
)
{
{
_initial_condition
.
reset
(
_initial_condition
.
reset
(
new
UniformInitialCondition
(
ic_config
->
second
));
new
UniformInitialCondition
(
ic_config
->
second
));
}
}
else
else
{
{
ERR
(
"Unknown type of the initial condition."
);
ERR
(
"Unknown type of the initial condition."
);
}
}
}
}
// Boundary conditions
// Boundary conditions
{
{
auto
const
&
bcs_config
=
config
.
find
(
"boundary_conditions"
);
auto
const
&
bcs_config
=
config
.
find
(
"boundary_conditions"
);
if
(
bcs_config
==
config
.
not_found
())
if
(
bcs_config
==
config
.
not_found
())
INFO
(
"No boundary conditions found."
);
INFO
(
"No boundary conditions found."
);
for
(
auto
const
&
bc_iterator
:
bcs_config
->
second
)
for
(
auto
const
&
bc_iterator
:
bcs_config
->
second
)
{
{
ConfigTree
const
&
bc_config
=
bc_iterator
.
second
;
ConfigTree
const
&
bc_config
=
bc_iterator
.
second
;
// Find corresponding GeoObject
// Find corresponding GeoObject
std
::
string
const
geometrical_set_name
=
std
::
string
const
geometrical_set_name
=
bc_config
.
get
<
std
::
string
>
(
"geometrical_set"
);
bc_config
.
get
<
std
::
string
>
(
"geometrical_set"
);
std
::
string
const
geometry_name
=
std
::
string
const
geometry_name
=
bc_config
.
get
<
std
::
string
>
(
"geometry"
);
bc_config
.
get
<
std
::
string
>
(
"geometry"
);
GeoLib
::
GeoObject
const
*
const
geometry
=
geometries
.
getGeoObject
(
GeoLib
::
GeoObject
const
*
const
geometry
=
geometrical_set_name
,
geometry_name
);
geometries
.
getGeoObject
(
geometrical_set_name
,
geometry_name
);
DBUG
(
"Found geometry type
\"
%s
\"
"
,
DBUG
(
GeoLib
::
convertGeoTypeToString
(
geometry
->
getGeoType
()).
c_str
());
"Found geometry type
\"
%s
\"
"
,
GeoLib
::
convertGeoTypeToString
(
geometry
->
getGeoType
()).
c_str
());
// Construct type dependent boundary condition
std
::
string
const
type
=
bc_config
.
get
<
std
::
string
>
(
"type"
);
// Construct type dependent boundary condition
std
::
string
const
type
=
bc_config
.
get
<
std
::
string
>
(
"type"
);
if
(
type
==
"UniformDirichlet"
)
{
if
(
type
==
"UniformDirichlet"
)
_dirichlet_bcs
.
emplace_back
(
{
new
UniformDirichletBoundaryCondition
(
_dirichlet_bcs
.
emplace_back
(
geometry
,
bc_config
));
new
UniformDirichletBoundaryCondition
(
geometry
,
bc_config
));
}
}
else
if
(
type
==
"UniformNeumann"
)
else
if
(
type
==
"UniformNeumann"
)
{
{
_neumann_bc_configs
.
emplace_back
(
_neumann_bc_configs
.
emplace_back
(
new
NeumannBcConfig
(
geometry
,
bc_config
));
new
NeumannBcConfig
(
geometry
,
bc_config
));
}
}
else
else
{
{
ERR
(
"Unknown type
\'
%s
\'
of the boundary condition."
,
ERR
(
"Unknown type
\'
%s
\'
of the boundary condition."
,
type
.
c_str
());
type
.
c_str
());
}
}
}
}
}
}
}
}
ProcessVariable
::
ProcessVariable
(
ProcessVariable
&&
other
)
ProcessVariable
::
ProcessVariable
(
ProcessVariable
&&
other
)
...
@@ -101,24 +96,25 @@ ProcessVariable::ProcessVariable(ProcessVariable&& other)
...
@@ -101,24 +96,25 @@ ProcessVariable::ProcessVariable(ProcessVariable&& other)
_initial_condition
(
std
::
move
(
other
.
_initial_condition
)),
_initial_condition
(
std
::
move
(
other
.
_initial_condition
)),
_dirichlet_bcs
(
std
::
move
(
other
.
_dirichlet_bcs
)),
_dirichlet_bcs
(
std
::
move
(
other
.
_dirichlet_bcs
)),
_neumann_bc_configs
(
std
::
move
(
other
.
_neumann_bc_configs
))
_neumann_bc_configs
(
std
::
move
(
other
.
_neumann_bc_configs
))
{}
{
}
std
::
string
const
&
ProcessVariable
::
getName
()
const
std
::
string
const
&
ProcessVariable
::
getName
()
const
{
{
return
_name
;
return
_name
;
}
}
MeshLib
::
Mesh
const
&
ProcessVariable
::
getMesh
()
const
MeshLib
::
Mesh
const
&
ProcessVariable
::
getMesh
()
const
{
{
return
_mesh
;
return
_mesh
;
}
}
void
ProcessVariable
::
initializeDirichletBCs
(
void
ProcessVariable
::
initializeDirichletBCs
(
MeshGeoToolsLib
::
MeshNodeSearcher
&
searcher
,
MeshGeoToolsLib
::
MeshNodeSearcher
&
searcher
,
std
::
vector
<
std
::
size_t
>&
global_ids
,
std
::
vector
<
double
>&
values
)
std
::
vector
<
std
::
size_t
>&
global_ids
,
std
::
vector
<
double
>&
values
)
{
{
for
(
auto
&
bc
:
_dirichlet_bcs
)
for
(
auto
&
bc
:
_dirichlet_bcs
)
bc
->
initialize
(
searcher
,
global_ids
,
values
);
bc
->
initialize
(
searcher
,
global_ids
,
values
);
}
}
}
// namespace ProcessLib
}
// namespace ProcessLib
This diff is collapsed.
Click to expand it.
ProcessLib/ProcessVariable.h
+
42
−
40
View file @
a6ac6a1b
...
@@ -18,71 +18,73 @@
...
@@ -18,71 +18,73 @@
namespace
MeshGeoToolsLib
namespace
MeshGeoToolsLib
{
{
class
MeshNodeSearcher
;
class
MeshNodeSearcher
;
class
BoundaryElementsSearcher
;
class
BoundaryElementsSearcher
;
}
}
namespace
MeshLib
namespace
MeshLib
{
{
class
Mesh
;
class
Mesh
;
}
}
namespace
GeoLib
namespace
GeoLib
{
{
class
GEOObjects
;
class
GEOObjects
;
}
}
namespace
ProcessLib
namespace
ProcessLib
{
{
class
NeumannBcConfig
;
class
NeumannBcConfig
;
class
InitialCondition
;
class
InitialCondition
;
class
UniformDirichletBoundaryCondition
;
class
UniformDirichletBoundaryCondition
;
}
}
namespace
ProcessLib
namespace
ProcessLib
{
{
/// A named process variable. Its properties includes the mesh, and the initial
/// A named process variable. Its properties includes the mesh, and the initial
/// and boundary conditions.
/// and boundary conditions.
class
ProcessVariable
class
ProcessVariable
{
{
using
ConfigTree
=
boost
::
property_tree
::
ptree
;
using
ConfigTree
=
boost
::
property_tree
::
ptree
;
public:
public:
ProcessVariable
(
ConfigTree
const
&
config
,
MeshLib
::
Mesh
const
&
mesh
,
ProcessVariable
(
ConfigTree
const
&
config
,
MeshLib
::
Mesh
const
&
mesh
,
GeoLib
::
GEOObjects
const
&
geometries
);
GeoLib
::
GEOObjects
const
&
geometries
);
ProcessVariable
(
ProcessVariable
&&
);
ProcessVariable
(
ProcessVariable
&&
);
std
::
string
const
&
getName
()
const
;
std
::
string
const
&
getName
()
const
;
/// Returns a mesh on which the process variable is defined.
/// Returns a mesh on which the process variable is defined.
MeshLib
::
Mesh
const
&
getMesh
()
const
;
MeshLib
::
Mesh
const
&
getMesh
()
const
;
void
initializeDirichletBCs
(
MeshGeoToolsLib
::
MeshNodeSearcher
&
searcher
,
void
initializeDirichletBCs
(
MeshGeoToolsLib
::
MeshNodeSearcher
&
searcher
,
std
::
vector
<
std
::
size_t
>&
global_ids
,
std
::
vector
<
double
>&
values
);
std
::
vector
<
std
::
size_t
>&
global_ids
,
std
::
vector
<
double
>&
values
);
template
<
typename
OutputIterator
,
typename
GlobalSetup
,
typename
...
Args
>
void
createNeumannBcs
(
OutputIterator
bcs
,
template
<
typename
OutputIterator
,
typename
GlobalSetup
,
typename
...
Args
>
MeshGeoToolsLib
::
BoundaryElementsSearcher
&
searcher
,
void
createNeumannBcs
(
OutputIterator
bcs
,
GlobalSetup
const
&
,
MeshGeoToolsLib
::
BoundaryElementsSearcher
&
searcher
,
Args
&&
...
args
)
GlobalSetup
const
&
,
{
Args
&&
...
args
)
for
(
auto
&
config
:
_neumann_bc_configs
)
{
{
for
(
auto
&
config
:
_neumann_bc_configs
)
config
->
initialize
(
searcher
);
{
bcs
=
new
NeumannBc
<
GlobalSetup
>
(
*
config
,
std
::
forward
<
Args
>
(
args
)...);
config
->
initialize
(
searcher
);
}
bcs
=
new
NeumannBc
<
GlobalSetup
>
(
*
config
,
}
std
::
forward
<
Args
>
(
args
)...);
}
}
private
:
private
:
std
::
string
const
_name
;
std
::
string
const
_name
;
MeshLib
::
Mesh
const
&
_mesh
;
MeshLib
::
Mesh
const
&
_mesh
;
std
::
unique_ptr
<
InitialCondition
>
_initial_condition
;
std
::
unique_ptr
<
InitialCondition
>
_initial_condition
;
std
::
vector
<
std
::
unique_ptr
<
UniformDirichletBoundaryCondition
>
>
_dirichlet_bcs
;
std
::
vector
<
std
::
unique_ptr
<
UniformDirichletBoundaryCondition
>>
std
::
vector
<
std
::
unique_ptr
<
NeumannBcConfig
>
>
_neumann_bc_configs
;
_dirichlet_bcs
;
std
::
vector
<
std
::
unique_ptr
<
NeumannBcConfig
>>
_neumann_bc_configs
;
};
};
}
// namespace ProcessLib
}
// namespace ProcessLib
#endif // PROCESS_LIB_PROCESS_VARIABLE_H_
#endif // PROCESS_LIB_PROCESS_VARIABLE_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