OpenLB 1.7
Loading...
Searching...
No Matches
Functions
olb::particles::io Namespace Reference

Functions

template<typename VECTOR >
std::string strFormatVector (VECTOR vector, int strWidth=13)
 Generic vector print method.
 
template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void printGenericParticleInfo (DynamicFieldGroupsD< T, typename PARTICLETYPE::fields_t > &dynamicFieldGroups, std::size_t iP)
 Generic printing method for particles, which automatically traverses through all provided fields.
 
template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void printResolvedParticleInfoSimple (Particle< T, PARTICLETYPE > &particle)
 Simple printing method for resolved particles.
 
template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void printResolvedParticleInfo (Particle< T, PARTICLETYPE > &particle, const std::string &streamName="ParticleInfo")
 Printing method adapted to the original output.
 
template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void printSubgridParticleInfo (Particle< T, PARTICLETYPE > &particle, const std::string &streamName="ParticleInfo")
 
template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void printSubgridParticleInfoSimple (Particle< T, PARTICLETYPE > &particle)
 Simple printing method for subgrid particles.
 

Function Documentation

◆ printGenericParticleInfo()

template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void olb::particles::io::printGenericParticleInfo ( DynamicFieldGroupsD< T, typename PARTICLETYPE::fields_t > & dynamicFieldGroups,
std::size_t iP )

Generic printing method for particles, which automatically traverses through all provided fields.

Definition at line 58 of file particleIoFunctions.h.

59{
60 OstreamManager clout( std::cout, "Particle "+std::to_string(iP) );
61 clout.setMultiOutput(multiOutput);
62 clout << "================================================" << std::endl;
63 //Define output lambda expression
64 typedef std::function<bool(const std::type_info&,int,std::string)> FunctionType;
65 FunctionType printFunction = [](const std::type_info& typeInfo, int fieldSize, std::string fieldContentStr) {
66 OstreamManager clout( std::cout,"Field" );
67 clout << std::setw(45) << std::string(typeInfo.name()) << " (" << fieldSize << ") : " << fieldContentStr << std::endl;
68 return false; //resetField=false
69 };
70 //Call recursive field traversal function with lambda expression
72 printFunction, dynamicFieldGroups, iP );
73 clout << "================================================" << std::endl;
74 clout.setMultiOutput(false);
75}
class for marking output with some text
Traversal of nested field contents for output and initialization.

References olb::OstreamManager::setMultiOutput().

+ Here is the call graph for this function:

◆ printResolvedParticleInfo()

template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void olb::particles::io::printResolvedParticleInfo ( Particle< T, PARTICLETYPE > & particle,
const std::string & streamName = "ParticleInfo" )

Printing method adapted to the original output.

Definition at line 110 of file particleIoFunctions.h.

