Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85619837
selector.hpp
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
Mon, Sep 30, 09:09
Size
3 KB
Mime Type
text/x-c++
Expires
Wed, Oct 2, 09:09 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
21218295
Attached To
rSPECMICP SpecMiCP / ReactMiCP
selector.hpp
View Options
/*-------------------------------------------------------
- Module : database
- File : selector.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget <fabieng@princeton.edu>, Princeton University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of the Princeton University 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 OWNER 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.
---------------------------------------------------------*/
#ifndef SPECMICP_DATABASE_SELECTOR_HPP
#define SPECMICP_DATABASE_SELECTOR_HPP
//! \file selector.hpp select species int the database
#include <vector>
#include "module.hpp"
namespace
specmicp
{
namespace
database
{
//! \brief Select species in the database
//!
//! This is a special class with the only function is to remove some components from the database
class
DatabaseSelector
:
public
DatabaseModule
{
public
:
DatabaseSelector
(
RawDatabasePtr
thedata
)
:
DatabaseModule
(
thedata
),
m_is_component_to_remove
(
thedata
->
nb_component
,
false
)
{}
//! Remove compoment in the list "id_component_to_remove"
void
remove_component
(
const
std
::
vector
<
index_t
>&
id_component_to_remove
);
//! keep only components in the "id_to_keep" list
void
keep_only_component
(
const
std
::
vector
<
index_t
>&
id_to_keep
);
//! \brief Remove all gas phase
void
remove_all_gas
();
private
:
//! \brief Analyse wich component should be removed
void
analyse_component
(
const
std
::
vector
<
index_t
>&
id_component_to_remove
);
//! \brief Select the correct aqueous species
void
select_aqueous
(
const
std
::
vector
<
index_t
>&
id_component_to_remove
);
//! \brief Select the correct minerals
void
select_minerals
(
const
std
::
vector
<
index_t
>&
id_component_to_remove
);
//! \brief Select the correct minerals governed by kinetics
void
select_minerals_kinetic
(
const
std
::
vector
<
index_t
>&
id_component_to_remove
);
//! \brief Select the gas phases
void
select_gas
(
const
std
::
vector
<
index_t
>&
id_component_to_remove
);
//! \brief Select components
//!
//! This should be the last operation
void
select_components
();
//! \brief Return true if the component must be removed
bool
is_component_to_remove
(
index_t
id
)
{
return
m_is_component_to_remove
[
id
];}
//! \brief Return the number of component to keep in the db
uindex_t
nb_component_to_keep
()
{
return
m_nb_component_to_keep
;}
std
::
vector
<
bool
>
m_is_component_to_remove
;
// true if component will be removed
uindex_t
m_nb_component_to_keep
;
// total number of component after the purging is done
};
}
// end namespace database
}
// end namespace specmicp
#endif
// SPECMICP_DATABASE_SELECTOR_HPP
Event Timeline
Log In to Comment