/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
#include "STARCDedgeFormat.H"
#include "ListOps.H"
#include "clock.H"
#include "PackedBoolList.H"
#include "IStringStream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline void Foam::fileFormats::STARCDedgeFormat::writeLines
(
Ostream& os,
const edgeList& edges
)
{
writeHeader(os, "CELL");
forAll(edges, edgeI)
{
const edge& e = edges[edgeI];
const label cellId = edgeI + 1;
os << cellId // includes 1 offset
<< ' ' << starcdLineShape_ // 2(line) shape
<< ' ' << e.size()
<< ' ' << 401 // arbitrary value
<< ' ' << starcdLineType_; // 5(line)
os << nl << " " << cellId << " "
<< (e[0]+1) << " " << (e[1]+1) << nl;
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fileFormats::STARCDedgeFormat::writeCase
(
Ostream& os,
const pointField& pointLst,
const label nEdges
)
{
word caseName = os.name().lessExt().name();
os << "! STAR-CD file written " << clock::dateTime().c_str() << nl
<< "! " << pointLst.size() << " points, " << nEdges << " lines" << nl
<< "! case " << caseName << nl
<< "! ------------------------------" << nl;
// forAll(zoneLst, zoneI)
// {
// os << "ctable " << zoneI + 1 << " line" << nl
// << "ctname " << zoneI + 1 << " "
// << zoneLst[zoneI].name() << nl;
// }
os << "! ------------------------------" << nl
<< "*set icvo mxv - 1" << nl
<< "vread " << caseName << ".vrt icvo,,,coded" << nl
<< "cread " << caseName << ".cel icvo,,,add,coded" << nl
<< "*set icvo" << nl
<< "! end" << nl;
os.flush();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::STARCDedgeFormat::STARCDedgeFormat
(
const fileName& filename
)
{
read(filename);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::fileFormats::STARCDedgeFormat::read
(
const fileName& filename
)
{
clear();
fileName baseName = filename.lessExt();
// STAR-CD index of points
List