mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
runtime dynamic link library and geometryPhasicFlow modification
This commit is contained in:
@ -0,0 +1,120 @@
|
||||
#include "cylinderWall.hpp"
|
||||
#include "Vectors.hpp"
|
||||
#include "line.hpp"
|
||||
|
||||
|
||||
bool pFlow::cylinderWall::readCylinderWall(const dictionary& dict)
|
||||
{
|
||||
auto p1 = dict.getVal<realx3>("p1");
|
||||
auto p2 = dict.getVal<realx3>("p2");
|
||||
auto radius1 = dict.getVal<real>("radius1");
|
||||
auto radius2 = dict.getVal<real>("radius2") ;
|
||||
|
||||
int32 resolution = dict.getValOrSet("resolution", 24 );
|
||||
int32 zResolution = dict.getValOrSet("zResolution", 1);
|
||||
|
||||
|
||||
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(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
real rad1,
|
||||
real rad2,
|
||||
int32 numDiv)
|
||||
{
|
||||
|
||||
zAxis zAx(p1, p2);
|
||||
|
||||
real L = zAx.length();
|
||||
|
||||
|
||||
realx3Vector r1P(numDiv + 1), r2P(numDiv + 1);
|
||||
real dTheta = 2 * Pi / numDiv;
|
||||
real theta = 0;
|
||||
|
||||
for (int32 i = 0; i < numDiv + 1; i++)
|
||||
{
|
||||
r1P[i] = realx3(rad1*cos(theta), rad1*sin(theta), 0);
|
||||
r2P[i] = realx3(rad2*cos(theta), rad2*sin(theta), L);
|
||||
theta += dTheta;
|
||||
}
|
||||
|
||||
// transferring back all points to the original axis of cylinder
|
||||
for (int32 i = 0; i < numDiv + 1; i++)
|
||||
{
|
||||
r1P[i] = zAx.transferBackZ(r1P[i]);
|
||||
r2P[i] = zAx.transferBackZ(r2P[i]);
|
||||
}
|
||||
|
||||
realx3 norm;
|
||||
for (int32 i = 0; i < numDiv; i++)
|
||||
{
|
||||
realx3 p1 = r1P[i];
|
||||
realx3 p2 = r2P[i];
|
||||
realx3 p3 = r2P[i + 1];
|
||||
realx3 p4 = r1P[i + 1];
|
||||
|
||||
if(checkNormalVec(p1, p2, p3, norm))
|
||||
{
|
||||
triangles_.push_back(realx3x3(p1, p2, p3));
|
||||
}
|
||||
else
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"planner input triangle: "<<realx3x3(p1, p2, p3)<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkNormalVec(p3, p4, p1, norm))
|
||||
{
|
||||
triangles_.push_back(realx3x3(p3, p4, p1));
|
||||
}
|
||||
else
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"planner input triangle: "<<realx3x3(p3, p4, p1)<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
pFlow::cylinderWall::cylinderWall()
|
||||
{}
|
||||
|
||||
|
||||
pFlow::cylinderWall::cylinderWall(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Wall(dict)
|
||||
{
|
||||
if( !readCylinderWall(dict) )
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*------------------------------- phasicFlow ---------------------------------
|
||||
O C enter of
|
||||
O O E ngineering and
|
||||
O O M ultiscale modeling of
|
||||
OOOOOOO F luid flow
|
||||
------------------------------------------------------------------------------
|
||||
Copyright (C): www.cemf.ir
|
||||
email: hamid.r.norouzi AT gmail.com
|
||||
------------------------------------------------------------------------------
|
||||
Licence:
|
||||
This file is part of phasicFlow code. It is a free software for simulating
|
||||
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||
the terms of GNU General Public License v3 or any other later versions.
|
||||
|
||||
phasicFlow is distributed to help others in their research in the field of
|
||||
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef __cylinderWall_hpp__
|
||||
#define __cylinderWall_hpp__
|
||||
|
||||
#include "Wall.hpp"
|
||||
#include "zAxis.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class cylinderWall
|
||||
:
|
||||
public Wall
|
||||
{
|
||||
protected:
|
||||
|
||||
bool readCylinderWall(const dictionary& dict);
|
||||
|
||||
bool createCylinder(const realx3& p1, const realx3& p2, real rad1, real rad2, int32 numDiv);
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("cylinderWall");
|
||||
|
||||
cylinderWall();
|
||||
|
||||
cylinderWall(const dictionary& dict);
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
Wall,
|
||||
cylinderWall,
|
||||
dictionary
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //__cylinderWall_hpp__
|
Reference in New Issue
Block a user