ENH: relocate graph writers to meshTools (not reqd by core OpenFOAM lib)

GIT: relocate globalIndex (is independent of mesh)

STYLE: include label/scalar Fwd in contiguous.H

STYLE: unneed commSchedule include in GeometricField
This commit is contained in:
Mark Olesen
2022-02-11 10:14:38 +01:00
parent 58f76ccc5f
commit 42f426f6c4
25 changed files with 161 additions and 209 deletions

View File

@ -1,9 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/randomProcesses/lnInclude \
-I$(FFTW_INC_DIR)
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-lsampling \
-lrandomProcesses

View File

@ -1,9 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/randomProcesses/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-lrandomProcesses

View File

@ -594,7 +594,6 @@ meshes/ProcessorTopology/commSchedule.C
globalMeshData = $(polyMesh)/globalMeshData
$(globalMeshData)/globalMeshData.C
$(globalMeshData)/globalPoints.C
$(globalMeshData)/globalIndex.C
$(polyMesh)/syncTools/syncTools.C
$(polyMesh)/polyMeshTetDecomposition/polyMeshTetDecomposition.C
@ -803,22 +802,14 @@ $(interpolationWeights)/linearInterpolationWeights/linearInterpolationWeights.C
$(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C
algorithms/indexedOctree/indexedOctreeName.C
algorithms/indexedOctree/treeDataCell.C
algorithms/indexedOctree/volumeType.C
algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C
algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C
graph/curve/curve.C
graph/graph.C
writers = graph/writers
$(writers)/rawGraph/rawGraph.C
$(writers)/gnuplotGraph/gnuplotGraph.C
$(writers)/xmgrGraph/xmgrGraph.C
parallel/globalIndex/globalIndex.C
meshes/data/data.C

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/
#include "emptyPolyPatch.H"
#include "commSchedule.H"
#include "globalMeshData.H"
#include "cyclicPolyPatch.H"

View File

@ -101,18 +101,16 @@ public:
// Member Functions
//- Order in which comms is scheduled
const labelList& schedule() const
const labelList& schedule() const noexcept
{
return schedule_;
}
//- Per processor the order in which communication has been scheduled
const labelListList& procSchedule() const
const labelListList& procSchedule() const noexcept
{
return procSchedule_;
}
};

View File

