------------------------------------------------------------------------------ Set contents from dictionary information read from the polyMesh/boundary file
| 5868 | //------------------------------------------------------------------------------ |
| 5869 | // Set contents from dictionary information read from the polyMesh/boundary file |
| 5870 | bool vtkFoamBoundaries::update(const vtkFoamDict& dict) |
| 5871 | { |
| 5872 | auto& patches = *this; |
| 5873 | patches.clearAll(); |
| 5874 | patches.resize(dict.size()); |
| 5875 | auto& inGroups = patches.groups; |
| 5876 | |
| 5877 | const auto nBoundaries = static_cast<vtkIdType>(patches.size()); |
| 5878 | |
| 5879 | vtkIdType endFace = -1; // for sanity check |
| 5880 | vtkTypeInt64 nBoundaryFaces = 0; |
| 5881 | |
| 5882 | for (vtkIdType patchi = 0; patchi < nBoundaries; ++patchi) |
| 5883 | { |
| 5884 | // The name/dictionary, from "polyMesh/boundary" entry |
| 5885 | const vtkFoamEntry* eptr = dict[patchi]; |
| 5886 | const std::string& patchName = eptr->GetKeyword(); |
| 5887 | const vtkFoamDict& patchDict = eptr->Dictionary(); |
| 5888 | |
| 5889 | // The patch entry to populate |
| 5890 | vtkFoamPatch& patch = patches[patchi]; |
| 5891 | patch.index_ = patchi; |
| 5892 | patch.offset_ = nBoundaryFaces; |
| 5893 | patch.type_ = vtkFoamPatch::GEOMETRICAL; |
| 5894 | patch.owner_ = true; // Patch owner (processor patch) |
| 5895 | |
| 5896 | patch.name_ = patchName; |
| 5897 | if ((eptr = patchDict.Lookup("type")) == nullptr) |
| 5898 | { |
| 5899 | this->error() // Report errors |
| 5900 | << "No 'type' entry found for patch: " << patch.name_; |
| 5901 | return false; |
| 5902 | } |
| 5903 | const std::string patchTypeName(eptr->ToString()); |
| 5904 | |
| 5905 | if ((eptr = patchDict.Lookup("startFace")) == nullptr) |
| 5906 | { |
| 5907 | this->error() // Report errors |
| 5908 | << "No 'startFace' entry found for patch: " << patch.name_; |
| 5909 | return false; |
| 5910 | } |
| 5911 | patch.start_ = eptr->ToInt(); |
| 5912 | |
| 5913 | if ((eptr = patchDict.Lookup("nFaces")) == nullptr) |
| 5914 | { |
| 5915 | this->error() // Report errors |
| 5916 | << "No 'nFaces' entry found for patch: " << patch.name_; |
| 5917 | return false; |
| 5918 | } |
| 5919 | patch.size_ = eptr->ToInt(); |
| 5920 | |
| 5921 | // Size, consistency sanity checks |
| 5922 | if (patch.start_ < 0 || patch.size_ < 0) |
| 5923 | { |
| 5924 | this->error() // Report errors |
| 5925 | << "The startFace:" << patch.start_ << " or nFaces:" << patch.size_ |
| 5926 | << " are negative for patch " << patch.name_; |
| 5927 | return false; |