111{
112
113 //Set up environment
114 using namespace descriptors;
115 using namespace access;
116 constexpr unsigned D = PARTICLETYPE::d;
118
119 //Retrieve data
120 std::size_t particleLocalID = particle.getId();
121 const bool hasGlobalID = PARTICLETYPE::template providesNested<PARALLELIZATION,ID>();
122 auto indicatorPtr = particle.template getField<SURFACE,SINDICATOR>();
123 T sIndiCircumRadius = indicatorPtr->getCircumRadius();
124 T mass = particle.template getField<PHYSPROPERTIES,MASS>();
125 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() );
126 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() );
127 Vector<T,Drot> angularVelocity( particle.template getField<MOBILITY,ANG_VELOCITY>() );
128 Vector<T,Drot> angle( particle.template getField<SURFACE,ANGLE>() );
129 Vector<T,D> force( particle.template getField<FORCING,FORCE>() );
130 Vector<T,D> acceleration( particle.template getField<MOBILITY,ACCELERATION_STRD>() );
131 Vector<T,Drot> angularAcceleration( particle.template getField<MOBILITY,ANG_ACC_STRD>() );
132 Vector<T,Drot> momentOfInertia( particle.template getField<PHYSPROPERTIES,MOFI>() );
133
134 //Translate angle from radian to degree
135 angle *= (180/M_PI);
136 angularVelocity *= (180/M_PI);
137 angularAcceleration *= (180/M_PI);
138
139 //Print data
140 OstreamManager clout( std::cout,streamName );
141 clout.setMultiOutput(multiOutput);
142 if constexpr(!hasGlobalID){
143 clout << "Particle " << "ID=" << particleLocalID;
144 } else {
145 std::size_t particleGlobalID = particle.template getField<PARALLELIZATION,ID>();
146 clout << "Particle " << "LokalID=" << particleLocalID << ", GlobalID=" << particleGlobalID;
147 }
148 if constexpr(providesActive<PARTICLETYPE>()){
149 bool active = isActive(particle);
150 clout << " (" << (active ? "active" : "idle") << ")";
151 }
152 clout << std::endl;
153 clout << " |Circum radius(m)= " << std::setw(13) << sIndiCircumRadius << std::endl;
154 clout << " |Mass(kg)= " << std::setw(13) << mass << std::endl;
155 clout << " |Position(m)= " << strFormatVector<Vector<T,D>>(position) << std::endl;
156 clout << " |Angle(°)= " << strFormatVector<Vector<T,Drot>>(angle) << std::endl;
157 clout << " |Velocity(m/s)= " << strFormatVector<Vector<T,D>>(velocity) << std::endl;
158 clout << " |Ang. Velocity(°/s)= " << strFormatVector<Vector<T,Drot>>(angularVelocity) << std::endl;
159 clout << " |Force(N)= " << strFormatVector<Vector<T,D>>(force) << std::endl;
160 clout << " |Acceleration(m/s^2)= " << strFormatVector<Vector<T,D>>(acceleration) << std::endl;
161 clout << " |Ang. acc.(°/s^2)= " << strFormatVector<Vector<T,Drot>>(angularAcceleration) << std::endl;
162 clout << " |Moment of inertia(kg m^2)= " << strFormatVector<Vector<T,Drot>>(momentOfInertia) << std::endl;
163 clout.setMultiOutput(false);
164}
#define M_PI
Plain old scalar vector.
Definition vector.h:47
std::size_t getId() const
Return memory ID of the currently represented particle.
Definition particle.hh:67
Converts dimensions by deriving from given cartesian dimension D.

References olb::particles::Particle< T, PARTICLETYPE >::getId(), M_PI, and olb::OstreamManager::setMultiOutput().

+ Here is the call graph for this function:

◆ printResolvedParticleInfoSimple()

template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void olb::particles::io::printResolvedParticleInfoSimple ( Particle< T, PARTICLETYPE > & particle)

Simple printing method for resolved particles.

Definition at line 80 of file particleIoFunctions.h.

81{
82 using namespace descriptors;
83 constexpr unsigned D = PARTICLETYPE::d;
85 //Retrieve Data
86 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() );
87 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() );
88 Vector<T,Drot> angularVelocity( particle.template getField<MOBILITY,ANG_VELOCITY>() );
89 Vector<T,Drot> angle( particle.template getField<SURFACE,ANGLE>() );
90 auto indicatorPtr = particle.template getField<SURFACE,SINDICATOR>();
91 //Print data
92 OstreamManager clout( std::cout,"Particle" );
93 clout.setMultiOutput(multiOutput);
94 clout << "================================================" << std::endl;
95 clout << "Position(m)= " << std::setw(13) << position << std::endl;
96 clout << "Velocity(m/s)= " << std::setw(13) << velocity << std::endl;
97 clout << "Ang. Velocity(m/s)= " << std::setw(13) << angularVelocity << std::endl;
98 clout << "Angle(rad)= " << std::setw(13) << angle << std::endl;
99 clout << "Indi Pos= " << std::setw(13) << indicatorPtr->getPos() << std::endl;
100 clout << "Indi Min= " << std::setw(13) << indicatorPtr->getMin() << std::endl;
101 clout << "Indi Max= " << std::setw(13) << indicatorPtr->getMax() << std::endl;
102 clout << "================================================" << std::endl;
103 clout.setMultiOutput(false);
104}

References olb::OstreamManager::setMultiOutput().

+ Here is the call graph for this function:

◆ printSubgridParticleInfo()

