Page MenuHomec4science

selector.hpp
No OneTemporary

File Metadata

Created
Fri, Dec 27, 08:07

selector.hpp

/*-------------------------------------------------------
- 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