MCPcopy Create free account
hub / github.com/KratosMultiphysics/Kratos / StoreData

Method StoreData

kratos/tensor_adaptors/flags_tensor_adaptor.cpp:113–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void FlagsTensorAdaptor::StoreData()
114{
115 std::visit([this](auto pContainer) {
116 using container_type = BareType<decltype(*pContainer)>;
117
118 if constexpr(IsInList<container_type, ModelPart::NodesContainerType, ModelPart::ConditionsContainerType, ModelPart::ElementsContainerType>) {
119 KRATOS_ERROR_IF_NOT(this->Size() == pContainer->size())
120 << "Size mismatch [ Container size = " << pContainer->size()
121 << ", data span size = " << this->Size() << " ].\n";
122
123 auto span_itr = this->ViewData().data();
124
125 IndexPartition<IndexType>(pContainer->size()).for_each([this, span_itr, pContainer](const auto Index) {
126 const int value = *(span_itr + Index);
127 auto& r_entity = *(pContainer->begin() + Index);
128 switch (value) {
129 case 0:
130 case 1:
131 r_entity.Set(this->mFlags, value);
132 break;
133 case -1:
134 r_entity.Reset(this->mFlags);
135 break;
136 default:
137 KRATOS_ERROR << "Invalid flag status = " << value << " for " << ModelPart::Container<container_type>::GetEntityName()
138 << " with id " << r_entity.Id() << ". Flag tensor adaptor's internal storage should only have following values:"
139 << "\n\t -1 - The corresponding flag is not defined."
140 << "\n\t 0 - The corresponding flag is defined and false."
141 << "\n\t 1 - The corresponding flag is defined and true.";
142 break;
143 }
144 });
145 }
146 }, this->GetContainer());
147}
148
149std::string FlagsTensorAdaptor::Info() const
150{

Callers 1

Calls 11

GetEntityNameFunction · 0.85
SizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
ViewDataMethod · 0.45
for_eachMethod · 0.45
beginMethod · 0.45
SetMethod · 0.45
ResetMethod · 0.45
IdMethod · 0.45
GetContainerMethod · 0.45

Tested by 1