19 #include <unordered_map>
81 void PrintOutput(
const std::string& rOutputFilename =
"");
86 std::string
Info()
const override
88 return " VtkOutput object ";
95 void PrintInfo(std::ostream& rOStream)
const override
97 rOStream <<
" VtkOutput object " << std::endl;
133 bool mShouldSwap =
false;
151 void PrepareGaussPointResults();
159 void WriteModelPartToFile(
const ModelPart& rModelPart,
const bool IsSubModelPart,
const std::string& rOutputFilename);
165 std::string GetOutputFileName(
const ModelPart& rModelPart,
const bool IsSubModelPart,
const std::string& rOutputFilename);
171 void Initialize(
const ModelPart& rModelPart);
177 void CreateMapFromKratosIdToVTKId(
const ModelPart& rModelPart);
184 void WriteHeaderToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream)
const;
191 void WriteMeshToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream)
const;
198 virtual void WriteNodesToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream)
const;
206 virtual void WriteConditionsAndElementsToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream)
const;
214 template<
typename TContainerType>
215 std::size_t DetermineVtkCellListSize(
const TContainerType& rContainer)
const;
223 template <
typename TContainerType>
224 void WriteConnectivity(
const TContainerType& rContainer, std::ofstream& rFileStream)
const;
232 template <
typename TContainerType>
233 void WriteCellType(
const TContainerType& rContainer, std::ofstream& rFileStream)
const;
239 bool IsCompatibleVariable(
const std::string& rVariableName)
const;
246 virtual void WriteNodalResultsToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream);
253 void WriteElementResultsToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream);
260 void WriteConditionResultsToFile(
const ModelPart& rModelPart, std::ofstream& rFileStream);
270 void WriteNodalContainerResults(
271 const std::string& rVariableName,
273 const bool IsHistoricalValue,
274 std::ofstream& rFileStream)
const;
283 template<
typename TContainerType>
284 void WriteGeometricalContainerResults(
const std::string& rVariableName,
285 const TContainerType& rContainer,
286 std::ofstream& rFileStream)
const;
295 template<
typename TContainerType>
296 void WriteGeometricalContainerIntegrationResults(
const std::string& rVariableName,
297 const TContainerType& rContainer,
298 std::ofstream& rFileStream)
const;
307 template<
class TVarType>
308 void WriteNodalScalarValues(
310 const TVarType& rVariable,
311 const bool IsHistoricalValue,
312 std::ofstream& rFileStream)
const;
321 template<
class TVarType>
322 void WriteNodalVectorValues(
324 const TVarType& rVariable,
325 const bool IsHistoricalValue,
326 std::ofstream& rFileStream)
const;
336 template<
typename TContainerType,
class TVarType>
337 void WriteScalarSolutionStepVariable(
338 const TContainerType& rContainer,
339 const TVarType& rVariable,
340 std::ofstream& rFileStream)
const;
350 template<
typename TContainerType,
class TVarType>
351 void WriteVectorSolutionStepVariable(
352 const TContainerType& rContainer,
353 const TVarType& rVariable,
354 std::ofstream& rFileStream)
const;
364 template<
typename TContainerType>
365 void WriteFlagContainerVariable(
366 const TContainerType& rContainer,
368 const std::string& rFlagName,
369 std::ofstream& rFileStream)
const;
379 template<
typename TContainerType,
class TVarType>
380 void WriteScalarContainerVariable(
381 const TContainerType& rContainer,
382 const TVarType& rVariable,
383 std::ofstream& rFileStream)
const;
393 template<
typename TContainerType,
class TVarType>
394 void WriteIntegrationScalarContainerVariable(
395 const TContainerType& rContainer,
397 std::ofstream& rFileStream)
const;
408 template<
typename TContainerType,
class TVarType>
409 void WriteVectorContainerVariable(
410 const TContainerType& rContainer,
411 const TVarType& rVariable,
412 std::ofstream& rFileStream)
const;
423 template<
typename TContainerType,
class TVarType>
424 void WriteIntegrationVectorContainerVariable(
425 const TContainerType& rContainer,
427 std::ofstream& rFileStream)
const;
435 template <
typename TData>
439 rFileStream << rData;
442 ForceBigEndian(
reinterpret_cast<unsigned char *
>(&
data));
443 rFileStream.write(
reinterpret_cast<char *
>(&
data),
sizeof(TData));
453 template <
typename TData>
457 for (
const auto& r_data_comp : rData) {
458 rFileStream << float(r_data_comp) <<
" ";
461 for (
const auto& r_data_comp : rData ) {
462 float data_comp_local = (float)r_data_comp;
463 ForceBigEndian(
reinterpret_cast<unsigned char *
>(&data_comp_local));
464 rFileStream.write(
reinterpret_cast<char *
>(&data_comp_local),
sizeof(
float));
474 void ForceBigEndian(
unsigned char* pBytes)
const;
491 GeometryType::Pointer ReorderConnectivity(GeometryType::Pointer& pGeometry)
const;
499 template<
typename TContainerType>
500 void WritePropertiesIdsToFile(
501 const TContainerType& rContainer,
502 std::ofstream& rFileStream)
const;
511 template<
typename TContainerType>
513 const TContainerType& rContainer,
514 const std::string& DataName,
515 std::ofstream& rFileStream)
const;
522 void WriteModelPartWithoutNodesToFile(
ModelPart& rModelPart,
const std::string& rOutputFilename);
Geometry base class.
Definition: geometry.h:71
IO provides different implementation of input output procedures which can be used to read and write w...
Definition: io.h:58
std::size_t SizeType
Definition: io.h:97
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
VtkOutput A simple class that has functionality to write vtk output.
Definition: vtk_output.h:35
EntityType
Definition: vtk_output.h:114
void WriteScalarDataToFile(const TData &rData, std::ofstream &rFileStream) const
Write the scalar value to the file provided, takes care of binary and ascii formats.
Definition: vtk_output.h:436
ModelPart & mrModelPart
Definition: vtk_output.h:127
std::unordered_map< int, int > mKratosIdToVtkId
The default precision.
Definition: vtk_output.h:132
IntegrationValuesExtrapolationToNodesProcess::UniquePointer mpGaussToNodesProcess
If the bytes need to be swapped (endianness)
Definition: vtk_output.h:136
VtkOutput::FileFormat mFileFormat
The main model part to post process.
Definition: vtk_output.h:128
unsigned int mDefaultPrecision
The configuration parameters.
Definition: vtk_output.h:131
virtual ~VtkOutput()=default
Destructor.
std::string Info() const override
Turn back information as a string.
Definition: vtk_output.h:86
void WriteVectorDataToFile(const TData &rData, std::ofstream &rFileStream) const
Write the vector values to the file provided, takes care of binary and ascii formats.
Definition: vtk_output.h:454
std::size_t IndexType
Definition of the index type.
Definition: vtk_output.h:42
Parameters mOutputSettings
The file format considered.
Definition: vtk_output.h:130
FileFormat
Definition: vtk_output.h:105
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: vtk_output.h:101
KRATOS_CLASS_POINTER_DEFINITION(VtkOutput)
Pointer definition of VtkOutput.
void PrintInfo(std::ostream &rOStream) const override
Prints information about the class.
Definition: vtk_output.h:95
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
data
Definition: mesh_to_mdpa_converter.py:59