-
Notifications
You must be signed in to change notification settings - Fork 0
/
DgIDGGS4T.cpp
155 lines (130 loc) · 4.66 KB
/
DgIDGGS4T.cpp
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
////////////////////////////////////////////////////////////////////////////////
//
// DgIDGGS4T.cpp: DgIDGGS4T class implementation
//
// Version 6.1 - Kevin Sahr, 5/23/13
//
////////////////////////////////////////////////////////////////////////////////
#include <cmath>
#include <cstdint>
#include "DgContCartRF.h"
#include "DgDiscRF.h"
#include "DgIDGGS4T.h"
#include "DgTriGrid2D.h"
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
DgIDGGS4T::DgIDGGS4T (const DgIDGGS4T& rf)
: DgIDGGS (rf)
{
report("DgIDGGS4T::operator=() not implemented yet", DgBase::Fatal);
} // DgIDGGS4T::DgIDGGS4T
////////////////////////////////////////////////////////////////////////////////
DgIDGGS4T::~DgIDGGS4T (void)
{
for (unsigned int i = 0; i < grids().size(); i++)
delete (*grids_)[i];
delete grids_;
} // DgIDGGS4T::~DgIDGGS4T
////////////////////////////////////////////////////////////////////////////////
DgIDGGS4T&
DgIDGGS4T::operator= (const DgIDGGS4T& rf)
{
report("DgIDGGS4T::operator=() not implemented", DgBase::Fatal);
return *this;
} // DgIDGGS4T& DgIDGGS4T::operator=
////////////////////////////////////////////////////////////////////////////////
void
DgIDGGS4T::setAddParents (const DgResAdd<DgQ2DICoord>& add,
DgLocVector& vec) const
{
//cout << " setAddParents: " << add << endl;
if (isCongruent())
{
DgLocation* tmpLoc = makeLocation(add);
grids()[add.res() - 1]->convert(tmpLoc);
convert(tmpLoc);
vec.push_back(*tmpLoc);
delete tmpLoc;
}
else
{
report("DgIDGGS4T::DgIDGGS4T() only congruent triangle grid "
"systems implemented", DgBase::Fatal);
}
} // void DgIDGGS4T::setAddParents
////////////////////////////////////////////////////////////////////////////////
void
DgIDGGS4T::setAddInteriorChildren (const DgResAdd<DgQ2DICoord>& add,
DgLocVector& vec) const
{
if (isCongruent())
{
//cout << "Children: " << add << " " << lowerLeft << endl;
vector<DgAddressBase*>& v = vec.addressVec();
if (DgTriGrid2D::isUp(add.address().coord()))
{
const DgIVec2D lowerLeft((add.address().coord().i() * radix()),
(add.address().coord().j() * radix()));
std::int64_t maxJ = 0;
for (int i = 0; i < radix(); i++)
{
for (std::int64_t j = 0; j <= maxJ; j++)
{
v.push_back(new DgAddress< DgResAdd<DgQ2DICoord> >(
DgResAdd<DgQ2DICoord>(DgQ2DICoord(add.address().quadNum(),
DgIVec2D(lowerLeft.i() + i, lowerLeft.j() + j)),
add.res() + 1)));
}
maxJ += 2;
}
}
else // down pointing
{
const DgIVec2D upperRight(
(add.address().coord().i() * radix() + radix() - 1),
(add.address().coord().j() * radix() + radix() - 1));
std::int64_t maxJ = 0;
for (int i = 0; i < radix(); i++)
{
for (std::int64_t j = 0; j <= maxJ; j++)
{
v.push_back(new DgAddress< DgResAdd<DgQ2DICoord> >(
DgResAdd<DgQ2DICoord>(DgQ2DICoord(add.address().quadNum(),
DgIVec2D(upperRight.i() - i, upperRight.j() - j)),
add.res() + 1)));
}
maxJ += 2;
}
}
}
else
{
report("DgIDGGS4T::DgIDGGS4T() only congruent triangle grid "
"systems implemented", DgBase::Fatal);
}
//cout << vec << endl;
} // void DgIDGGS4T::setAddInteriorChildren
////////////////////////////////////////////////////////////////////////////////
void
DgIDGGS4T::setAddBoundaryChildren (const DgResAdd<DgQ2DICoord>& add,
DgLocVector& vec) const
{
if (isCongruent())
{
// no boundary children in this topology; leave vec empty
}
else
{
report("DgIDGGS4T::DgIDGGS4T() only congruent triangle grid "
"systems implemented", DgBase::Fatal);
}
} // void DgIDGGS4T::setAddBoundaryChildren
////////////////////////////////////////////////////////////////////////////////
void
DgIDGGS4T::setAddAllChildren (const DgResAdd<DgQ2DICoord>& add,
DgLocVector& vec) const
{
setAddInteriorChildren(add, vec);
} // void DgIDGGS4T::setAddAllChildren
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////