Skip to content

Commit 8156e50

Browse files
author
Monica Bugeanu (iMac)
committed
changed calls to uploadPoints to use Interpolation, vector3 is called Vector3, removed Vector*.cpp and added code to inline functions
1 parent 7e6b85b commit 8156e50

File tree

6 files changed

+58
-112
lines changed

6 files changed

+58
-112
lines changed

src/cavity/WaveletCavity.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void WaveletCavity::readCavity(const std::string & filename)
105105
uploadedDyadic = true;
106106
}
107107

108-
void WaveletCavity::uploadPoints(int quadLevel, Interpolation *interp)
108+
void WaveletCavity::uploadPoints(int quadLevel, Interpolation *interp, bool isPWL)
109109
{
110110
if (not uploadedDyadic) {
111111
throw std::runtime_error("Dyadic file must be uploaded first.");
@@ -118,7 +118,7 @@ void WaveletCavity::uploadPoints(int quadLevel, Interpolation *interp)
118118
Cubature *Q;
119119
initGaussSquare(&Q, quadLevel + 1);
120120

121-
nElements_ = nPatches * n * n * Q[quadLevel].nop;
121+
nElements_ = nPatches * n * n * Q[quadLevel].noP;
122122

123123
elementCenter_.resize(Eigen::NoChange, nElements_);
124124
elementNormal_.resize(Eigen::NoChange, nElements_);
@@ -130,14 +130,14 @@ void WaveletCavity::uploadPoints(int quadLevel, Interpolation *interp)
130130
s.y = h * i2;
131131
for (int i3=0; i3 < n; ++i3) {
132132
s.x = h * i3;
133-
for (size_t k = 0; k < Q[quadLevel].nop; k++) {
133+
for (size_t k = 0; k < Q[quadLevel].noP; k++) {
134134
t = vector2Add(s,vector2SMul(h,Q[quadLevel].xi[k]));
135135
point = interp->Chi(t,i1);
136136
norm = interp->n_Chi(t,i1);
137137
Eigen::Vector3d center(point.x, point.y, point.z);
138138
Eigen::Vector3d normal(norm.x, norm.y, norm.z);
139139
normal.normalize();
140-
double area = h * h * Q[quadLevel].w[k] * vector3Norm(norm);
140+
double area = h * h * Q[quadLevel].weight[k] * vector3Norm(norm);
141141
elementCenter_.col(j) = center.transpose();
142142
elementNormal_.col(j) = normal.transpose();
143143
elementArea_(j) = area;

src/cavity/WaveletCavity.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extern "C"
3939
}
4040

4141
#include "Vector3.hpp"
42+
#include "Interpolation.hpp"
4243

4344
#include "Cavity.hpp"
4445
#include "CavityData.hpp"
@@ -67,7 +68,7 @@ class WaveletCavity : public Cavity
6768
}
6869
virtual ~WaveletCavity() {};
6970
void readCavity(const std::string & filename);
70-
void uploadPoints(int quadLevel, vector3 **** T_, bool isPWL);
71+
void uploadPoints(int quadLevel, Interpolation *interp, bool isPWL);
7172
unsigned int getNPatches() { return nPatches; }
7273
unsigned int getNPatches() const { return nPatches; }
7374
unsigned int getNLevels() { return nLevels; }
@@ -86,8 +87,8 @@ class WaveletCavity : public Cavity
8687
double probeRadius;
8788
int patchLevel;
8889
double coarsity;
89-
void uploadPointsPWC(int quadLevel, vector3 **** T_);
90-
void uploadPointsPWL(int quadLevel, vector3 **** T_);
90+
void uploadPointsPWC(int quadLevel, Interpolation *interp);
91+
void uploadPointsPWL(int quadLevel, Interpolation *interp);
9192
std::vector<Eigen::Vector3d> nodePoint;
9293
std::vector<Eigen::Vector3i> nodeIndex;
9394
unsigned int nPatches;

src/utils/Vector2.cpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/utils/Vector2.hpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,32 @@ class Vector2
2020
};
2121

2222
// vector addition
23-
inline Vector2 vector2Add(Vector2 a, Vector2 b);
23+
inline Vector2 vector2Add(Vector2 a, Vector2 b)
24+
{
25+
return Vector2 (a.x+b.x, a.y+b.y);
26+
}
2427

2528
// vector subtration
26-
inline Vector2 vector2Sub(Vector2 a, Vector2 b);
29+
inline Vector2 vector2Sub(Vector2 a, Vector2 b)
30+
{
31+
return Vector2(a.x-b.x, a.y-b.y);
32+
}
2733

2834
// multiplication by scalar
29-
inline Vector2 vector2SMul(double a,Vector2 b);
35+
inline Vector2 vector2SMul(double a,Vector2 b)
36+
{
37+
return Vector2 (a*b.x, a*b.y);
38+
}
3039

3140
// scalar product
32-
inline double vector2Dot(Vector2 a,Vector2 b);
41+
inline double vector2Dot(Vector2 a,Vector2 b)
42+
{
43+
return(a.x*b.x + a.y*b.y);
44+
}
3345

3446
// euclidean norm
35-
inline double vector2Norm(Vector2 a);
47+
inline double vector2Norm(Vector2 a)
48+
{
49+
return(sqrt(a.x*a.x + a.y*a.y));
50+
}
3651
#endif

src/utils/Vector3.cpp

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/utils/Vector3.hpp

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,47 @@ class Vector3
1515

1616
Vector3 (double xi = 0.0, double yi = 0.0, double zi = 0.0) : x(xi), y(yi), z(zi) {}
1717
};
18-
1918
// vector addition
20-
inline Vector3 vector3Add(Vector3 a,Vector3 b);
19+
inline Vector3 vector3Add(Vector3 a,Vector3 b)
20+
{
21+
return Vector3(a.x+b.x, a.y+b.y, a.z+b.z);
22+
}
2123

2224
// vector in-place addition
23-
inline void vector3AddTo(Vector3* a,Vector3 b);
25+
inline void vector3AddTo(Vector3* a,Vector3 b)
26+
{
27+
a->x += b.x;
28+
a->y += b.y;
29+
a->z += b.z;
30+
}
2431

2532
// vector subtration
26-
inline Vector3 vector3Sub(Vector3 a,Vector3 b);
33+
inline Vector3 vector3Sub(Vector3 a,Vector3 b)
34+
{
35+
return Vector3(a.x-b.x, a.y-b.y, a.z-b.z);
36+
}
2737

2838
// cross product
29-
inline Vector3 vector3Mul(Vector3 a,Vector3 b);
39+
inline Vector3 vector3Mul(Vector3 a,Vector3 b)
40+
{
41+
return Vector3 (a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x);
42+
}
3043

3144
// multiplication by scalar
32-
inline Vector3 vector3SMul(double a,Vector3 b);
45+
inline Vector3 vector3SMul(double a,Vector3 b)
46+
{
47+
return Vector3(a*b.x, a*b.y, a*b.z);
48+
}
3349

3450
// scalar product
35-
inline double vector3Dot(Vector3 a,Vector3 b);
51+
inline double vector3Dot(Vector3 a,Vector3 b)
52+
{
53+
return(a.x*b.x + a.y*b.y + a.z*b.z);
54+
}
3655

3756
// euclidean norm
38-
inline double vector3Norm(Vector3 a);
39-
57+
inline double vector3Norm(Vector3 a)
58+
{
59+
return(sqrt(a.x*a.x + a.y*a.y + a.z*a.z));
60+
}
4061
#endif

0 commit comments

Comments
 (0)