mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-07-28 03:27:05 +00:00
Postprocessing: IncludeMask documentation
This commit is contained in:
@ -18,6 +18,27 @@ Licence:
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @class includeMask
|
||||
* @brief Base class for creating inclusion masks for data filtering
|
||||
*
|
||||
* includeMask is an abstract base class for creating masks that filter data
|
||||
* from a fieldsDataBase. Derived classes implement specific filtering criteria
|
||||
* through the getMask() method which returns a Mask object - a wrapper around
|
||||
* a vector of booleans that indicates which elements to include/exclude.
|
||||
*
|
||||
* This class follows a factory pattern with create() methods that instantiate
|
||||
* the appropriate derived mask type based on dictionary settings.
|
||||
*
|
||||
* Derived classes can implement various filtering strategies such as:
|
||||
* - Filtering by field values
|
||||
* - Filtering by spatial regions
|
||||
* - Filtering by predefined criteria
|
||||
*
|
||||
* The Mask objects returned by getMask() can be used in postprocessing operations
|
||||
* to include only the data points that match the specified criteria.
|
||||
*/
|
||||
|
||||
#ifndef __includeMask_hpp__
|
||||
#define __includeMask_hpp__
|
||||
|
||||
@ -28,36 +49,49 @@ Licence:
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
// forward declaration
|
||||
class fieldsDataBase;
|
||||
class dictionary;
|
||||
|
||||
|
||||
class includeMask
|
||||
{
|
||||
public:
|
||||
|
||||
/// @brief Wrapper around a boolean vector that represents elements to include/exclude
|
||||
/// Provides a functional interface to access the underlying mask vector
|
||||
/// where true indicates inclusion and false indicates exclusion.
|
||||
class Mask
|
||||
{
|
||||
/// @brief Reference to the underlying boolean vector
|
||||
const std::vector<bool>& mask_;
|
||||
|
||||
public:
|
||||
|
||||
/// @brief Constructor from a boolean vector
|
||||
/// @param msk Boolean vector where true means include, false means exclude
|
||||
Mask(const std::vector<bool>& msk)
|
||||
:
|
||||
mask_(msk)
|
||||
{}
|
||||
|
||||
/// @brief Copy constructor
|
||||
Mask(const Mask&) = default;
|
||||
|
||||
/// @brief Move constructor
|
||||
Mask(Mask&&) = default;
|
||||
|
||||
/// @brief Destructor
|
||||
~Mask()=default;
|
||||
|
||||
/// @brief Get the size of the mask
|
||||
auto size()const
|
||||
{
|
||||
return mask_.size();
|
||||
}
|
||||
|
||||
/// @brief Check if element at index i should be included
|
||||
/// @param i Index to check
|
||||
bool operator()(uint32 i)const
|
||||
{
|
||||
return mask_[i];
|
||||
@ -66,18 +100,28 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
/// @brief Reference to the database containing fields to be filtered
|
||||
fieldsDataBase& database_;
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("includeMask");
|
||||
|
||||
/// @brief Constructor
|
||||
/// @param opDict Dictionary containing operation settings
|
||||
/// @param feildsDB Database of fields
|
||||
includeMask(const dictionary& opDict, fieldsDataBase& feildsDB);
|
||||
|
||||
/// @brief Constructor with explicit type
|
||||
/// @param type Type of mask to create
|
||||
/// @param opDict Dictionary containing operation settings
|
||||
/// @param feildsDB Database of fields
|
||||
includeMask(const word& type, const dictionary& opDict, fieldsDataBase& feildsDB);
|
||||
|
||||
/// @brief Virtual destructor
|
||||
virtual ~includeMask() = default;
|
||||
|
||||
/// @brief Virtual constructor pattern implementation using dictionary
|
||||
create_vCtor
|
||||
(
|
||||
includeMask,
|
||||
@ -88,6 +132,7 @@ public:
|
||||
(opDict, feildsDB)
|
||||
);
|
||||
|
||||
/// @brief Virtual constructor pattern implementation using type and dictionary
|
||||
create_vCtor
|
||||
(
|
||||
includeMask,
|
||||
@ -100,24 +145,39 @@ public:
|
||||
(type, opDict, feildsDB)
|
||||
);
|
||||
|
||||
/// @brief Get const access to the database
|
||||
/// @return Const reference to the fields database
|
||||
const fieldsDataBase& database()const
|
||||
{
|
||||
return database_;
|
||||
}
|
||||
|
||||
/// @brief Get non-const access to the database
|
||||
/// @return Reference to the fields database
|
||||
fieldsDataBase& database()
|
||||
{
|
||||
return database_;
|
||||
}
|
||||
|
||||
/// @brief Get the mask for filtering elements
|
||||
/// @return Mask object indicating which elements to include
|
||||
virtual
|
||||
Mask getMask()= 0;
|
||||
|
||||
/// @brief Factory method to create appropriate mask type from dictionary
|
||||
/// @param opDict Dictionary with mask settings including type
|
||||
/// @param feildsDB Database of fields to filter
|
||||
/// @return Unique pointer to created mask instance
|
||||
static
|
||||
uniquePtr<includeMask> create(
|
||||
const dictionary& opDict,
|
||||
fieldsDataBase& feildsDB);
|
||||
|
||||
/// @brief Factory method to create mask with explicit type
|
||||
/// @param type Type of mask to create
|
||||
/// @param opDict Dictionary with mask settings
|
||||
/// @param feildsDB Database of fields to filter
|
||||
/// @return Unique pointer to created mask instance
|
||||
static
|
||||
uniquePtr<includeMask> create(
|
||||
const word& type,
|
||||
|
Reference in New Issue
Block a user