IOSS 2.0
Loading...
Searching...
No Matches
Iocatalyst_BlockMesh.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020 National Technology & Engineering Solutions
2// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3// NTESS, the U.S. Government retains certain rights in this software.
4//
5// See packages/seacas/LICENSE for details
6
7#pragma once
8
9#include "iocatalyst_export.h"
10#include <array>
11#include <vector>
12
13namespace Iocatalyst {
14
15 class IOCATALYST_EXPORT BlockMesh
16 {
17 public:
18 struct Partition
19 {
20 int id;
21 int size;
22 };
23
24 struct Point
25 {
26 double x;
27 double y;
28 double z;
29 };
30
31 struct Extent
32 {
33 unsigned int i;
34 unsigned int j;
35 unsigned int k;
36 };
37
38 using BlockConn = std::array<int, 8>;
39 using IDList = std::vector<int>;
40 using ID = unsigned int;
41 static const unsigned int BLOCK_OFFSET = 0;
42 static const unsigned int POINT_OFFSET = 1;
43 static constexpr double BLOCK_LENGTH = 1.0;
44
45 static const unsigned int I_GLOBAL = 1000;
46 static const unsigned int J_GLOBAL = 1000;
47 static const unsigned int K_GLOBAL = 1000;
48
49 BlockMesh();
50 ~BlockMesh();
51
52 void init(const Partition &part, const Extent &numBlocks, const Extent &origin);
53
54 const Partition &getPartition() const { return partition; }
55
56 const Extent &getOrigin() const { return origin; }
57
58 const Extent &getExtents() const { return extents; }
59
60 const Extent &getPartitionExtents() const { return partitionExtents; }
61 const Extent &getPartitionStart() const { return partitionStart; }
62
63 ID getID() const;
64
65 bool isPartitionEmpty() const;
66
67 int getNumBlocks() const;
68 int getNumPartitionBlocks() const;
69 IDList getPartitionBlockIDs() const;
70 BlockConn getBlockConnectivityPointIDs(ID blockID) const;
71 static Extent getGlobalBlockExtents() { return {I_GLOBAL, J_GLOBAL, K_GLOBAL}; };
72 ID getGlobalIDForBlockID(ID blockID);
73
74 int getNumPoints() const;
75 int getNumPartitionPoints() const;
76 IDList getPartitionPointIDs() const;
77 ID getPointIDfromCoords(unsigned int i, unsigned int j, unsigned int k) const;
78 Point getPointCoordsForPointID(ID pointID) const;
79 static Extent getGlobalPointExtents() { return {I_GLOBAL + 1, J_GLOBAL + 1, K_GLOBAL + 1}; };
80 ID getGlobalIDForPointID(ID pointID);
81
82 static Extent getCoordsForID(ID id, Extent bounds);
83 static ID getIDfromCoords(Extent coords, Extent bounds);
84
85 void addTransientCellField(std::string f_name, double f_value);
86 void addTransientPointField(std::string f_name, double f_value);
87
88 std::map<std::string, double> *getTransientCellFieldMap();
89 std::map<std::string, double> *getTransientPointFieldMap();
90
91 private:
98 void splitBlock();
99 void fillExtents(int *ext);
100 void setPartitionFromExtents(int ext[6]);
101 void setPartitionEmpty();
102 IDList getPartitionIDs(unsigned int offset) const;
103 int getNumInPartition(unsigned int offset) const;
104 int getNumInBlockMesh(unsigned int offset) const;
106 static ID _id;
107
108 std::map<std::string, double> transientCellFields;
109 std::map<std::string, double> transientPointFields;
110 };
111
112} // namespace Iocatalyst
Definition Iocatalyst_BlockMesh.h:16
std::map< std::string, double > transientCellFields
Definition Iocatalyst_BlockMesh.h:108
const Extent & getPartitionStart() const
Definition Iocatalyst_BlockMesh.h:61
const Extent & getExtents() const
Definition Iocatalyst_BlockMesh.h:58
Partition partition
Definition Iocatalyst_BlockMesh.h:92
Extent partitionStart
Definition Iocatalyst_BlockMesh.h:96
static Extent getGlobalBlockExtents()
Definition Iocatalyst_BlockMesh.h:71
std::map< std::string, double > transientPointFields
Definition Iocatalyst_BlockMesh.h:109
Extent partitionExtents
Definition Iocatalyst_BlockMesh.h:95
unsigned int ID
Definition Iocatalyst_BlockMesh.h:40
std::vector< int > IDList
Definition Iocatalyst_BlockMesh.h:39
const Extent & getPartitionExtents() const
Definition Iocatalyst_BlockMesh.h:60
static Extent getGlobalPointExtents()
Definition Iocatalyst_BlockMesh.h:79
const Partition & getPartition() const
Definition Iocatalyst_BlockMesh.h:54
ID id
Definition Iocatalyst_BlockMesh.h:105
static ID _id
Definition Iocatalyst_BlockMesh.h:106
std::array< int, 8 > BlockConn
Definition Iocatalyst_BlockMesh.h:38
const Extent & getOrigin() const
Definition Iocatalyst_BlockMesh.h:56
Extent extents
Definition Iocatalyst_BlockMesh.h:94
Extent origin
Definition Iocatalyst_BlockMesh.h:93
Extent globalBlockExtents
Definition Iocatalyst_BlockMesh.h:97
A namespace for the Catalyst 2.0 database format.
Definition Iocatalyst_CatalystLogging.C:13
Definition Iocatalyst_BlockMesh.h:32
unsigned int j
Definition Iocatalyst_BlockMesh.h:34
unsigned int i
Definition Iocatalyst_BlockMesh.h:33
unsigned int k
Definition Iocatalyst_BlockMesh.h:35
Definition Iocatalyst_BlockMesh.h:19
int size
Definition Iocatalyst_BlockMesh.h:21
int id
Definition Iocatalyst_BlockMesh.h:20
Definition Iocatalyst_BlockMesh.h:25
double y
Definition Iocatalyst_BlockMesh.h:27
double z
Definition Iocatalyst_BlockMesh.h:28
double x
Definition Iocatalyst_BlockMesh.h:26