Merge pull request #54 from PhasicFlow/highResWalls

zResolution is added to cylinder
This commit is contained in:
PhasicFlow 2022-11-24 23:15:50 +03:30 committed by GitHub
commit 00572029a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 5 deletions

View File

@ -1,4 +1,5 @@
#include "cylinderWall.H"
#include "line.H"
bool pFlow::cylinderWall::readCylinderWall(const dictionary& dict)
@ -9,9 +10,29 @@ bool pFlow::cylinderWall::readCylinderWall(const dictionary& dict)
auto radius2 = dict.getVal<real>("radius2") ;
int32 resolution = dict.getValOrSet("resolution", 24 );
int32 zResolution = dict.getValOrSet("zResolution", 1);
return createCylinder(p1, p2, radius1, radius2, resolution);
triangles_.clear();
triangles_.reserve(2*resolution*zResolution);
line cylAxis(p1, p2);
auto lp1 = p1;
auto dt = static_cast<real>(1.0/zResolution);
real t = 0;
for(int32 i=0; i<zResolution; i++)
{
t += dt;
auto lp2 = cylAxis.point(t);
if(!createCylinder(lp1, lp2, radius1, radius2, resolution))
return false;
lp1 = lp2;
}
return true;
}
bool pFlow::cylinderWall::createCylinder(
@ -26,9 +47,6 @@ bool pFlow::cylinderWall::createCylinder(
real L = zAx.length();
// number of wall elements will be twice numDiv
triangles_.clear();
triangles_.reserve(2 * numDiv);
realx3Vector r1P(numDiv + 1), r2P(numDiv + 1);
real dTheta = 2 * Pi / numDiv;