Merge pull request #65 from PhasicFlow/vibratingWall

bug fix for precision write to file and solid name in stl file
This commit is contained in:
PhasicFlow 2023-01-18 12:21:07 +03:30 committed by GitHub
commit e895e689be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 78 additions and 11 deletions

View File

@ -230,6 +230,7 @@ public:
auto stress = stressWall_.deviceVectorAll();
auto numTri =triSurface_.size();
Kokkos::parallel_for(
"geometry::calculateStress",
numTri,

View File

@ -31,7 +31,15 @@ pFlow::uniquePtr<pFlow::iFstream> pFlow::IOfileHeader::inStream()const
pFlow::uniquePtr<pFlow::oFstream> pFlow::IOfileHeader::outStream()const
{
return makeUnique<oFstream>(path());
auto osPtr = makeUnique<oFstream>(path());
if(osPtr && owner_)
{
auto outPrecision = owner_->outFilePrecision();
osPtr->precision(outPrecision);
}
return osPtr;
}
pFlow::IOfileHeader::IOfileHeader

View File

@ -179,6 +179,18 @@ public:
// - return number of repositories
size_t numRepositories()const;
virtual
size_t outFilePrecision() const
{
if(owner_)
{
return owner_->outFilePrecision();
}else
{
return 6;
}
}
// - return a ref to the underlaying data in the object
template<typename T>
T& lookupObject(const word& name);

View File

@ -135,6 +135,9 @@ pFlow::systemControl::systemControl
true
)
),
outFilePrecision_(
settingsDict_.getValOrSet("outFilePrecision", static_cast<size_t>(6))
),
Time_
(
this,

View File

@ -58,6 +58,9 @@ protected:
// - settingsDict fileDictionary
dictionary& settingsDict_;
// - precision for writing to file
size_t outFilePrecision_ = 6;
// - time repository
Time Time_;
@ -178,6 +181,11 @@ public:
Time_.setSaveTimeFolder(saveToFile, timeName);
}
size_t outFilePrecision() const override
{
return outFilePrecision_;
}
};

View File

@ -101,6 +101,7 @@ bool pFlow::multiTriSurface::addTriSurface
const auto& newPoints = tSurf.points();
const auto& newVertices = tSurf.vertices();
const auto& newAreas = tSurf.area();
//
@ -112,8 +113,14 @@ bool pFlow::multiTriSurface::addTriSurface
auto vOldSize = vertices_.size();
auto vNewSize = vOldSize + newVertices.size();
vertices_.resize(vNewSize);
area_.resize(vNewSize);
auto verVec = vertices_.deviceVectorAll();
auto areaVec = area_.deviceVectorAll();
auto newVerVec = newVertices.deviceVectorAll();
auto newArea = newAreas.deviceVectorAll();
auto maxIdx = maxIndex();
Kokkos::parallel_for(
@ -121,6 +128,7 @@ bool pFlow::multiTriSurface::addTriSurface
newVertices.size(),
LAMBDA_HD(int32 i){
verVec[vOldSize+i] = newVerVec[i]+(maxIdx+1);
areaVec[vOldSize+i] = newArea[i];
}
);
Kokkos::fence();

View File

@ -61,19 +61,46 @@ bool pFlow::stlFile::readSolid
if(!checkWordToken(is, tok, "solid")) return false;
// check if there is a name associated with solid
is >> tok;
if( badInput(is, tok) ) return false;
if(!tok.isWord()) return false;
name = "";
if(tok.wordToken() != "facet" )
int32 nWords =0;
bool reachedFacet = false;
is >> tok;
while (nWords < 20 )
{
name = tok.wordToken();
if( badInput(is, tok) ) return false;
//if(!tok.isWord()) return false;
nWords++;
if(tok.isWord() && tok.wordToken() != "facet" )
{
name += tok.wordToken();
}
else if( tok.isNumber())
{
auto val = tok.number();
name += real2Word(val);
}
else if( tok.isPunctuation())
{
name += tok.pToken();
}
else if (tok.isWord() && tok.wordToken() == "facet")
{
is.putBack(tok);
reachedFacet = true;
break;
}
else
{
name = "";
is.putBack(tok);
return false;
}
is >> tok;
}
if(!reachedFacet) return false;
vertecies.clear();
while(true )
{