Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121623165
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
Sat, Jul 12, 13:56
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Jul 14, 13:56 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27360929
Attached To
rSPECMICP SpecMiCP / ReactMiCP
selector.hpp
View Options
/*-------------------------------------------------------
- Module : database
- File : selector.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget, Princeton University
---------------------------------------------------------*/
#ifndef SPECMICP_DATABASE_SELECTOR_HPP
#define SPECMICP_DATABASE_SELECTOR_HPP
//! \file selector.hpp select species int the database
#include <vector>
#include <memory>
#include "data_container.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
:
DatabaseSelector
(
std
::
shared_ptr
<
DataContainer
>
thedata
)
:
data
(
thedata
),
m_is_component_to_remove
(
thedata
->
nb_component
,
false
)
{}
void
remove_component
(
const
std
::
vector
<
int
>&
id_component_to_remove
)
{
analyse_component
(
id_component_to_remove
);
select_aqueous
(
id_component_to_remove
);
select_minerals
(
id_component_to_remove
);
select_components
();
}
private
:
//! \brief Analyse wich component should be removed
void
analyse_component
(
const
std
::
vector
<
int
>&
id_component_to_remove
);
//! \brief Select the correct aqueous species
void
select_aqueous
(
const
std
::
vector
<
int
>&
id_component_to_remove
);
//! \brief Select the correct minerals
void
select_minerals
(
const
std
::
vector
<
int
>&
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
(
int
id
)
{
return
m_is_component_to_remove
[
id
];}
int
nb_component_to_keep
()
{
return
m_nb_component_to_keep
;}
std
::
shared_ptr
<
DataContainer
>
data
;
std
::
vector
<
bool
>
m_is_component_to_remove
;
int
m_nb_component_to_keep
;
};
}
// end namespace database
}
// end namespace specmicp
#endif
// SPECMICP_DATABASE_SELECTOR_HPP
Event Timeline
Log In to Comment