13 #ifndef KRATOS_STATISTICS_DATA_H_INCLUDED
14 #define KRATOS_STATISTICS_DATA_H_INCLUDED
91 mData.
resize(number_of_integration_points, MeasurementSize,
false);
92 mData =
ZeroMatrix(number_of_integration_points, MeasurementSize);
107 const std::size_t NumMeasurements)
110 <<
"Trying to update statistics, but providied number of recorded steps is zero" << std::endl;
118 for (
unsigned int g = 0; g < shape_functions.size1(); g++)
120 auto N =
row(shape_functions, g);
121 auto &rDN_DN = shape_gradients[g];
123 auto it_update_buffer = rUpdate.
begin();
124 for (
auto it_sampler = rStatisticsSamplers.
begin(); it_sampler != rStatisticsSamplers.
end(); ++it_sampler)
126 it_sampler->SampleDataPoint(r_geometry,
N, rDN_DN, it_update_buffer);
129 if (NumMeasurements > 1) {
131 for (
auto it_statistic = rHigherOrderStatistics.
begin(); it_statistic != rHigherOrderStatistics.
end(); ++it_statistic)
133 it_statistic->SampleDataPoint(it_update_buffer,
IntegrationPointData(g), rUpdate, NumMeasurements);
137 for (
unsigned int i = 0;
i < rUpdate.size();
i++)
139 mData(g,
i) += rUpdate[
i];
153 std::ofstream& rOutputStream,
157 const std::size_t NumberOfMeasurements,
158 const std::string& rSeparator)
const
166 for (
unsigned int g = 0; g < shape_functions.size1(); g++)
169 rOutputStream << rElement.
Id() << rSeparator << g << rSeparator;
173 for (
unsigned int n = 0;
n < shape_functions.size2();
n++)
174 coordinates += shape_functions(g,
n) * r_geometry[
n].Coordinates();
175 rOutputStream << coordinates[0] << rSeparator << coordinates[1] << rSeparator << coordinates[2];
178 for (
auto it_sampler = rRecordedStatistics.
begin(); it_sampler != rRecordedStatistics.
end(); ++it_sampler)
180 it_sampler->OutputResult(rOutputStream,data_iterator,NumberOfMeasurements,rSeparator);
183 for (
auto it_sampler = rHigherOrderStatistics.
begin(); it_sampler != rHigherOrderStatistics.
end(); ++it_sampler)
185 it_sampler->OutputResult(rOutputStream,data_iterator,NumberOfMeasurements,rSeparator);
188 rOutputStream <<
"\n";
199 return mData.size1();
208 return mData.size2();
221 <<
"Asking for integration point number " << IntegrationPointIndex
222 <<
" but only " << mData.size1() <<
" points are recorded." << std::endl;
223 return (mData.begin1() + IntegrationPointIndex);
232 <<
"Asking for integration point number " << IntegrationPointIndex
233 <<
" but only " << mData.size1() <<
" points are recorded." << std::endl;
234 return (mData.begin1() + IntegrationPointIndex);
242 virtual std::string
Info()
const
244 std::stringstream buffer;
245 buffer <<
"StatisticsData";
250 virtual void PrintInfo(std::ostream &rOStream)
const { rOStream <<
"StatisticsData"; }
268 const unsigned int number_of_nodes = rGeometry.
PointsNumber();
274 rN.
resize(number_of_gauss_points,number_of_nodes,
false);
317 rOStream << std::endl;
Base class for all Elements.
Definition: element.h:60
virtual IntegrationMethod GetIntegrationMethod() const
Definition: element.h:285
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
const Matrix & ShapeFunctionsValues() const
Definition: geometry.h:3393
void ShapeFunctionsIntegrationPointsGradients(ShapeFunctionsGradientsType &rResult) const
Definition: geometry.h:3708
SizeType IntegrationPointsNumber() const
Definition: geometry.h:2257
IndexType Id() const
Definition: indexed_object.h:107
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
iterator begin()
Definition: amatrix_interface.h:241
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
iterator end()
Definition: pointer_vector.h:177
iterator begin()
Definition: pointer_vector.h:169
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Internal container for integration point statistitcs on a given element.
Definition: statistics_data.h:39
StatisticsData(StatisticsData const &rOther)
Copy constructor.
Definition: statistics_data.h:60
void WriteToCSVOutput(std::ofstream &rOutputStream, const Element &rElement, const PointerVector< StatisticsSampler > &rRecordedStatistics, const PointerVector< StatisticsSampler > &rHigherOrderStatistics, const std::size_t NumberOfMeasurements, const std::string &rSeparator) const
Write computed statistics to output file.
Definition: statistics_data.h:152
virtual std::string Info() const
Turn back information as a string.
Definition: statistics_data.h:242
std::size_t NumberOfIntegrationPoints() const
How many integration points this container holds data for.
Definition: statistics_data.h:197
StatisticsData & operator=(StatisticsData const &rOther)
Assignment operator.
Definition: statistics_data.h:72
void CalculateGeometryData(const Geometry< Node > &rGeometry, const GeometryData::IntegrationMethod IntegrationMethod, Matrix &rN, typename Geometry< Node >::ShapeFunctionsGradientsType &rDN_DX) const
Definition: statistics_data.h:262
IntegrationPointDataConstView IntegrationPointData(std::size_t IntegrationPointIndex) const
Access internal data for a given integration point.
Definition: statistics_data.h:229
StatisticsData()
Default constructor.
Definition: statistics_data.h:57
IntegrationPointDataView IntegrationPointData(std::size_t IntegrationPointIndex)
Access internal data for a given integration point.
Definition: statistics_data.h:218
Matrix::const_iterator1 IntegrationPointDataConstView
Definition: statistics_data.h:50
Matrix::iterator1 IntegrationPointDataView
Definition: statistics_data.h:49
KRATOS_CLASS_POINTER_DEFINITION(StatisticsData)
Pointer definition of StatisticsData.
std::vector< double > ValueContainerType
Definition: statistics_data.h:47
void InitializeStorage(Element &rElement, std::size_t MeasurementSize)
Initialize internal storage for this container.
Definition: statistics_data.h:86
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: statistics_data.h:253
virtual ~StatisticsData()
Destructor.
Definition: statistics_data.h:65
std::size_t NumberOfStatisticalQuantities() const
How many quantities this container holds data for.
Definition: statistics_data.h:206
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: statistics_data.h:250
void UpdateMeasurement(const Element &rElement, const PointerVector< StatisticsSampler > &rStatisticsSamplers, const PointerVector< StatisticsSampler > &rHigherOrderStatistics, ValueContainerType &rUpdate, const std::size_t NumMeasurements)
Record a new realization for the measured statistics.
Definition: statistics_data.h:102
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
N
Definition: sensitivityMatrix.py:29
det_J
Definition: sensitivityMatrix.py:67
integer i
Definition: TensorModule.f:17