@ -59,11 +59,11 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef contiguous_H
#define contiguous_H
#ifndef Foam_contiguous_H
#define Foam_contiguous_H
#include "scalar.H"
#include "label.H"
#include "scalarFwd.H"
#include "labelFwd.H"
#include <type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -147,6 +147,14 @@ $(setWriters)/vtk/foamVtkCoordSetWriter.C
$(setWriters)/vtk/vtkSetWriterRunTime.C
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
graph/curve.C
graph/graph.C
graphWriters = graph/writers
$(graphWriters)/raw/rawGraphWriter.C
$(graphWriters)/gnuplot/gnuplotGraphWriter.C
$(graphWriters)/xmgrace/xmgraceGraphWriter.C
topoSets = topoSet/topoSets
$(topoSets)/cellBitSet.C

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef curve_H
#define curve_H
#ifndef Foam_curve_H
#define Foam_curve_H
#include "string.H"
#include "primitiveFields.H"
@ -46,8 +46,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward Declarations
class curve;
Ostream& operator<<(Ostream&, const curve&);
@ -60,13 +59,11 @@ class curve
:
public scalarField
{
public:
//- The style (line, symbol, etc) of a curve
class curveStyle
{
public:
//- Enumeration definitions
@ -116,9 +113,10 @@ public:
private:
// private data
// Private Data
string name_;
curveStyle style_;
@ -126,9 +124,6 @@ public:
// Constructors
//- Construct as interpolation of an existing curve
//curve(const curve&, const label);
//- Construct from name, style and size
curve
(
@ -151,7 +146,7 @@ public:
}
// Member functions
// Member Functions
// Access
@ -166,12 +161,6 @@ public:
}
// Friend functions
//- Gradient of the curve
//friend curve grad(const curve&);
// Ostream operator
friend Ostream& operator<<(Ostream&, const curve&);

View File

@ -29,7 +29,6 @@ License
#include "graph.H"
#include "OFstream.H"
#include "IOmanip.H"
#include "Pair.H"
#include "OSspecific.H"
#include "SubField.H"
@ -272,9 +271,9 @@ void Foam::graph::write(Ostream& os, const word& format) const
void Foam::graph::write(const fileName& pName, const word& format) const
{
autoPtr<writer> graphWriter(writer::New(format));
autoPtr<writer> writer(writer::New(format));
OFstream graphFile(pName + '.' + graphWriter().ext());
OFstream graphFile(pName + '.' + writer().ext());
if (graphFile.good())
{

View File

@ -35,23 +35,21 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef graph_H
#define graph_H
#ifndef Foam_graph_H
#define Foam_graph_H
#include "string.H"
#include "point.H"
#include "HashPtrTable.H"
#include "curve.H"
#include "HashPtrTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward Declaration
class graph;
Ostream& operator<<(Ostream&, const graph&);
@ -63,7 +61,7 @@ class graph
:
public HashPtrTable<curve>
{
// private data
// Private Data
string title_;
string xName_;
@ -71,13 +69,10 @@ class graph
scalarField x_;
struct xy
{
scalar x_, y_;
xy()
{}
// Friend Operators
@ -143,10 +138,10 @@ public:
);
//- Construct from Istream
graph(Istream& is);
explicit graph(Istream& is);
// Member functions
// Member Functions
// Access
@ -190,7 +185,6 @@ public:
//- Abstract base class for a graph writer
class writer
{
protected:
void writeXY
@ -219,17 +213,13 @@ public:
// Selectors
//- Return a reference to the selected writer
static autoPtr<writer> New
(
const word& writeFormat
);
static autoPtr<writer> New(const word& writeFormat);
// Constructors
//- Construct null
writer()
{}
//- Default construct
writer() = default;
//- Destructor
@ -238,19 +228,14 @@ public:
// Member Functions
// Access
//- The fileName extension for this graph format
virtual word ext() const = 0;
//- Return the appropriate fileName extension
// for this graph format
virtual const word& ext() const = 0;
// Write
//- Write graph in appropriate format
virtual void write(const graph&, Ostream&) const = 0;
//- Write graph in appropriate format
virtual void write(const graph&, Ostream&) const = 0;
};
//- Write out graph data as a simple table
void writeTable(Ostream&) const;
@ -272,7 +257,7 @@ public:
static word wordify(const string& sname);
// Friend operators
// Friend Operators
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const graph&);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,50 +26,49 @@ License
\*---------------------------------------------------------------------------*/
#include "gnuplotGraph.H"
#include "gnuplotGraphWriter.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(gnuplotGraph, 0);
const word gnuplotGraph::ext_("gplt");
typedef graph::writer graphWriter;
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, gnuplotGraph, word);
namespace graphWriters
{
defineTypeName(gnuplotWriter);
addToRunTimeSelectionTable(graphWriter, gnuplotWriter, word);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::gnuplotGraph::write(const graph& g, Ostream& os) const
void Foam::graphWriters::gnuplotWriter::write
(
const graph& g,
Ostream& os
) const
{
os << "#set term postscript color" << endl
<< "set output \"" << word(g.title()) << ".ps\"" << endl
<< "set title " << g.title() << " 0,0" << endl << "show title" << endl
<< "set xlabel " << g.xName() << " 0,0" << endl << "show xlabel" << endl
<< "set ylabel " << g.yName() << " 0,0" << endl << "show ylabel" << endl
<< "plot";
bool firstField = true;
os << "set term pngcairo" << nl
<< "set output \"" << word(g.title()) << ".png\"" << nl
<< "set title " << g.title() << " 0,0" << nl << "show title" << nl
<< "set xlabel " << g.xName() << " 0,0" << nl << "show xlabel" << nl
<< "set ylabel " << g.yName() << " 0,0" << nl << "show ylabel" << nl;
label nplots = 0;
forAllConstIters(g, iter)
{
if (!firstField)
{
os << ',';
}
firstField = false;
os << (nplots++ ? ", \\" : "plot \\") << nl;
os << "'-' title " << iter()->name() << " with lines";
}
os << "; pause -1" << endl;
os << "; pause -1" << nl;
forAllConstIters(g, iter)
{
os << endl;
os << nl;
writeXY(g.x(), *iter(), os);
}
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,18 +25,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::gnuplotGraph
Foam::graphWriters::gnuplotWriter
Description
Output in gnuplot (http://www.gnuplot.info) format
SourceFiles
gnuplotGraph.C
gnuplotGraphWriter.C
\*---------------------------------------------------------------------------*/
#ifndef gnuplotGraph_H
#define gnuplotGraph_H
#ifndef Foam_gnuplotGraphWriter_H
#define Foam_gnuplotGraphWriter_H
#include "graph.H"
@ -43,57 +44,42 @@ SourceFiles
namespace Foam
{
namespace graphWriters
{
/*---------------------------------------------------------------------------*\
Class gnuplotGraph Declaration
Class gnuplotWriter Declaration
\*---------------------------------------------------------------------------*/
class gnuplotGraph
class gnuplotWriter
:
public graph::writer
{
public:
//- Runtime type information
TypeName("gnuplot");
//- FileName extension for this graph format
static const word ext_;
// Constructors
//- Construct null
gnuplotGraph()
{}
TypeNameNoDebug("gnuplot");
//- Default construct
gnuplotWriter() = default;
//- Destructor
~gnuplotGraph()
{}
~gnuplotWriter() = default;
// Member Functions
// Access
//- The fileName extension for this graph format
word ext() const { return "gplt"; }
//- Return the appropriate fileName extension
// for this graph format
const word& ext() const
{
return ext_;
}
// Write
void write(const graph&, Ostream& os) const;
//- Write
void write(const graph&, Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace graphWriters
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,24 +26,30 @@ License
\*---------------------------------------------------------------------------*/
#include "rawGraph.H"
#include "rawGraphWriter.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(rawGraph, 0);
const word rawGraph::ext_("xy");
typedef graph::writer graphWriter;
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, rawGraph, word);
namespace graphWriters
{
defineTypeName(rawWriter);
addToRunTimeSelectionTable(graphWriter, rawWriter, word);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::rawGraph::write(const graph& g, Ostream& os) const
void Foam::graphWriters::rawWriter::write
(
const graph& g,
Ostream& os
) const
{
g.writeTable(os);
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,18 +25,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::rawGraph
Foam::graphWriters::rawWriter
Description
A raw xy graph output
SourceFiles
rawGraph.C
rawGraphWriter.C
\*---------------------------------------------------------------------------*/
#ifndef rawGraph_H
#define rawGraph_H
#ifndef Foam_rawGraphWriter_H
#define Foam_rawGraphWriter_H
#include "graph.H"
@ -43,57 +44,42 @@ SourceFiles
namespace Foam
{
namespace graphWriters
{
/*---------------------------------------------------------------------------*\
Class rawGraph Declaration
Class rawWriter Declaration
\*---------------------------------------------------------------------------*/
class rawGraph
class rawWriter
:
public graph::writer
{
public:
//- Runtime type information
TypeName("raw");
//- FileName extension for this graph format
static const word ext_;
// Constructors
//- Construct null
rawGraph()
{}
TypeNameNoDebug("raw");
//- Default construct
rawWriter() = default;
//- Destructor
~rawGraph()
{}
~rawWriter() = default;
// Member Functions
// Access
//- The fileName extension for this graph format
word ext() const { return "xy"; }
//- Return the appropriate fileName extension
// for this graph format
const word& ext() const
{
return ext_;
}
// Write
void write(const graph&, Ostream& os) const;
//- Write
void write(const graph&, Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace graphWriters
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,43 +26,49 @@ License
\*---------------------------------------------------------------------------*/
#include "xmgrGraph.H"
#include "xmgraceGraphWriter.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(xmgrGraph, 0);
const word xmgrGraph::ext_("agr");
typedef graph::writer graphWriter;
addToRunTimeSelectionTable(graphWriter, xmgrGraph, word);
typedef graph::writer graphWriter;
namespace graphWriters
{
defineTypeName(xmgraceWriter);
addToRunTimeSelectionTable(graphWriter, xmgraceWriter, word);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::xmgrGraph::write(const graph& g, Ostream& os) const
void Foam::graphWriters::xmgraceWriter::write
(
const graph& g,
Ostream& os
) const
{
os << "@title " << g.title() << nl
<< "@xaxis label " << g.xName() << nl
<< "@yaxis label " << g.yName() << endl;
<< "@yaxis label " << g.yName() << nl;
label fieldi = 0;
label nWritten_ = 0;
forAllConstIters(g, iter)
{
os << "@s" << fieldi << " legend "
os << "@s" << nWritten_ << " legend "
<< iter()->name() << nl
<< "@target G0.S" << fieldi << nl
<< "@type xy" << endl;
<< "@target G0.S" << nWritten_ << nl
<< "@type xy" << nl;
writeXY(g.x(), *iter(), os);
os << endl;
fieldi++;
++nWritten_;
}
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,19 +25,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::xmgrGraph
Foam::graphWriters::xmgraceWriter
Description
Output and \b agr file for \em xmgrace
(http://plasma-gate.weizmann.ac.il/Grace/)
SourceFiles
xmgrGraph.C
xmgraceGraphWriter.C
\*---------------------------------------------------------------------------*/
#ifndef xmgrGraph_H
#define xmgrGraph_H
#ifndef Foam_xmgraceGraphWriter_H
#define Foam_xmgraceGraphWriter_H
#include "graph.H"
@ -44,57 +45,42 @@ SourceFiles
namespace Foam
{
namespace graphWriters
{
/*---------------------------------------------------------------------------*\
Class xmgrGraph Declaration
Class xmgraceWriter Declaration
\*---------------------------------------------------------------------------*/
class xmgrGraph
class xmgraceWriter
:
public graph::writer
{
public:
//- Runtime type information
TypeName("xmgr");
//- FileName extension for this graph format
static const word ext_;
// Constructors
//- Construct null
xmgrGraph()
{}
TypeNameNoDebug("xmgr");
//- Default construct
xmgraceWriter() = default;
//- Destructor
~xmgrGraph()
{}
~xmgraceWriter() = default;
// Member Functions
// Access
//- The fileName extension for this graph format
word ext() const { return "agr"; }
//- Return the appropriate fileName extension
// for this graph format
const word& ext() const
{
return ext_;
}
// Write
void write(const graph&, Ostream& os) const;
//- Write
void write(const graph&, Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace graphWriters
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,11 +1,15 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(FFTW_INC_DIR)
LIB_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lmeshTools \
-lsurfMesh \
-lsampling \
-L$(FFTW_LIB_DIR) -lfftw3