21 #include <unordered_set>
87 const Flags Options = IO::READ | IO::IGNORE_VARIABLES_ERROR.AsFalse() | IO::SKIP_TIMER);
92 const Flags Options = IO::IGNORE_VARIABLES_ERROR.AsFalse() | IO::SKIP_TIMER);
119 bool ReadNode(
NodeType& rThisNode)
override;
131 std::size_t ReadNodesNumber()
override;
164 GeometryType::Pointer& pThisGeometry
199 Element::Pointer& pThisElement
256 void ReadInitialValues(
ModelPart& rThisModelPart)
override;
262 void ReadMesh(
MeshType & rThisMesh)
override;
280 void WriteModelPart(
ModelPart & rThisModelPart)
override;
301 void DivideInputToPartitions(
SizeType NumberOfPartitions,
316 void ReadSubModelPartElementsAndConditionsIds(
317 std::string
const& rModelPartName,
318 std::unordered_set<SizeType> &rElementsIds,
319 std::unordered_set<SizeType> &rConditionsIds)
override;
321 std::size_t ReadNodalGraphFromEntitiesList(
323 std::unordered_set<SizeType> &rElementsIds,
324 std::unordered_set<SizeType> &rConditionsIds)
override;
342 std::string
Info()
const override
344 return "ModelPartIO";
350 rOStream <<
"ModelPartIO";
432 std::string& ReadBlockName(std::string& rBlockName);
434 void SkipBlock(std::string
const& BlockName);
436 bool CheckEndBlock(std::string
const& BlockName, std::string& rWord);
438 void ReadModelPartDataBlock(
ModelPart& rModelPart,
const bool is_submodelpart=
false);
440 void WriteModelPartDataBlock(
ModelPart& rModelPart,
const bool is_submodelpart=
false);
442 template<
class TablesContainerType>
443 void ReadTableBlock(TablesContainerType& rTables);
447 template<
class TablesContainerType>
448 void WriteTableBlock(TablesContainerType& rTables);
454 void ReadNodesBlock(
ModelPart& rModelPart);
456 std::size_t CountNodesInBlock();
460 void ReadGeometriesBlock(
ModelPart& rModelPart);
462 void ReadGeometriesBlock(
NodesContainerType& rThisNodes, GeometryContainerType& rThisGeometries);
464 void ReadElementsBlock(
ModelPart& rModelPart);
469 void ReadConditionsBlock(
ModelPart& rModelPart);
474 void ReadNodalDataBlock(
ModelPart& rThisModelPart);
476 void WriteNodalDataBlock(
ModelPart& rThisModelPart);
478 template<
class TVariableType>
479 void ReadNodalDofVariableData(
NodesContainerType& rThisNodes,
const TVariableType& rVariable);
484 template<
class TVariableType>
485 void ReadNodalScalarVariableData(
NodesContainerType& rThisNodes,
const TVariableType& rVariable);
489 template<
class TVariableType,
class TDataType>
490 void ReadNodalVectorialVariableData(
NodesContainerType& rThisNodes,
const TVariableType& rVariable, TDataType Dummy);
493 template<
class TObjectsContainerType>
494 void WriteDataBlock(
const TObjectsContainerType& rThisObjectContainer,
const std::string& rObjectName);
495 template<
class TVariableType,
class TObjectsContainerType>
496 void WriteDataBlock(
const TObjectsContainerType& rThisObjectContainer,
const VariableData* rVariable,
const std::string& rObjectName);
498 template<
class TVariableType>
499 void ReadElementalScalarVariableData(
ElementsContainerType& rThisElements,
const TVariableType& rVariable);
502 template<
class TVariableType,
class TDataType>
503 void ReadElementalVectorialVariableData(
ElementsContainerType& rThisElements,
const TVariableType& rVariable, TDataType Dummy);
506 template<
class TVariableType>
507 void ReadConditionalScalarVariableData(
ConditionsContainerType& rThisConditions,
const TVariableType& rVariable);
510 template<
class TVariableType,
class TDataType>
511 void ReadConditionalVectorialVariableData(
ConditionsContainerType& rThisConditions,
const TVariableType& rVariable, TDataType Dummy);
513 SizeType ReadGeometriesConnectivitiesBlock(ConnectivitiesContainerType& rThisConnectivities);
515 SizeType ReadElementsConnectivitiesBlock(ConnectivitiesContainerType& rThisConnectivities);
517 SizeType ReadConditionsConnectivitiesBlock(ConnectivitiesContainerType& rThisConnectivities);
519 void FillNodalConnectivitiesFromGeometryBlock(ConnectivitiesContainerType& rNodalConnectivities);
521 void FillNodalConnectivitiesFromElementBlock(ConnectivitiesContainerType& rNodalConnectivities);
523 void FillNodalConnectivitiesFromConditionBlock(ConnectivitiesContainerType& rNodalConnectivities);
525 void FillNodalConnectivitiesFromGeometryBlockInList(
526 ConnectivitiesContainerType& rNodalConnectivities,
527 std::unordered_set<SizeType>& rGeometriesIds);
529 void FillNodalConnectivitiesFromElementBlockInList(
530 ConnectivitiesContainerType& rNodalConnectivities,
531 std::unordered_set<SizeType>& rElementsIds);
533 void FillNodalConnectivitiesFromConditionBlockInList(
534 ConnectivitiesContainerType& rNodalConnectivities,
535 std::unordered_set<SizeType>& rConditionsIds);
544 void ReadMeshBlock(
ModelPart& rModelPart);
546 void WriteMeshBlock(
ModelPart& rModelPart);
549 void ReadMeshDataBlock(
MeshType& rMesh);
562 void WriteSubModelPartBlock(
ModelPart& rMainModelPart,
const std::string& InitialTabulation);
564 void ReadSubModelPartDataBlock(
ModelPart& rModelPart);
566 void ReadSubModelPartTablesBlock(
ModelPart& rMainModelPart,
ModelPart& rSubModelPart);
568 void ReadSubModelPartPropertiesBlock(
ModelPart& rMainModelPart,
ModelPart& rSubModelPart);
572 void ReadSubModelPartElementsBlock(
ModelPart& rMainModelPart,
ModelPart& rSubModelPart);
574 void ReadSubModelPartConditionsBlock(
ModelPart& rMainModelPart,
ModelPart& rSubModelPart);
576 void ReadSubModelPartGeometriesBlock(
580 void DivideInputToPartitionsImpl(
581 OutputFilesContainerType& rOutputFiles,
583 const PartitioningInfo& rPartitioningInfo);
585 void DivideModelPartDataBlock(OutputFilesContainerType& OutputFiles);
587 void DivideTableBlock(OutputFilesContainerType& OutputFiles);
589 void DividePropertiesBlock(OutputFilesContainerType& OutputFiles);
591 void DivideNodesBlock(OutputFilesContainerType& OutputFiles,
592 PartitionIndicesContainerType
const& NodesAllPartitions);
594 void DivideGeometriesBlock(OutputFilesContainerType& OutputFiles,
595 PartitionIndicesContainerType
const& GeometriesAllPartitions);
597 void DivideElementsBlock(OutputFilesContainerType& OutputFiles,
598 PartitionIndicesContainerType
const& ElementsAllPartitions);
602 void DivideConditionsBlock(OutputFilesContainerType& OutputFiles,
603 PartitionIndicesContainerType
const& ConditionsAllPartitions);
606 void DivideNodalDataBlock(OutputFilesContainerType& OutputFiles,
607 PartitionIndicesContainerType
const& NodesAllPartitions);
609 void DivideFlagVariableData(OutputFilesContainerType& OutputFiles,
610 PartitionIndicesContainerType
const& NodesAllPartitions);
612 void DivideDofVariableData(OutputFilesContainerType& OutputFiles,
613 PartitionIndicesContainerType
const& NodesAllPartitions);
615 template<
class TValueType>
616 void DivideVectorialVariableData(OutputFilesContainerType& OutputFiles,
617 PartitionIndicesContainerType
const& EntitiesPartitions,
618 std::string BlockName);
621 void DivideElementalDataBlock(OutputFilesContainerType& OutputFiles,
622 PartitionIndicesContainerType
const& ElementsAllPartitions);
624 void DivideScalarVariableData(OutputFilesContainerType& OutputFiles,
625 PartitionIndicesContainerType
const& EntitiesPartitions,
626 std::string BlockName);
629 void DivideConditionalDataBlock(OutputFilesContainerType& OutputFiles,
630 PartitionIndicesContainerType
const& ConditionsAllPartitions);
633 void DivideMeshBlock(OutputFilesContainerType& OutputFiles,
634 PartitionIndicesContainerType
const& NodesAllPartitions,
635 PartitionIndicesContainerType
const& ElementsAllPartitions,
636 PartitionIndicesContainerType
const& ConditionsAllPartitions);
638 void DivideSubModelPartBlock(OutputFilesContainerType& OutputFiles,
639 PartitionIndicesContainerType
const& NodesAllPartitions,
640 PartitionIndicesContainerType
const& ElementsAllPartitions,
641 PartitionIndicesContainerType
const& ConditionsAllPartitions);
643 void DivideMeshDataBlock(OutputFilesContainerType& OutputFiles);
646 void DivideMeshNodesBlock(OutputFilesContainerType& OutputFiles,
647 PartitionIndicesContainerType
const& NodesAllPartitions);
650 void DivideMeshElementsBlock(OutputFilesContainerType& OutputFiles,
651 PartitionIndicesContainerType
const& ElementsAllPartitions);
653 void DivideMeshConditionsBlock(OutputFilesContainerType& OutputFiles,
654 PartitionIndicesContainerType
const& ConditionsAllPartitions);
657 void DivideSubModelPartDataBlock(OutputFilesContainerType& OutputFiles);
659 void DivideSubModelPartTableBlock(OutputFilesContainerType& OutputFiles);
662 void DivideSubModelPartNodesBlock(OutputFilesContainerType& OutputFiles,
663 PartitionIndicesContainerType
const& NodesAllPartitions);
666 void DivideSubModelPartElementsBlock(OutputFilesContainerType& OutputFiles,
667 PartitionIndicesContainerType
const& ElementsAllPartitions);
669 void DivideSubModelPartConditionsBlock(OutputFilesContainerType& OutputFiles,
670 PartitionIndicesContainerType
const& ConditionsAllPartitions);
672 void WritePartitionIndices(OutputFilesContainerType& OutputFiles, PartitionIndicesType
const& NodesPartitions, PartitionIndicesContainerType
const& NodesAllPartitions);
675 void WriteCommunicatorData(OutputFilesContainerType& OutputFiles,
SizeType NumberOfPartitions, GraphType
const& DomainsColoredGraph,
676 PartitionIndicesType
const& NodesPartitions,
677 PartitionIndicesType
const& ElementsPartitions,
678 PartitionIndicesType
const& ConditionsPartitions,
679 PartitionIndicesContainerType
const& NodesAllPartitions,
680 PartitionIndicesContainerType
const& ElementsAllPartitions,
681 PartitionIndicesContainerType
const& ConditionsAllPartitions);
683 void WriteCommunicatorLocalNodes(OutputFilesContainerType& OutputFiles,
SizeType NumberOfPartitions, PartitionIndicesType
const& NodesPartitions, PartitionIndicesContainerType
const& NodesAllPartitions);
685 void WriteInAllFiles(OutputFilesContainerType& OutputFiles, std::string
const& ThisWord);
688 template<
class TContainerType,
class TKeyType>
689 typename TContainerType::iterator FindKey(TContainerType& ThisContainer , TKeyType ThisKey, std::string ComponentName);
700 template<
class TValueType>
701 TValueType& ReadVectorialValue(TValueType& rValue);
703 template<
class TValueType>
704 TValueType& ExtractValue(std::string rWord, TValueType & rValue);
706 bool& ExtractValue(std::string rWord,
bool & rValue);
708 void ReadConstitutiveLawValue(ConstitutiveLaw::Pointer& rValue);
712 ModelPartIO& ReadBlock(std::string& Block, std::string
const& BlockName);
714 char SkipWhiteSpaces();
716 bool IsWhiteSpace(
char C);
720 bool CheckStatement(std::string
const& rStatement, std::string
const& rGivenWord);
730 void ScanNodeBlock();
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
IO provides different implementation of input output procedures which can be used to read and write w...
Definition: io.h:58
std::vector< std::vector< std::size_t > > ConnectivitiesContainerType
Definition: io.h:91
std::size_t SizeType
Definition: io.h:97
Definition: amatrix_interface.h:41
Mesh is the second level of abstraction in the data structure which hold Nodes, Elements and Conditio...
Definition: mesh.h:69
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
An IO class for reading and writing a modelpart.
Definition: model_part_io.h:56
std::size_t SizeType
Definition: model_part_io.h:75
KRATOS_CLASS_POINTER_DEFINITION(ModelPartIO)
Pointer definition of ModelPartIO.
BaseType::ConditionsContainerType ConditionsContainerType
Definition: model_part_io.h:71
BaseType::ConnectivitiesContainerType ConnectivitiesContainerType
Definition: model_part_io.h:72
BaseType::ElementsContainerType ElementsContainerType
Definition: model_part_io.h:70
std::vector< std::ostream * > OutputFilesContainerType
Definition: model_part_io.h:74
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: model_part_io.h:348
BaseType::MeshType MeshType
Definition: model_part_io.h:67
std::string Info() const override
Turn back information as a string.
Definition: model_part_io.h:342
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: model_part_io.h:354
BaseType::NodeType NodeType
Definition: model_part_io.h:66
IO BaseType
Definition: model_part_io.h:64
BaseType::NodesContainerType NodesContainerType
Definition: model_part_io.h:68
BaseType::PropertiesContainerType PropertiesContainerType
Definition: model_part_io.h:69
This class defines the node.
Definition: node.h:65
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
This class is the base of variables and variable's components which contains their common data.
Definition: variable_data.h:49
void ReadProperties(File &rFile, std::string const &rPrefix, PropertiesContainerType &rProperties)
Definition: hdf5_properties_io.cpp:15
string path
Definition: DEM_run_all_benchmarks_analysis.py:10
void WriteProperties(File &rFile, std::string const &rPrefix, PropertiesType const &rProperties)
Definition: hdf5_properties_io.cpp:37
void WriteMesh(GidIOType &dummy, GidIOType::MeshType &rThisMesh)
Definition: add_custom_io_to_python.cpp:74
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ModelPart::NodesContainerType NodesContainerType
Definition: find_conditions_neighbours_process.h:44
MeshType
Definition: traits.h:19
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: find_conditions_neighbours_process.h:45
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
@ WriteConditions
Definition: gid_io.h:53
ModelPart::ElementsContainerType ElementsContainerType
Definition: clear_contact_conditions_mesher_process.hpp:43
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
def ReadModelPart(model_part, inputfile)
Definition: read_modelpart_from_json.py:3