mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extendedEdgeMesh: check for support
This commit is contained in:
@ -35,8 +35,6 @@ eem = $(em)/extendedEdgeMesh
|
||||
$(eem)/extendedEdgeMesh.C
|
||||
$(eem)/extendedEdgeMeshNew.C
|
||||
|
||||
$(eem)/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormat.C
|
||||
$(eem)/extendedEdgeMeshFormats/obj/OBJextendedEdgeFormatRunTime.C
|
||||
$(eem)/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C
|
||||
$(eem)/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormatRunTime.C
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "OBJstream.H"
|
||||
#include "DynamicField.H"
|
||||
#include "edgeMeshFormatsCore.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -104,6 +105,68 @@ Foam::label Foam::extendedEdgeMesh::nPointTypes = 4;
|
||||
Foam::label Foam::extendedEdgeMesh::nEdgeTypes = 5;
|
||||
|
||||
|
||||
Foam::wordHashSet Foam::extendedEdgeMesh::readTypes()
|
||||
{
|
||||
return wordHashSet(*fileExtensionConstructorTablePtr_);
|
||||
}
|
||||
|
||||
|
||||
Foam::wordHashSet Foam::extendedEdgeMesh::writeTypes()
|
||||
{
|
||||
return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::extendedEdgeMesh::canReadType
|
||||
(
|
||||
const word& ext,
|
||||
const bool verbose
|
||||
)
|
||||
{
|
||||
return edgeMeshFormatsCore::checkSupport
|
||||
(
|
||||
readTypes(),
|
||||
ext,
|
||||
verbose,
|
||||
"reading"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::extendedEdgeMesh::canWriteType
|
||||
(
|
||||
const word& ext,
|
||||
const bool verbose
|
||||
)
|
||||
{
|
||||
return edgeMeshFormatsCore::checkSupport
|
||||
(
|
||||
writeTypes(),
|
||||
ext,
|
||||
verbose,
|
||||
"writing"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::extendedEdgeMesh::canRead
|
||||
(
|
||||
const fileName& name,
|
||||
const bool verbose
|
||||
)
|
||||
{
|
||||
word ext = name.ext();
|
||||
if (ext == "gz")
|
||||
{
|
||||
ext = name.lessExt().ext();
|
||||
}
|
||||
return canReadType(ext, verbose);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::extendedEdgeMesh::pointStatus
|
||||
|
||||
@ -225,6 +225,18 @@ public:
|
||||
//- Number of possible feature edge types (i.e. number of slices)
|
||||
static label nEdgeTypes;
|
||||
|
||||
//- Can we read this file format?
|
||||
static bool canRead(const fileName&, const bool verbose=false);
|
||||
|
||||
//- Can we read this file format?
|
||||
static bool canReadType(const word& ext, const bool verbose=false);
|
||||
|
||||
//- Can we write this file format type?
|
||||
static bool canWriteType(const word& ext, const bool verbose=false);
|
||||
|
||||
static wordHashSet readTypes();
|
||||
static wordHashSet writeTypes();
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "OBJextendedEdgeFormat.H"
|
||||
#include "OBJedgeFormat.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileFormats::OBJextendedEdgeFormat::OBJextendedEdgeFormat
|
||||
(
|
||||
const fileName& filename
|
||||
)
|
||||
{
|
||||
read(filename);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fileFormats::OBJextendedEdgeFormat::read(const fileName& filename)
|
||||
{
|
||||
edgeMesh em(filename);
|
||||
|
||||
clear();
|
||||
|
||||
// Note: should transfer here instead
|
||||
storedPoints() = em.points();
|
||||
storedEdges() = em.edges();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fileFormats::OBJextendedEdgeFormat::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const extendedEdgeMesh& mesh
|
||||
)
|
||||
{
|
||||
OBJedgeFormat::write(filename, mesh);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,119 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fileFormats::OBJextendedEdgeFormat
|
||||
|
||||
Description
|
||||
Provide a means of reading/writing Alias/Wavefront OBJ format.
|
||||
|
||||
Does not handle negative vertex indices.
|
||||
|
||||
SourceFiles
|
||||
OBJextendedEdgeFormat.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef OBJextendedEdgeFormat_H
|
||||
#define OBJextendedEdgeFormat_H
|
||||
|
||||
#include "extendedEdgeMesh.H"
|
||||
//#include "IFstream.H"
|
||||
//#include "Ostream.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fileFormats
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class OBJextendedEdgeFormat Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class OBJextendedEdgeFormat
|
||||
:
|
||||
public extendedEdgeMesh
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
OBJextendedEdgeFormat(const OBJextendedEdgeFormat&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const OBJextendedEdgeFormat&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from file name
|
||||
OBJextendedEdgeFormat(const fileName&);
|
||||
|
||||
|
||||
// // Selectors
|
||||
//
|
||||
// //- Read file and return surface
|
||||
// static autoPtr<extendedEdgeMesh> New(const fileName& name)
|
||||
// {
|
||||
// return autoPtr<extendedEdgeMesh>
|
||||
// (
|
||||
// new OBJextendedEdgeFormat(name)
|
||||
// );
|
||||
// }
|
||||
//
|
||||
|
||||
//- Destructor
|
||||
virtual ~OBJextendedEdgeFormat()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write(const fileName&, const extendedEdgeMesh&);
|
||||
|
||||
//- Read from file
|
||||
virtual bool read(const fileName&);
|
||||
|
||||
//- Write object file
|
||||
virtual void write(const fileName& name) const
|
||||
{
|
||||
write(name, *this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fileFormats
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,60 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "OBJextendedEdgeFormat.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fileFormats
|
||||
{
|
||||
|
||||
// read extendedEdgeMesh
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
extendedEdgeMesh,
|
||||
OBJextendedEdgeFormat,
|
||||
fileExtension,
|
||||
obj
|
||||
);
|
||||
|
||||
//// write extendedEdgeMesh
|
||||
//addNamedToMemberFunctionSelectionTable
|
||||
//(
|
||||
// extendedEdgeMesh,
|
||||
// OBJextendedEdgeFormat,
|
||||
// write,
|
||||
// fileExtension,
|
||||
// obj
|
||||
//);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user