Files
openfoam/src/edgeMesh/edgeFormats/starcd/STARCDedgeFormat.H
Mark Olesen d016db1bc6 Enhance edgeMesh to support more formats.
Read only support:

  .bdf, .nas - NASTRAN format. Handles both CBEAM and CROD as lines.
  CROD is what Hypermesh happens to output.

Write only support:

  .vtk - VTK legacy format in ASCII

Read/write support:
  .eMesh - native format, which is simply a list of points, edges
      with an additional IOobject header that lets them be moved about
      easily to use as a featureEdgeMesh.

  .inp - STAR-CD inp/cel/vrt combination
       IOobject header)

  .obj - Alias waverfront format

Radically simplify surfaceFeatureConvert by using the new edgeMesh
functionality.
2009-12-11 16:29:55 +01:00

160 lines
3.9 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::fileFormats::STARCDedgeFormat
Description
Read/write the lines from pro-STAR vrt/cel files.
Note
Uses the extension @a .inp (input) to denote the format.
See Also
Foam::meshReaders::STARCD
SourceFiles
STARCDedgeFormat.C
\*---------------------------------------------------------------------------*/
#ifndef STARCDedgeFormat_H
#define STARCDedgeFormat_H
#include "edgeMesh.H"
#include "IFstream.H"
#include "Ostream.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fileFormats
{
/*---------------------------------------------------------------------------*\
Class STARCDedgeFormat Declaration
\*---------------------------------------------------------------------------*/
class STARCDedgeFormat
:
public edgeMesh
{
// Private Data
//- STAR-CD identifier for line shapes (1d elements)
static const int starcdLineShape_ = 2;
//- STAR-CD identifier for line type
static const int starcdLineType_ = 5;
// Private Member Functions
static inline void writeLines
(
Ostream&,
const edgeList&
);
//- Disallow default bitwise copy construct
STARCDedgeFormat(const STARCDedgeFormat&);
//- Disallow default bitwise assignment
void operator=(const STARCDedgeFormat&);
protected:
// Protected Member Functions
static bool readHeader(IFstream&, const word&);
static void writeHeader(Ostream&, const char* filetype);
static bool readPoints(IFstream&, pointField&, labelList& ids);
static void writePoints(Ostream&, const pointField&);
static void writeCase
(
Ostream&,
const pointField&,
const label nEdges
);
public:
// Constructors
//- Construct from file name
STARCDedgeFormat(const fileName&);
// Selectors
//- Read file and return edgeMesh
static autoPtr<edgeMesh> New(const fileName& name)
{
return autoPtr<edgeMesh>
(
new STARCDedgeFormat(name)
);
}
//- Destructor
virtual ~STARCDedgeFormat()
{}
// Member Functions
//- Write edge mesh
static void write(const fileName&, const edgeMesh&);
//- Read from file
virtual bool read(const fileName&);
//- Write object
virtual void write(const fileName& name) const
{
write(name, *this);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fileFormats
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //