VTK-m  2.0
InteriorForest.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 // Copyright (c) 2018, The Regents of the University of California, through
11 // Lawrence Berkeley National Laboratory (subject to receipt of any required approvals
12 // from the U.S. Dept. of Energy). All rights reserved.
13 //
14 // Redistribution and use in source and binary forms, with or without modification,
15 // are permitted provided that the following conditions are met:
16 //
17 // (1) Redistributions of source code must retain the above copyright notice, this
18 // list of conditions and the following disclaimer.
19 //
20 // (2) Redistributions in binary form must reproduce the above copyright notice,
21 // this list of conditions and the following disclaimer in the documentation
22 // and/or other materials provided with the distribution.
23 //
24 // (3) Neither the name of the University of California, Lawrence Berkeley National
25 // Laboratory, U.S. Dept. of Energy nor the names of its contributors may be
26 // used to endorse or promote products derived from this software without
27 // specific prior written permission.
28 //
29 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32 // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38 // OF THE POSSIBILITY OF SUCH DAMAGE.
39 //
40 //================================================================================
41 //
42 // Parallel Peak Pruning v. 2.0
43 //
44 // Started June 15, 2017
45 //
46 // Copyright Hamish Carr, University of Leeds
47 //
48 // TreeResidue.h - A data structure storing the residue information for transfer
49 // to the grafting phase
50 //
51 //================================================================================
52 //
53 // COMMENTS:
54 //
55 //
56 //================================================================================
57 
58 
59 #ifndef vtk_m_worklet_contourtree_distributed_interior_forest_h
60 #define vtk_m_worklet_contourtree_distributed_interior_forest_h
61 
62 #include <vtkm/Types.h>
65 
66 #include <sstream>
67 #include <string>
68 #include <utility>
69 
70 namespace vtkm
71 {
72 namespace worklet
73 {
74 namespace contourtree_distributed
75 {
76 
85 { // class InteriorForest
86 public:
87  // array of vertices in the bract (by mesh index)
89 
90  // array of flags for whether necessary (i.e. needed in the BRACT)
92 
93  // arrays of nodes above and below supernodes for hierarchical search
94  // stored as global IDs
97 
98  // constructor
100 
101  // prints the contents of the object in a standard format
102  void PrintContent(std::ostream& outStream) const;
103  std::string DebugPrint(const char* message, const char* fileName, long lineNum) const;
104  inline std::string PrintArraySizes() const;
105 };
106 
107 
108 // debug routine
109 inline void InteriorForest::PrintContent(std::ostream& outStream) const
110 {
111  // Per Supernode Arrays
113  outStream);
115  "IsNecessary", this->IsNecessary, -1, outStream);
116  vtkm::worklet::contourtree_augmented::PrintIndices("Above", this->Above, -1, outStream);
117  vtkm::worklet::contourtree_augmented::PrintIndices("Below", this->Below, -1, outStream);
118 
119  // BRACT Sized Arrays
121  this->BoundaryTreeMeshIndices.GetNumberOfValues(), outStream);
123  "BRACT Mesh Indices", this->BoundaryTreeMeshIndices, -1, outStream);
124 }
125 
126 inline std::string InteriorForest::DebugPrint(const char* message,
127  const char* fileName,
128  long lineNum) const
129 { // DebugPrint
130  std::stringstream resultStream;
131  resultStream << "[CUTHERE]---------------------------------------------" << std::endl;
132  resultStream << std::setw(30) << std::left << fileName << ":" << std::right << std::setw(4)
133  << lineNum << " ";
134  resultStream << std::left << std::string(message) << std::endl;
135 
136  resultStream << "------------------------------------------------------" << std::endl;
137  resultStream << "Residue Contains: " << std::endl;
138  resultStream << "------------------------------------------------------" << std::endl;
139 
140  this->PrintContent(resultStream);
141 
142  resultStream << "------------------------------------------------------" << std::endl;
143  resultStream << std::endl;
144  return resultStream.str();
145 } // DebugPrint
146 
147 inline std::string InteriorForest::PrintArraySizes() const
148 { // PrintArraySizes
149  std::stringstream arraySizeLog;
150  arraySizeLog << std::setw(42) << std::left << " #BoundaryTreeMeshIndices"
151  << ": " << this->BoundaryTreeMeshIndices.GetNumberOfValues() << std::endl
152  << std::setw(42) << std::left << " #IsNecessary"
153  << ": " << this->IsNecessary.GetNumberOfValues() << std::endl
154  << std::setw(42) << std::left << " #Above"
155  << ": " << this->Above.GetNumberOfValues() << std::endl
156  << std::setw(42) << std::left << " #Below"
157  << ": " << this->Below.GetNumberOfValues() << std::endl;
158  return arraySizeLog.str();
159 } // PrintArraySizes
160 
161 } // namespace contourtree_distributed
162 } // namespace worklet
163 } // namespace vtkm
164 
165 #endif
vtkm::worklet::contourtree_distributed::InteriorForest::Below
vtkm::worklet::contourtree_augmented::IdArrayType Below
Definition: InteriorForest.h:96
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::cont::ArrayHandle< vtkm::Id >
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
Types.h
vtkm::worklet::contourtree_distributed::InteriorForest::InteriorForest
InteriorForest()
Definition: InteriorForest.h:99
vtkm::worklet::contourtree_distributed::InteriorForest
The contour tree of a data block restricted to the interior of a data block.
Definition: InteriorForest.h:84
vtkm::worklet::contourtree_distributed::InteriorForest::BoundaryTreeMeshIndices
vtkm::worklet::contourtree_augmented::IdArrayType BoundaryTreeMeshIndices
Definition: InteriorForest.h:88
PrintVectors.h
vtkm::worklet::contourtree_distributed::InteriorForest::Above
vtkm::worklet::contourtree_augmented::IdArrayType Above
Definition: InteriorForest.h:95
vtkm::worklet::contourtree_distributed::InteriorForest::IsNecessary
vtkm::worklet::contourtree_augmented::IdArrayType IsNecessary
Definition: InteriorForest.h:91
vtkm::worklet::contourtree_distributed::InteriorForest::PrintContent
void PrintContent(std::ostream &outStream) const
Definition: InteriorForest.h:109
vtkm::worklet::contourtree_distributed::InteriorForest::DebugPrint
std::string DebugPrint(const char *message, const char *fileName, long lineNum) const
Definition: InteriorForest.h:126
Types.h
vtkm::worklet::contourtree_augmented::PrintIndices
void PrintIndices(std::string label, const vtkm::cont::ArrayHandle< T > &iVec, vtkm::Id nIndices=-1, std::ostream &outStream=std::cout)
Definition: augmented/PrintVectors.h:253
vtkm::worklet::contourtree_augmented::PrintHeader
void PrintHeader(vtkm::Id howMany, std::ostream &outStream=std::cout)
Definition: augmented/PrintVectors.h:151
vtkm::worklet::contourtree_distributed::InteriorForest::PrintArraySizes
std::string PrintArraySizes() const
Definition: InteriorForest.h:147