Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F74465229
configuration_chloride.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 27, 23:34
Size
4 KB
Mime Type
text/x-c
Expires
Mon, Jul 29, 23:34 (2 d)
Engine
blob
Format
Raw Data
Handle
19395143
Attached To
rSPECMICP SpecMiCP / ReactMiCP
configuration_chloride.cpp
View Options
/* =============================================================================
Copyright (c) 2014-2017 F. Georget <fabieng@princeton.edu> Princeton University
Copyright (c) 2017-2018 F. Georget <fabien.georget@epfl.ch> EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
============================================================================= */
#include "configuration_chloride.hpp"
#include "specmicp_database/database.hpp"
#include "reactmicp/systems/chloride/boundary_conditions.hpp"
#include "specmicp_common/io/safe_config.hpp"
#include "specmicp_common/log.hpp"
#include "configuration_common.hpp"
#define S_BCS_A_FIXEDNODES "fixed_nodes"
#define S_BCS_A_FIXEDCONCENTRATIONS "fixed_concentrations"
#define S_BCS_A_FIXEDPOTENTIAL "fixed_potentials"
#define S_BCS_V_FIXEDALLPOTENTIALS "fix_all_potentials"
#define S_BCS_SS_CONSTRAINTS "constraints"
namespace
specmicp
{
namespace
io
{
using
namespace
reactmicp
::
systems
::
chloride
;
std
::
shared_ptr
<
BoundaryConditions
>
configure_chloride_boundary_conditions
(
mesh
::
Mesh1DPtr
amesh
,
database
::
RawDatabasePtr
raw_data
,
YAMLConfigHandle
&&
configuration
)
{
auto
bcs
=
BoundaryConditions
::
make
(
amesh
,
raw_data
);
if
(
configuration
.
has_node
(
S_BCS_A_FIXEDNODES
))
{
const
std
::
vector
<
uindex_t
>
fixed_nodes
=
configuration
.
list_to_vector
<
uindex_t
>
(
S_BCS_A_FIXEDNODES
);
std
::
ostringstream
msg
;
msg
<<
"Fixed nodes : "
;
for
(
auto
node
:
fixed_nodes
)
{
bcs
->
fix_node
(
node
);
msg
<<
node
<<
"; "
;
}
SPC_CONF_LOG
<<
msg
.
str
();
}
if
(
configuration
.
has_node
(
S_BCS_A_FIXEDCONCENTRATIONS
))
{
const
std
::
vector
<
uindex_t
>
fixed_conc
=
configuration
.
list_to_vector
<
uindex_t
>
(
S_BCS_A_FIXEDCONCENTRATIONS
);
std
::
ostringstream
msg
;
msg
<<
"Fixed concentrations nodes : "
;
for
(
auto
node
:
fixed_conc
)
{
bcs
->
fix_node
(
node
);
msg
<<
node
<<
"; "
;
}
SPC_CONF_LOG
<<
msg
.
str
();
}
if
(
configuration
.
has_node
(
S_BCS_A_FIXEDPOTENTIAL
))
{
const
std
::
vector
<
uindex_t
>
fixed_pot
=
configuration
.
list_to_vector
<
uindex_t
>
(
S_BCS_A_FIXEDPOTENTIAL
);
std
::
ostringstream
msg
;
msg
<<
"Fixed potential nodes : "
;
for
(
auto
node
:
fixed_pot
)
{
bcs
->
fix_node
(
node
);
msg
<<
node
<<
"; "
;
}
SPC_CONF_LOG
<<
msg
.
str
();
}
if
(
configuration
.
get_optional_attribute
<
bool
>
(
S_BCS_V_FIXEDALLPOTENTIALS
,
false
))
{
SPC_CONF_LOG
<<
"Fixed all potentials: True"
;
bcs
->
fix_all_potentials
();
}
else
{
SPC_CONF_LOG
<<
"Fixed all potentials: False"
;
}
if
(
configuration
.
has_section
(
S_BCS_SS_CONSTRAINTS
))
{
configure_bcs_constraints
(
bcs
.
get
(),
raw_data
.
get
(),
configuration
.
get_section
(
S_BCS_SS_CONSTRAINTS
));
}
return
bcs
;
}
}
// namespace io
}
// namespace specmicp
Event Timeline
Log In to Comment