Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91980688
adim_constraints.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, Nov 16, 08:39
Size
4 KB
Mime Type
text/x-c
Expires
Mon, Nov 18, 08:39 (2 d)
Engine
blob
Format
Raw Data
Handle
22358201
Attached To
rSPECMICP SpecMiCP / ReactMiCP
adim_constraints.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 "adim_constraints.hpp"
#include "specmicp/adimensional/adimensional_system_solver_structs.hpp"
#include "specmicp_common/cached_vector.hpp"
namespace
specmicp
{
namespace
reactmicp
{
namespace
systems
{
struct
AdimReactMiCPConstraints
::
AdimReactMiCPConstraintsImpl
{
AdimReactMiCPConstraintsImpl
(
index_t
nb_nodes
)
:
m_constraints
(
nb_nodes
,
"default"
,
AdimensionalSystemConstraints
())
{}
utils
::
NameCachedVector
<
AdimensionalSystemConstraints
>
m_constraints
;
};
AdimReactMiCPConstraints
::
AdimReactMiCPConstraints
(
index_t
nb_nodes
)
:
m_impl
(
utils
::
make_pimpl
<
AdimReactMiCPConstraintsImpl
>
(
nb_nodes
))
{}
AdimReactMiCPConstraints
::~
AdimReactMiCPConstraints
()
=
default
;
bool
AdimReactMiCPConstraints
::
has_constraint
(
const
std
::
string
&
name
)
const
{
return
m_impl
->
m_constraints
.
has_value
(
name
);
}
const
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
get_constraint
(
uindex_t
node
)
const
{
return
m_impl
->
m_constraints
[
node
];
}
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
get_constraint
(
uindex_t
node
)
{
return
m_impl
->
m_constraints
[
node
];
}
const
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
get_constraint
(
const
std
::
string
&
name
)
const
{
return
m_impl
->
m_constraints
.
get
(
name
);
}
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
get_constraint
(
const
std
::
string
&
name
)
{
return
m_impl
->
m_constraints
.
get
(
name
);
}
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
fork_constraint
(
uindex_t
node
,
const
std
::
string
&
name
)
{
return
m_impl
->
m_constraints
.
fork
(
node
,
name
);
}
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
fork_constraint
(
const
std
::
string
&
old_name
,
const
std
::
string
&
new_name
)
{
m_impl
->
m_constraints
.
fork
(
old_name
,
new_name
);
return
m_impl
->
m_constraints
.
get
(
new_name
);
}
AdimensionalSystemConstraints
&
AdimReactMiCPConstraints
::
add_constraint
(
const
std
::
string
&
name
)
{
m_impl
->
m_constraints
.
emplace_back_cache
(
name
);
return
m_impl
->
m_constraints
.
get
(
name
);
}
void
AdimReactMiCPConstraints
::
set_constraint
(
uindex_t
node
,
const
std
::
string
&
name
)
{
return
m_impl
->
m_constraints
.
set
(
node
,
name
);
}
}
// namespace systems
}
// namespace reactmicp
}
// namespace specmicp
Event Timeline
Log In to Comment