template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void olb::particles::io::printSubgridParticleInfo ( Particle< T, PARTICLETYPE > & particle,
const std::string & streamName = "ParticleInfo" )

Definition at line 167 of file particleIoFunctions.h.

168{
169
170 //Set up environment
171 using namespace descriptors;
172 using namespace access;
173 constexpr unsigned D = PARTICLETYPE::d;
174
175 //Retrieve data
176 std::size_t particleLocalID = particle.getId();
177 const bool hasGlobalID = PARTICLETYPE::template providesNested<PARALLELIZATION,ID>();
178 T radius = particle.template getField<PHYSPROPERTIES,RADIUS>();
179 T mass = particle.template getField<PHYSPROPERTIES,MASS>();
180 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() );
181 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() );
182 Vector<T,D> force( particle.template getField<FORCING,FORCE>() );
183
184 //Print data
185 OstreamManager clout( std::cout,streamName );
186 clout.setMultiOutput(multiOutput);
187 if constexpr(!hasGlobalID){
188 clout << "Particle " << "ID=" << particleLocalID;
189 } else {
190 std::size_t particleGlobalID = particle.template getField<PARALLELIZATION,ID>();
191 clout << "Particle " << "LokalID=" << particleLocalID << ", GlobalID=" << particleGlobalID;
192 }
193 if constexpr(providesActive<PARTICLETYPE>()){
194 bool active = isActive(particle);
195 clout << " (" << (active ? "active" : "idle") << ")";
196 }
197 clout << std::endl;
198 clout << " |Radius(m)= " << std::setw(13) << radius << std::endl;
199 clout << " |Mass(kg)= " << std::setw(13) << mass << std::endl;
200 clout << " |Position(m)= " << strFormatVector<Vector<T,D>>(position) << std::endl;
201 clout << " |Velocity(m/s)= " << strFormatVector<Vector<T,D>>(velocity) << std::endl;
202 clout << " |Force(N)= " << strFormatVector<Vector<T,D>>(force) << std::endl;
203 clout.setMultiOutput(false);
204}

References olb::particles::Particle< T, PARTICLETYPE >::getId(), and olb::OstreamManager::setMultiOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printSubgridParticleInfoSimple()

template<typename T , typename PARTICLETYPE , bool multiOutput = access::providesParallelization<PARTICLETYPE>()>
void olb::particles::io::printSubgridParticleInfoSimple ( Particle< T, PARTICLETYPE > & particle)

Simple printing method for subgrid particles.

Definition at line 208 of file particleIoFunctions.h.

209{
210 using namespace descriptors;
211 constexpr unsigned D = PARTICLETYPE::d;
212 /* constexpr unsigned Drot = utilities::dimensions::convert<D>::rotation; */
213 //Retrieve Data
214 Vector<T,D> position( particle.template getField<GENERAL,POSITION>() );
215 Vector<T,D> velocity( particle.template getField<MOBILITY,VELOCITY>() );
216 bool activity( particle.template getField<DYNBEHAVIOUR,ACTIVE>() );
217 //Print data
218 OstreamManager clout( std::cout,"Particle" );
219 clout.setMultiOutput(multiOutput);
220 clout << "================================================" << std::endl;
221 clout << "Position(m)= " << std::setw(13) << position << std::endl;
222 clout << "Velocity(m/s)= " << std::setw(13) << velocity << std::endl;
223 clout << "Active= " << std::setw(13) << activity << std::endl;
224 clout << "================================================" << std::endl;
225 clout.setMultiOutput(false);
226}

References olb::OstreamManager::setMultiOutput().

+ Here is the call graph for this function:

◆ strFormatVector()

template<typename VECTOR >
std::string olb::particles::io::strFormatVector ( VECTOR vector,
int strWidth = 13 )

Generic vector print method.

Definition at line 43 of file particleIoFunctions.h.

44{
45 const int dim=vector.getDim();
46 std::stringstream stream;
47 stream << "(";
48 for( int iDim=0; iDim<dim-1; ++iDim ){
49 stream << std::setw(strWidth) << vector[iDim] << ", ";
50 }
51 stream << std::setw(strWidth) << vector[dim-1] << ")";
52 return stream.str();
53}