-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathCollocatedNodes.hpp
More file actions
80 lines (68 loc) · 2.64 KB
/
CollocatedNodes.hpp
File metadata and controls
80 lines (68 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2024 TotalEnergies
* Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2023-2024 Chevron
* Copyright (c) 2019- GEOS/GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/
#ifndef GEOS_COLLOCATEDNODES_HPP
#define GEOS_COLLOCATEDNODES_HPP
#include "common/DataTypes.hpp"
#include <vtkDataSet.h>
#include <vtkIdTypeArray.h>
#include <vtkSmartPointer.h>
namespace geos::vtk
{
/**
* @brief Convenience wrapper around the raw vtk information.
*/
class CollocatedNodes
{
public:
/**
* @brief Build a convenience wrapper around the raw vtk collocated nodes information.
* @param faceBlockName The face block name.
* @param faceMesh The face mesh for which the collocated nodes structure will be fed.
* @param performGlobalCheck Whether to check across all MPI ranks if field is missing (default: true).
* Set to false when only calling on a subset of ranks.
*/
CollocatedNodes( string const & faceBlockName,
vtkSmartPointer< vtkDataSet > faceMesh,
bool performGlobalCheck = true );
/**
* @brief For node @p i of the face block, returns all the duplicated global node indices in the main 3d mesh.
* @param i the node in the face block (numbering is local to the face block).
* @return The list of global node indices in the main 3d mesh.
*/
stdVector< vtkIdType > const & operator[]( std::size_t i ) const
{
return m_collocatedNodes[i];
}
/**
* @brief Number of duplicated nodes buckets.
* Multiple nodes that are considered to be duplicated one of each other make one bucket.
* @return The number of duplicated nodes buckets.
*/
[[nodiscard]] std::size_t size() const
{
return m_collocatedNodes.size();
}
private:
/**
* @brief Populates the mapping.
* @param collocatedNodes The pointer to the vtk data array. Guaranteed not to be null.
* @details Converts the raw vtk data to STL containers.
*/
void init( vtkIdTypeArray const * collocatedNodes );
/// For each node of the face block, lists all the collocated nodes in the main 3d mesh.
stdVector< stdVector< vtkIdType > > m_collocatedNodes;
};
} // geos::vtk
#endif //GEOS_COLLOCATEDNODES_HPP