------------------------------------------------------------------------------
| 3901 | |
| 3902 | //------------------------------------------------------------------------------ |
| 3903 | void vtkExodusIIReaderPrivate::BuildSIL() |
| 3904 | { |
| 3905 | // Initialize the SIL, dump all previous information. |
| 3906 | this->SIL->Initialize(); |
| 3907 | if (this->Parser) |
| 3908 | { |
| 3909 | // The parser has built the SIL for us, |
| 3910 | // use that. |
| 3911 | this->SIL->ShallowCopy(this->Parser->GetSIL()); |
| 3912 | return; |
| 3913 | } |
| 3914 | |
| 3915 | // Else build a minimal SIL with only the blocks. |
| 3916 | vtkSmartPointer<vtkVariantArray> childEdge = vtkSmartPointer<vtkVariantArray>::New(); |
| 3917 | childEdge->InsertNextValue(0); |
| 3918 | |
| 3919 | vtkSmartPointer<vtkVariantArray> crossEdge = vtkSmartPointer<vtkVariantArray>::New(); |
| 3920 | crossEdge->InsertNextValue(0); |
| 3921 | |
| 3922 | // CrossEdge is an edge linking hierarchies. |
| 3923 | vtkUnsignedCharArray* crossEdgesArray = vtkUnsignedCharArray::New(); |
| 3924 | crossEdgesArray->SetName("CrossEdges"); |
| 3925 | this->SIL->GetEdgeData()->AddArray(crossEdgesArray); |
| 3926 | crossEdgesArray->Delete(); |
| 3927 | |
| 3928 | std::deque<std::string> names; |
| 3929 | int cc; |
| 3930 | |
| 3931 | // Now build the hierarchy. |
| 3932 | vtkIdType rootId = this->SIL->AddVertex(); |
| 3933 | names.emplace_back("SIL"); |
| 3934 | |
| 3935 | // Add the ELEM_BLOCK subtree. |
| 3936 | vtkIdType blocksRoot = this->SIL->AddChild(rootId, childEdge); |
| 3937 | names.emplace_back("Blocks"); |
| 3938 | |
| 3939 | // Add the assembly subtree |
| 3940 | this->SIL->AddChild(rootId, childEdge); |
| 3941 | names.emplace_back("Assemblies"); |
| 3942 | |
| 3943 | // Add the materials subtree |
| 3944 | this->SIL->AddChild(rootId, childEdge); |
| 3945 | names.emplace_back("Materials"); |
| 3946 | |
| 3947 | // This is the map of block names to node ids. |
| 3948 | std::map<std::string, vtkIdType> blockids; |
| 3949 | int numBlocks = this->GetNumberOfObjectsOfType(vtkExodusIIReader::ELEM_BLOCK); |
| 3950 | for (cc = 0; cc < numBlocks; cc++) |
| 3951 | { |
| 3952 | vtkIdType child = this->SIL->AddChild(blocksRoot, childEdge); |
| 3953 | std::string block_name = this->GetObjectName(vtkExodusIIReader::ELEM_BLOCK, cc); |
| 3954 | names.push_back(block_name); |
| 3955 | blockids[block_name] = child; |
| 3956 | } |
| 3957 | |
| 3958 | // This array is used to assign names to nodes. |
| 3959 | vtkStringArray* namesArray = vtkStringArray::New(); |
| 3960 | namesArray->SetName("Names"); |
no test coverage detected