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:
commit
e895e689be
|
@ -229,6 +229,7 @@ public:
|
||||||
auto area = triSurface_.area().deviceVectorAll();
|
auto area = triSurface_.area().deviceVectorAll();
|
||||||
auto stress = stressWall_.deviceVectorAll();
|
auto stress = stressWall_.deviceVectorAll();
|
||||||
auto numTri =triSurface_.size();
|
auto numTri =triSurface_.size();
|
||||||
|
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
Kokkos::parallel_for(
|
||||||
"geometry::calculateStress",
|
"geometry::calculateStress",
|
||||||
|
|
|
@ -31,7 +31,15 @@ pFlow::uniquePtr<pFlow::iFstream> pFlow::IOfileHeader::inStream()const
|
||||||
|
|
||||||
pFlow::uniquePtr<pFlow::oFstream> pFlow::IOfileHeader::outStream()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
|
pFlow::IOfileHeader::IOfileHeader
|
||||||
|
|
|
@ -178,6 +178,18 @@ public:
|
||||||
|
|
||||||
// - return number of repositories
|
// - return number of repositories
|
||||||
size_t numRepositories()const;
|
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
|
// - return a ref to the underlaying data in the object
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -135,6 +135,9 @@ pFlow::systemControl::systemControl
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
outFilePrecision_(
|
||||||
|
settingsDict_.getValOrSet("outFilePrecision", static_cast<size_t>(6))
|
||||||
|
),
|
||||||
Time_
|
Time_
|
||||||
(
|
(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -58,12 +58,15 @@ protected:
|
||||||
// - settingsDict fileDictionary
|
// - settingsDict fileDictionary
|
||||||
dictionary& settingsDict_;
|
dictionary& settingsDict_;
|
||||||
|
|
||||||
|
// - precision for writing to file
|
||||||
|
size_t outFilePrecision_ = 6;
|
||||||
|
|
||||||
// - time repository
|
// - time repository
|
||||||
Time Time_;
|
Time Time_;
|
||||||
|
|
||||||
// - if time control is managed externaly
|
// - if time control is managed externaly
|
||||||
|
|
||||||
bool externalTimeControl_ = false;
|
bool externalTimeControl_ = false;
|
||||||
|
|
||||||
// - acceleration
|
// - acceleration
|
||||||
realx3 g_;
|
realx3 g_;
|
||||||
|
@ -178,6 +181,11 @@ public:
|
||||||
Time_.setSaveTimeFolder(saveToFile, timeName);
|
Time_.setSaveTimeFolder(saveToFile, timeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t outFilePrecision() const override
|
||||||
|
{
|
||||||
|
return outFilePrecision_;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ bool pFlow::multiTriSurface::addTriSurface
|
||||||
|
|
||||||
const auto& newPoints = tSurf.points();
|
const auto& newPoints = tSurf.points();
|
||||||
const auto& newVertices = tSurf.vertices();
|
const auto& newVertices = tSurf.vertices();
|
||||||
|
const auto& newAreas = tSurf.area();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -112,8 +113,14 @@ bool pFlow::multiTriSurface::addTriSurface
|
||||||
auto vOldSize = vertices_.size();
|
auto vOldSize = vertices_.size();
|
||||||
auto vNewSize = vOldSize + newVertices.size();
|
auto vNewSize = vOldSize + newVertices.size();
|
||||||
vertices_.resize(vNewSize);
|
vertices_.resize(vNewSize);
|
||||||
|
area_.resize(vNewSize);
|
||||||
|
|
||||||
auto verVec = vertices_.deviceVectorAll();
|
auto verVec = vertices_.deviceVectorAll();
|
||||||
|
auto areaVec = area_.deviceVectorAll();
|
||||||
|
|
||||||
auto newVerVec = newVertices.deviceVectorAll();
|
auto newVerVec = newVertices.deviceVectorAll();
|
||||||
|
auto newArea = newAreas.deviceVectorAll();
|
||||||
|
|
||||||
auto maxIdx = maxIndex();
|
auto maxIdx = maxIndex();
|
||||||
|
|
||||||
Kokkos::parallel_for(
|
Kokkos::parallel_for(
|
||||||
|
@ -121,6 +128,7 @@ bool pFlow::multiTriSurface::addTriSurface
|
||||||
newVertices.size(),
|
newVertices.size(),
|
||||||
LAMBDA_HD(int32 i){
|
LAMBDA_HD(int32 i){
|
||||||
verVec[vOldSize+i] = newVerVec[i]+(maxIdx+1);
|
verVec[vOldSize+i] = newVerVec[i]+(maxIdx+1);
|
||||||
|
areaVec[vOldSize+i] = newArea[i];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
Kokkos::fence();
|
Kokkos::fence();
|
||||||
|
|
|
@ -61,19 +61,46 @@ bool pFlow::stlFile::readSolid
|
||||||
if(!checkWordToken(is, tok, "solid")) return false;
|
if(!checkWordToken(is, tok, "solid")) return false;
|
||||||
|
|
||||||
// check if there is a name associated with solid
|
// check if there is a name associated with solid
|
||||||
|
name = "";
|
||||||
|
|
||||||
|
|
||||||
|
int32 nWords =0;
|
||||||
|
bool reachedFacet = false;
|
||||||
is >> tok;
|
is >> tok;
|
||||||
if( badInput(is, tok) ) return false;
|
|
||||||
if(!tok.isWord()) return false;
|
|
||||||
|
|
||||||
if(tok.wordToken() != "facet" )
|
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
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
is >> tok;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if(!reachedFacet) return false;
|
||||||
name = "";
|
|
||||||
is.putBack(tok);
|
|
||||||
}
|
|
||||||
vertecies.clear();
|
vertecies.clear();
|
||||||
while(true )
|
while(true )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue