Postprocess framework

- Executed has been completed and testd.
- regions multipleSpheres are compelete
- Docs for regions is comelete.
This commit is contained in:
Hamidreza
2025-04-15 21:27:49 +03:30
parent 077f25842a
commit 093160ba32
21 changed files with 762 additions and 171 deletions

View File

@ -30,7 +30,8 @@ pFlow::lineRegionPoints::lineRegionPoints
if(raddi.size() != nPoints)
{
fatalErrorInFunction
<< "The number elements in of radii list should be equal to the number of points"<<endl;
<< "The number elements in of radii list should be equal to the "
<< "number of points"<<endl;
fatalExit;
}
@ -50,7 +51,7 @@ pFlow::lineRegionPoints::lineRegionPoints
pFlow::span<const pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) const
{
if(elem>=size())
if(elem >= size())
{
fatalErrorInFunction
<< "The element index is out of range. elem: " << elem
@ -58,13 +59,15 @@ pFlow::span<const pFlow::uint32> pFlow::lineRegionPoints::indices(uint32 elem) c
fatalExit;
}
return span<const uint32>(selectedPoints_[elem].data(), selectedPoints_[elem].size());
return span<const uint32>(
selectedPoints_[elem].data(),
selectedPoints_[elem].size());
}
bool pFlow::lineRegionPoints::update()
{
const auto points = database().updatePoints();
for(auto& elem:selectedPoints_)
for(auto& elem : selectedPoints_)
{
elem.clear();
}
@ -84,17 +87,18 @@ bool pFlow::lineRegionPoints::update()
bool pFlow::lineRegionPoints::write(iOstream &os) const
{
os <<"# Spheres along a straight line \n";
os <<"# No."<<tab <<"centerPoint" << tab <<"diameter"<<endl;
for(uint32 i=0; i< sphereRegions_.size(); ++i)
os << "# Spheres along a straight line \n";
os << "# No." << tab << "centerPoint" << tab << "diameter" << endl;
for(uint32 i=0; i < sphereRegions_.size(); ++i)
{
os <<"# "<<i<<tab<<sphereRegions_[i].center() << tab <<diameters_[i] << '\n';
os << "# " << i << tab << sphereRegions_[i].center()
<< tab << diameters_[i] << '\n';
}
os<<"time/No. ";
for(uint32 i=0; i< sphereRegions_.size(); ++i)
os << "time/No. ";
for(uint32 i=0; i < sphereRegions_.size(); ++i)
{
os <<i<<tab;
os << i << tab;
}
os <<endl;
os << endl;
return true;
}

View File

@ -18,14 +18,42 @@ Licence:
-----------------------------------------------------------------------------*/
/**
* @class lineRegionPoints
* @brief Spherical regions along a line for selecting points/particles
*
* The lineRegionPoints class is responsible for selecting points/particles along a
* specified line and creating sphere regions around those points. It partitions
* the line into multiple sphere regions (equally spaced) and keeps track of
* which points/particles in the simulation fall into each region.
*
* This class is used for post-processing data by analyzing distributions of
* particles along a linear path through the simulation domain. It maintains:
* - A line defining the sampling path
* - Spherical regions along this line that include particles
* - Center points for each region
* - Volumes and diameters of regions
* - Indices of points/particles contained in each region
*
* The regions can be updated as the simulation progresses, and the data
* can be written to output for analysis.
*
* @see regionPoints
* @see line
* @see sphere
* @see fieldsDataBase
*/
#ifndef __lineRegionPoints_hpp__
#define __lineRegionPoints_hpp__
#include "regionPoints.hpp"
#include "line.hpp"
#include "sphere.hpp"
#include "Vectors.hpp"
namespace pFlow
{
@ -35,68 +63,80 @@ class lineRegionPoints
{
private:
/// line region for selecting points
/// Line path defining the axis of the spherical regions
line line_;
/// all sphere regions
/// Collection of sphere regions along the line
Vector<sphere> sphereRegions_;
/// center poitns of regions/elements
/// Center points of all spherical regions
realx3Vector centerPoints_;
/// volumes of all elements/regions
/// Volumes of all spherical regions
realVector volumes_;
/// Diameters of all spherical regions
realVector diameters_;
/// the point indices that are selected by this region
/// Point/particles indices selected by each region
Vector<uint32Vector> selectedPoints_;
public:
/// Type information for runtime type identification
TypeInfo(line::TYPENAME());
/// Construct from dictionary that contains lineInfo and fields database
lineRegionPoints(
const dictionary& dict,
fieldsDataBase& fieldsDataBase);
/// Default destructor
~lineRegionPoints() override = default;
/// Return number of regions
uint32 size()const override
{
return sphereRegions_.size();
}
/// Check if regions list is empty
bool empty()const override
{
return sphereRegions_.empty();
}
/// Return volumes of all regions
span<const real> volumes()const override
{
return span<const real>(volumes_.data(), volumes_.size());
}
/// Return equivalent diameters of all regions
span<const real> eqDiameters()const override
{
return span<const real>(diameters_.data(), diameters_.size());
}
/// Return center points of all regions
span<const realx3> centers()const override
{
return span<const realx3>(centerPoints_.data(), centerPoints_.size());
}
/// Return indices of points in the specified element/region
span<const uint32> indices(uint32 elem)const override;
/// Update regions based on current particle positions
bool update() override;
/// Whether to write all data to the same time file
bool writeToSameTimeFile()const override
{
return true;
}
/// Write data to output stream
bool write(iOstream& os) const override;
};