Compare commits
55 Commits
OpenFOAM-v
...
OpenFOAM-v
| Author | SHA1 | Date | |
|---|---|---|---|
| aa2f932b75 | |||
| 6691e6563c | |||
| b2bf82360c | |||
| a5b2cf9069 | |||
| 06333efd2d | |||
| 4200774d35 | |||
| 04b5291c55 | |||
| 86e78ac3c1 | |||
| 55b49ac0d0 | |||
| a8b6d01b87 | |||
| 8075804b18 | |||
| a88e67f2e1 | |||
| b4229841c0 | |||
| d16f1312cb | |||
| ba8d45c82d | |||
| 80e4033810 | |||
| 794ab39742 | |||
| fe17c8ad5f | |||
| ac8b64df46 | |||
| ba3a31af95 | |||
| 69a61bf835 | |||
| 989fda3b18 | |||
| 28d24fefbc | |||
| 161c66df17 | |||
| 418248709f | |||
| 6f230a8b67 | |||
| ca28377642 | |||
| 79cf72d573 | |||
| a65b9fdd7c | |||
| 92214eb4af | |||
| ff19bedbc3 | |||
| 49e63378f8 | |||
| a100b49606 | |||
| e53419c025 | |||
| 81015889f2 | |||
| d3bcc71b64 | |||
| 370d1a4589 | |||
| 9a4851268e | |||
| f62a86575b | |||
| e252ec46dc | |||
| 21de95bb81 | |||
| 3be7610710 | |||
| 835c392dd5 | |||
| c234acf1ed | |||
| f62d6d96aa | |||
| eb125303c0 | |||
| ed63d9b2c6 | |||
| 8e78a27822 | |||
| 0bbf94fb9b | |||
| 254d38d772 | |||
| 60efde8c09 | |||
| c413ec5009 | |||
| 227a0f5d43 | |||
| fed6a9efd4 | |||
| 122e496590 |
4
Allwmake
4
Allwmake
@ -86,8 +86,8 @@ echo " ${WM_PROJECT_DIR##*/}"
|
||||
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
|
||||
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
|
||||
echo
|
||||
echo " api = $(foamEtcFile -show-api 2>/dev/null)"
|
||||
echo " patch = $(foamEtcFile -show-patch 2>/dev/null)"
|
||||
echo " api = $(etc/openfoam -show-api 2>/dev/null)"
|
||||
echo " patch = $(etc/openfoam -show-patch 2>/dev/null)"
|
||||
echo " bin = $(_foamCountDirEntries $FOAM_APPBIN) entries"
|
||||
echo " lib = $(_foamCountDirEntries $FOAM_LIBBIN) entries"
|
||||
echo
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=1912
|
||||
patch=0
|
||||
patch=200417
|
||||
|
||||
@ -144,6 +144,13 @@ public:
|
||||
typedef indexedVertex<Gt,Vb2> Other;
|
||||
};
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
indexedVertex(const indexedVertex&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
inline indexedVertex();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -128,6 +128,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::ifstream OBJfile(objName);
|
||||
|
||||
Info<< "Processing file " << objName << endl;
|
||||
|
||||
if (!OBJfile.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -145,13 +147,14 @@ int main(int argc, char *argv[])
|
||||
label lineNo = 0;
|
||||
while (OBJfile.good())
|
||||
{
|
||||
string line = getLine(OBJfile);
|
||||
const string line = getLine(OBJfile);
|
||||
lineNo++;
|
||||
|
||||
if (line.empty()) continue;
|
||||
|
||||
// Read first word
|
||||
IStringStream lineStream(line);
|
||||
word cmd;
|
||||
lineStream >> cmd;
|
||||
word cmd(lineStream);
|
||||
|
||||
if (cmd == "v")
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,7 +39,7 @@ Usage
|
||||
|
||||
Options:
|
||||
- \par -processor
|
||||
List times from processor0/ directory
|
||||
Times from processor0/ directory
|
||||
|
||||
- \par -rm
|
||||
Remove selected time directories
|
||||
@ -58,9 +58,30 @@ Note
|
||||
#include "profiling.H"
|
||||
#include "timeSelector.H"
|
||||
#include "TimePaths.H"
|
||||
#include "ListOps.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// Many ways to name processor directories
|
||||
//
|
||||
// Uncollated | "processor0", "processor1" ...
|
||||
// Collated (old) | "processors"
|
||||
// Collated (new) | "processors<N>"
|
||||
// Host collated | "processors<N>_<low>-<high>"
|
||||
|
||||
const regExp matcher("processors?[0-9]+(_[0-9]+-[0-9]+)?");
|
||||
|
||||
bool isProcessorDir(const string& dir)
|
||||
{
|
||||
return
|
||||
(
|
||||
dir.starts_with("processor")
|
||||
&& (dir == "processors" || matcher.match(dir))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -95,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool removeFiles(args.found("rm"));
|
||||
const bool verbose(args.found("verbose"));
|
||||
bool verbose(args.found("verbose"));
|
||||
|
||||
|
||||
// Get times list from the master processor and subset based on
|
||||
@ -116,6 +137,7 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Obtain time directory names from "processor0/" only
|
||||
timePaths = autoPtr<TimePaths>::New
|
||||
(
|
||||
args.rootPath(),
|
||||
@ -140,10 +162,34 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (nProcs)
|
||||
{
|
||||
fileNameList procDirs
|
||||
(
|
||||
Foam::readDir
|
||||
(
|
||||
args.path(),
|
||||
fileName::DIRECTORY,
|
||||
false, // No gzip anyhow
|
||||
false // Do not follow linkts
|
||||
)
|
||||
);
|
||||
|
||||
inplaceSubsetList(procDirs, isProcessorDir);
|
||||
|
||||
// Perhaps not needed
|
||||
/// Foam::sort(procDirs, stringOps::natural_sort());
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "Removing " << nTimes
|
||||
<< " processor time directories" << endl;
|
||||
InfoErr
|
||||
<< "Removing " << nTimes
|
||||
<< " times in " << procDirs.size()
|
||||
<< " processor directories" << endl;
|
||||
}
|
||||
|
||||
// No processor directories? - silence verbosity
|
||||
if (procDirs.empty())
|
||||
{
|
||||
verbose = false;
|
||||
}
|
||||
|
||||
forAllReverse(timeDirs, timei)
|
||||
@ -152,25 +198,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< " rm " << timeName
|
||||
InfoErr
|
||||
<< " rm " << timeName
|
||||
<< " [" << (nTimes - timei) << '/' << nTimes << ']'
|
||||
<< endl;
|
||||
}
|
||||
|
||||
fileName path(args.path()/"processors"/timeName);
|
||||
|
||||
rmDir(path, true);
|
||||
|
||||
for (label proci=0; proci<nProcs; ++proci)
|
||||
for (const fileName& procDir : procDirs)
|
||||
{
|
||||
path =
|
||||
(
|
||||
args.path()
|
||||
/ ("processor" + Foam::name(proci))
|
||||
/ timeName
|
||||
);
|
||||
|
||||
rmDir(path, true);
|
||||
rmDir(args.path()/procDir/timeName, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,7 +214,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "Removing " << nTimes
|
||||
InfoErr
|
||||
<< "Removing " << nTimes
|
||||
<< " time directories" << endl;
|
||||
}
|
||||
|
||||
@ -188,7 +225,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< " rm " << timeName
|
||||
InfoErr
|
||||
<< " rm " << timeName
|
||||
<< " [" << (nTimes - timei) << '/' << nTimes << ']'
|
||||
<< endl;
|
||||
}
|
||||
@ -199,6 +237,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
// List times: one per line
|
||||
for (const instant& t : timeDirs)
|
||||
{
|
||||
Info<< t.name() << nl;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,7 +30,7 @@ Group
|
||||
grpMiscUtilities
|
||||
|
||||
Description
|
||||
Restore field names by removing the ending.
|
||||
Adjust (restore) field names by removing the ending.
|
||||
The fields are selected automatically or can be specified as optional
|
||||
command arguments.
|
||||
|
||||
@ -63,9 +63,30 @@ Usage
|
||||
#include "timeSelector.H"
|
||||
#include "Enum.H"
|
||||
#include "TimePaths.H"
|
||||
#include "ListOps.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// Many ways to name processor directories
|
||||
//
|
||||
// Uncollated | "processor0", "processor1" ...
|
||||
// Collated (old) | "processors"
|
||||
// Collated (new) | "processors<N>"
|
||||
// Host collated | "processors<N>_<low>-<high>"
|
||||
|
||||
const regExp matcher("processors?[0-9]+(_[0-9]+-[0-9]+)?");
|
||||
|
||||
bool isProcessorDir(const string& dir)
|
||||
{
|
||||
return
|
||||
(
|
||||
dir.starts_with("processor")
|
||||
&& (dir == "processors" || matcher.match(dir))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- The known and support types of operations
|
||||
enum restoreMethod
|
||||
{
|
||||
@ -311,7 +332,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Obtain time directory names from "processor0/" only
|
||||
|
||||
timePaths = autoPtr<TimePaths>::New
|
||||
(
|
||||
args.rootPath(),
|
||||
@ -329,10 +349,77 @@ int main(int argc, char *argv[])
|
||||
|
||||
const instantList timeDirs(timeSelector::select(timePaths->times(), args));
|
||||
|
||||
fileNameList procDirs;
|
||||
label leadProcIdx = -1;
|
||||
|
||||
if (timeDirs.empty())
|
||||
{
|
||||
Info<< "no times selected" << nl;
|
||||
Info<< "No times selected" << nl;
|
||||
}
|
||||
else if (nProcs)
|
||||
{
|
||||
procDirs =
|
||||
Foam::readDir
|
||||
(
|
||||
args.path(),
|
||||
fileName::DIRECTORY,
|
||||
false, // No gzip anyhow
|
||||
false // Do not follow linkts
|
||||
);
|
||||
|
||||
inplaceSubsetList(procDirs, isProcessorDir);
|
||||
|
||||
// Perhaps not needed
|
||||
Foam::sort(procDirs, stringOps::natural_sort());
|
||||
|
||||
// Decide who will be the "leading" processor for obtaining names
|
||||
// - processor0
|
||||
// - processors<N>
|
||||
// - processors<N>_0-<high>
|
||||
|
||||
// Uncollated
|
||||
leadProcIdx = procDirs.find("processor0");
|
||||
|
||||
if (!procDirs.empty())
|
||||
{
|
||||
if (leadProcIdx < 0)
|
||||
{
|
||||
// Collated (old)
|
||||
leadProcIdx = procDirs.find("processors");
|
||||
}
|
||||
|
||||
if (leadProcIdx < 0)
|
||||
{
|
||||
// Collated (new)
|
||||
leadProcIdx = procDirs.find("processors" + Foam::name(nProcs));
|
||||
}
|
||||
|
||||
if (leadProcIdx < 0)
|
||||
{
|
||||
// Host-collated
|
||||
const std::string prefix
|
||||
(
|
||||
"processors" + Foam::name(nProcs) + "_0-"
|
||||
);
|
||||
|
||||
forAll(procDirs, idx)
|
||||
{
|
||||
if (procDirs[idx].starts_with(prefix))
|
||||
{
|
||||
leadProcIdx = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Just default to anything (safety)
|
||||
if (leadProcIdx < 0)
|
||||
{
|
||||
leadProcIdx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (const instant& t : timeDirs)
|
||||
{
|
||||
@ -341,28 +428,28 @@ int main(int argc, char *argv[])
|
||||
Info<< "\nTime = " << timeName << nl;
|
||||
|
||||
label count = 0;
|
||||
wordList files;
|
||||
|
||||
if (nProcs)
|
||||
{
|
||||
const wordHashSet files
|
||||
(
|
||||
getFiles(args.path()/"processor0", timeName)
|
||||
);
|
||||
if (leadProcIdx >= 0)
|
||||
{
|
||||
files = getFiles(args.path()/procDirs[leadProcIdx], timeName);
|
||||
}
|
||||
|
||||
for (label proci=0; proci < nProcs; ++proci)
|
||||
for (const fileName& procDir : procDirs)
|
||||
{
|
||||
count += restoreFields
|
||||
(
|
||||
method,
|
||||
args.path()/("processor" + Foam::name(proci))/timeName,
|
||||
files,
|
||||
args.path()/procDir/timeName,
|
||||
wordHashSet(files),
|
||||
targetNames
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList files;
|
||||
if (Pstream::master())
|
||||
{
|
||||
files = getFiles(args.path(), timeName);
|
||||
|
||||
@ -45,33 +45,37 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
IOdictionary dict
|
||||
const dictionary NURBSdict
|
||||
(
|
||||
IOobject
|
||||
IOdictionary
|
||||
(
|
||||
"dynamicMeshDict",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
IOobject
|
||||
(
|
||||
"dynamicMeshDict",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).subDict("volumetricBSplinesMotionSolverCoeffs")
|
||||
);
|
||||
// Read box names and allocate size
|
||||
wordList controlBoxes(NURBSdict.toc());
|
||||
|
||||
const dictionary& coeffDict =
|
||||
dict.subDict("volumetricBSplinesMotionSolverCoeffs");
|
||||
|
||||
wordList controlBoxes(coeffDict.get<wordList>("controlBoxes"));
|
||||
|
||||
forAll(controlBoxes, iNURB)
|
||||
for (const word& boxName : controlBoxes)
|
||||
{
|
||||
// Creating an object writes the control points in the
|
||||
// constructor
|
||||
NURBS3DVolume::New
|
||||
(
|
||||
coeffDict.subDict(controlBoxes[iNURB]),
|
||||
mesh,
|
||||
false // do not compute parametric coordinates
|
||||
);
|
||||
if (NURBSdict.isDict(boxName))
|
||||
{
|
||||
// Creating an object writes the control points in the
|
||||
// constructor
|
||||
NURBS3DVolume::New
|
||||
(
|
||||
NURBSdict.subDict(boxName),
|
||||
mesh,
|
||||
false // do not compute parametric coordinates
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,6 +28,7 @@ Typedefs
|
||||
CGAL3DKernel
|
||||
|
||||
Description
|
||||
A typedef for selecting inexact (faster) or exact (slower) 3D model.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -38,13 +40,13 @@ Description
|
||||
#ifdef CGAL_INEXACT
|
||||
|
||||
// Fast kernel using a double as the storage type
|
||||
#include "CGAL/Exact_predicates_inexact_constructions_kernel.h"
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
|
||||
#else
|
||||
|
||||
// Very robust but expensive kernel
|
||||
#include "CGAL/Exact_predicates_exact_constructions_kernel.h"
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
|
||||
#endif
|
||||
|
||||
@ -65,6 +65,7 @@ struct IndexedFace
|
||||
Foam::label index;
|
||||
Foam::label region;
|
||||
};
|
||||
|
||||
struct My_items
|
||||
:
|
||||
public CGAL::Polyhedron_items_3
|
||||
|
||||
@ -20,4 +20,5 @@ EXE_INC = \
|
||||
LIB_LIBS = \
|
||||
-L$(CGAL_ARCH_PATH)/lib \
|
||||
-L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
|
||||
-lsurfMesh \
|
||||
-lmeshTools
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,14 +28,50 @@ License
|
||||
|
||||
#include "PolyhedronReader.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class HDS>
|
||||
void Foam::PolyhedronReader::Build_triangle<HDS>::operator()(HDS& hds)
|
||||
{
|
||||
// Postcondition: hds is a valid polyhedral surface.
|
||||
CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
|
||||
|
||||
B.begin_surface(s_.nPoints(), s_.size());
|
||||
|
||||
typedef typename HDS::Vertex Vertex;
|
||||
typedef typename Vertex::Point Point;
|
||||
|
||||
for (const auto& pt : s_.points())
|
||||
{
|
||||
B.add_vertex(Point(pt.x(), pt.y(), pt.z()));
|
||||
}
|
||||
|
||||
for (const auto& f : s_)
|
||||
{
|
||||
B.begin_facet();
|
||||
|
||||
for (const label verti : f)
|
||||
{
|
||||
B.add_vertex_to_facet(verti);
|
||||
}
|
||||
|
||||
B.end_facet();
|
||||
}
|
||||
|
||||
B.end_surface();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PolyhedronReader::PolyhedronReader(const triSurface& s, Polyhedron& p)
|
||||
{
|
||||
Build_triangle<HalfedgeDS> triangle(s);
|
||||
p.delegate(triangle);
|
||||
|
||||
// Populate index and region
|
||||
Foam::label nTris = 0;
|
||||
|
||||
for
|
||||
(
|
||||
Facet_iterator fi = p.facets_begin();
|
||||
@ -42,8 +79,10 @@ Foam::PolyhedronReader::PolyhedronReader(const triSurface& s, Polyhedron& p)
|
||||
++fi
|
||||
)
|
||||
{
|
||||
fi->index = nTris++;
|
||||
fi->region = s[fi->index].region();
|
||||
fi->index = nTris;
|
||||
fi->region = s[nTris].region();
|
||||
|
||||
++nTris;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -61,28 +61,21 @@ class PolyhedronReader
|
||||
|
||||
public:
|
||||
|
||||
Build_triangle(const triSurface& s);
|
||||
Build_triangle(const triSurface& s)
|
||||
:
|
||||
s_(s)
|
||||
{}
|
||||
|
||||
void operator()(HDS& hds);
|
||||
};
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
PolyhedronReader(const PolyhedronReader&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const PolyhedronReader&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Populate polyhedron from surface
|
||||
PolyhedronReader(const triSurface& s, Polyhedron& p);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -92,12 +85,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "PolyhedronReaderTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -1,74 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
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 "PolyhedronReader.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class HDS>
|
||||
Foam::PolyhedronReader::Build_triangle<HDS>::Build_triangle
|
||||
(
|
||||
const triSurface& s
|
||||
)
|
||||
:
|
||||
s_(s)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class HDS>
|
||||
void Foam::PolyhedronReader::Build_triangle<HDS>::operator()(HDS& hds)
|
||||
{
|
||||
// Postcondition: hds is a valid polyhedral surface.
|
||||
CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
|
||||
|
||||
B.begin_surface(s_.nPoints(), s_.size());
|
||||
|
||||
typedef typename HDS::Vertex Vertex;
|
||||
typedef typename Vertex::Point Point;
|
||||
|
||||
const Foam::pointField& pts = s_.points();
|
||||
forAll(pts, i)
|
||||
{
|
||||
const Foam::point& pt = pts[i];
|
||||
B.add_vertex(Point(pt.x(), pt.y(), pt.z()));
|
||||
}
|
||||
forAll(s_, i)
|
||||
{
|
||||
const Foam::labelledTri& t = s_[i];
|
||||
B.begin_facet();
|
||||
B.add_vertex_to_facet(t[0]);
|
||||
B.add_vertex_to_facet(t[1]);
|
||||
B.add_vertex_to_facet(t[2]);
|
||||
B.end_facet();
|
||||
}
|
||||
B.end_surface();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -102,8 +102,10 @@ typedef CGAL::AABB_face_graph_triangle_primitive
|
||||
typedef CGAL::AABB_traits<K, Primitive> Traits;
|
||||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
|
||||
typedef boost::optional<Tree::Intersection_and_primitive_id<Segment>::Type>
|
||||
Segment_intersection;
|
||||
typedef boost::optional
|
||||
<
|
||||
Tree::Intersection_and_primitive_id<Segment>::Type
|
||||
> Segment_intersection;
|
||||
|
||||
#endif // NO_CGAL
|
||||
|
||||
@ -633,17 +635,14 @@ labelPair edgeIntersectionsCGAL
|
||||
segments.clear();
|
||||
tree.all_intersections(segment_query, std::back_inserter(segments));
|
||||
|
||||
for
|
||||
(
|
||||
std::vector<Segment_intersection>::const_iterator iter =
|
||||
segments.begin(),
|
||||
end = segments.end();
|
||||
iter != end;
|
||||
++iter
|
||||
)
|
||||
|
||||
for (const Segment_intersection& intersect : segments)
|
||||
{
|
||||
// Get intersection object
|
||||
if (const Point* ptPtr = boost::get<Point>(&((*iter)->first)))
|
||||
if
|
||||
(
|
||||
const Point* ptPtr = boost::get<Point>(&(intersect->first))
|
||||
)
|
||||
{
|
||||
point pt
|
||||
(
|
||||
@ -652,7 +651,12 @@ labelPair edgeIntersectionsCGAL
|
||||
CGAL::to_double(ptPtr->z())
|
||||
);
|
||||
|
||||
Polyhedron::Face_handle f = (*iter)->second;
|
||||
#if defined (CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1041400000)
|
||||
Polyhedron::Face_handle f = (intersect->second);
|
||||
#else
|
||||
// 1.14 and later
|
||||
Polyhedron::Face_handle f = (intersect->second).first;
|
||||
#endif
|
||||
|
||||
intersections[edgeI].append
|
||||
(
|
||||
@ -665,18 +669,24 @@ labelPair edgeIntersectionsCGAL
|
||||
);
|
||||
// Intersection on edge interior
|
||||
classifications[edgeI].append(-1);
|
||||
nPoints++;
|
||||
++nPoints;
|
||||
}
|
||||
else if
|
||||
(
|
||||
const Segment* sPtr = boost::get<Segment>(&((*iter)->first))
|
||||
const Segment* sPtr = boost::get<Segment>(&(intersect->first))
|
||||
)
|
||||
{
|
||||
#if defined (CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1041400000)
|
||||
Polyhedron::Face_handle f = (intersect->second);
|
||||
#else
|
||||
// 1.14 and later
|
||||
Polyhedron::Face_handle f = (intersect->second).first;
|
||||
#endif
|
||||
|
||||
//std::cout
|
||||
// << "intersection object is a segment:" << sPtr->source()
|
||||
// << " " << sPtr->target() << std::endl;
|
||||
|
||||
Polyhedron::Face_handle f = (*iter)->second;
|
||||
//std::cout<< "triangle:" << f->index
|
||||
// << " region:" << f->region << std::endl;
|
||||
|
||||
@ -706,7 +716,7 @@ labelPair edgeIntersectionsCGAL
|
||||
);
|
||||
// Intersection aligned with face. Tbd: enums
|
||||
classifications[edgeI].append(2);
|
||||
nSegments++;
|
||||
++nSegments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
bunnylod/progmesh.C
|
||||
bunnylod/vector.C
|
||||
bunnylod/progmesh.cxx
|
||||
bunnylod/vector.cxx
|
||||
surfaceCoarsen.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/surfaceCoarsen
|
||||
|
||||
@ -7,3 +7,14 @@ The PC executable bunnylod.exe should run
|
||||
on a standard PC.
|
||||
Just run it and enjoy.
|
||||
Mouse dragging spins the rabbit.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Changes
|
||||
|
||||
2020-04-16 OpenCFD Ltd
|
||||
- remove MSWindows components (code and makefiles)
|
||||
- use cxx, hxx extensions to reduce possible confusion with other
|
||||
"list" and "vector" classes
|
||||
- use C++ versions for C headers
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
@ -1,282 +0,0 @@
|
||||
/*
|
||||
* Polygon Reduction Demo by Stan Melax (c) 1998
|
||||
* Permission to use any of this code wherever you want is granted..
|
||||
* Although, please do acknowledge authorship if appropriate.
|
||||
*
|
||||
* This module initializes the bunny model data and calls
|
||||
* the polygon reduction routine. At each frame the RenderModel()
|
||||
* routine is called to draw the model. This module also
|
||||
* animates the parameters (such as number of vertices to
|
||||
* use) to show the model at various levels of detail.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <GL/gl.h>
|
||||
#pragma warning(disable : 4244)
|
||||
|
||||
#include "vector.h"
|
||||
#include "font.h"
|
||||
#include "progmesh.h"
|
||||
#include "rabdata.h"
|
||||
|
||||
extern float DeltaT; // change in time since last frame
|
||||
int render_num; // number of vertices to draw with
|
||||
float lodbase=0.5f; // the fraction of vertices used to morph toward
|
||||
float morph=1.0f; // where to render between 2 levels of detail
|
||||
List<Vector> vert; // global list of vertices
|
||||
List<tridata> tri; // global list of triangles
|
||||
List<int> collapse_map; // to which neighbor each vertex collapses
|
||||
int renderpolycount=0; // polygons rendered in the current frame
|
||||
Vector model_position; // position of bunny
|
||||
Quaternion model_orientation; // orientation of bunny
|
||||
|
||||
// Note that the use of the Map() function and the collapse_map
|
||||
// list isn't part of the polygon reduction algorithm.
|
||||
// We just set up this system here in this module
|
||||
// so that we could retrieve the model at any desired vertex count.
|
||||
// Therefore if this part of the program confuses you, then
|
||||
// dont worry about it. It might help to look over the progmesh.cpp
|
||||
// module first.
|
||||
|
||||
// Map()
|
||||
//
|
||||
// When the model is rendered using a maximum of mx vertices
|
||||
// then it is vertices 0 through mx-1 that are used.
|
||||
// We are able to do this because the vertex list
|
||||
// gets sorted according to the collapse order.
|
||||
// The Map() routine takes a vertex number 'a' and the
|
||||
// maximum number of vertices 'mx' and returns the
|
||||
// appropriate vertex in the range 0 to mx-1.
|
||||
// When 'a' is greater than 'mx' the Map() routine
|
||||
// follows the chain of edge collapses until a vertex
|
||||
// within the limit is reached.
|
||||
// An example to make this clear: assume there is
|
||||
// a triangle with vertices 1, 3 and 12. But when
|
||||
// rendering the model we limit ourselves to 10 vertices.
|
||||
// In that case we find out how vertex 12 was removed
|
||||
// by the polygon reduction algorithm. i.e. which
|
||||
// edge was collapsed. Lets say that vertex 12 was collapsed
|
||||
// to vertex number 7. This number would have been stored
|
||||
// in the collapse_map array (i.e. collapse_map[12]==7).
|
||||
// Since vertex 7 is in range (less than max of 10) we
|
||||
// will want to render the triangle 1,3,7.
|
||||
// Pretend now that we want to limit ourselves to 5 vertices.
|
||||
// and vertex 7 was collapsed to vertex 3
|
||||
// (i.e. collapse_map[7]==3). Then triangle 1,3,12 would now be
|
||||
// triangle 1,3,3. i.e. this polygon was removed by the
|
||||
// progressive mesh polygon reduction algorithm by the time
|
||||
// it had gotten down to 5 vertices.
|
||||
// No need to draw a one dimensional polygon. :-)
|
||||
int Map(int a,int mx) {
|
||||
if(mx<=0) return 0;
|
||||
while(a>=mx) {
|
||||
a=collapse_map[a];
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
void DrawModelTriangles() {
|
||||
assert(collapse_map.num);
|
||||
renderpolycount=0;
|
||||
int i=0;
|
||||
for(i=0;i<tri.num;i++) {
|
||||
int p0= Map(tri[i].v[0],render_num);
|
||||
int p1= Map(tri[i].v[1],render_num);
|
||||
int p2= Map(tri[i].v[2],render_num);
|
||||
// note: serious optimization opportunity here,
|
||||
// by sorting the triangles the following "continue"
|
||||
// could have been made into a "break" statement.
|
||||
if(p0==p1 || p1==p2 || p2==p0) continue;
|
||||
renderpolycount++;
|
||||
// if we are not currenly morphing between 2 levels of detail
|
||||
// (i.e. if morph=1.0) then q0,q1, and q2 are not necessary.
|
||||
int q0= Map(p0,(int)(render_num*lodbase));
|
||||
int q1= Map(p1,(int)(render_num*lodbase));
|
||||
int q2= Map(p2,(int)(render_num*lodbase));
|
||||
Vector v0,v1,v2;
|
||||
v0 = vert[p0]*morph + vert[q0]*(1-morph);
|
||||
v1 = vert[p1]*morph + vert[q1]*(1-morph);
|
||||
v2 = vert[p2]*morph + vert[q2]*(1-morph);
|
||||
glBegin(GL_POLYGON);
|
||||
// the purpose of the demo is to show polygons
|
||||
// therefore just use 1 face normal (flat shading)
|
||||
Vector nrml = (v1-v0) * (v2-v1); // cross product
|
||||
if(0<magnitude(nrml)) {
|
||||
glNormal3fv(normalize(nrml));
|
||||
}
|
||||
glVertex3fv(v0);
|
||||
glVertex3fv(v1);
|
||||
glVertex3fv(v2);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PermuteVertices(List<int> &permutation) {
|
||||
// rearrange the vertex list
|
||||
List<Vector> temp_list;
|
||||
int i;
|
||||
assert(permutation.num==vert.num);
|
||||
for(i=0;i<vert.num;i++) {
|
||||
temp_list.Add(vert[i]);
|
||||
}
|
||||
for(i=0;i<vert.num;i++) {
|
||||
vert[permutation[i]]=temp_list[i];
|
||||
}
|
||||
// update the changes in the entries in the triangle list
|
||||
for(i=0;i<tri.num;i++) {
|
||||
for(int j=0;j<3;j++) {
|
||||
tri[i].v[j] = permutation[tri[i].v[j]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetRabbitData(){
|
||||
// Copy the geometry from the arrays of data in rabdata.cpp into
|
||||
// the vert and tri lists which we send to the reduction routine
|
||||
int i;
|
||||
for(i=0;i<RABBIT_VERTEX_NUM;i++) {
|
||||
float *vp=rabbit_vertices[i];
|
||||
vert.Add(Vector(vp[0],vp[1],vp[2]));
|
||||
}
|
||||
for(i=0;i<RABBIT_TRIANGLE_NUM;i++) {
|
||||
tridata td;
|
||||
td.v[0]=rabbit_triangles[i][0];
|
||||
td.v[1]=rabbit_triangles[i][1];
|
||||
td.v[2]=rabbit_triangles[i][2];
|
||||
tri.Add(td);
|
||||
}
|
||||
render_num=vert.num; // by default lets use all the model to render
|
||||
}
|
||||
|
||||
|
||||
void InitModel() {
|
||||
List<int> permutation;
|
||||
GetRabbitData();
|
||||
ProgressiveMesh(vert,tri,collapse_map,permutation);
|
||||
PermuteVertices(permutation);
|
||||
model_position = Vector(0,0,-3);
|
||||
Quaternion yaw(Vector(0,1,0),-3.14f/4); // 45 degrees
|
||||
Quaternion pitch(Vector(1,0,0),3.14f/12); // 15 degrees
|
||||
model_orientation = pitch*yaw;
|
||||
}
|
||||
|
||||
void StatusDraw() {
|
||||
// Draw a slider type widget looking thing
|
||||
// to show portion of vertices being used
|
||||
float b = (float)render_num/(float)vert.num;
|
||||
float a = b*(lodbase );
|
||||
glDisable(GL_LIGHTING);
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(-0.15,15,-0.1,1.1,-0.1,100);
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1,0,0);
|
||||
glVertex2f(0,0);
|
||||
glVertex2f(1,0);
|
||||
glVertex2f(1,a);
|
||||
glVertex2f(0,a);
|
||||
glEnd();
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1,0,0);
|
||||
glVertex2f(0,a);
|
||||
glVertex2f(morph,a);
|
||||
glVertex2f(morph,b);
|
||||
glVertex2f(0,b);
|
||||
glEnd();
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(0,0,1);
|
||||
glVertex2f(morph,a);
|
||||
glVertex2f(1,a);
|
||||
glVertex2f(1,b);
|
||||
glVertex2f(morph,b);
|
||||
glEnd();
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(0,0,1);
|
||||
glVertex2f(0,b);
|
||||
glVertex2f(1,b);
|
||||
glVertex2f(1,1);
|
||||
glVertex2f(0,1);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPopMatrix();
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
}
|
||||
|
||||
/*
|
||||
* The following is just a quick hack to animate
|
||||
* the object through various polygon reduced versions.
|
||||
*/
|
||||
struct keyframethings {
|
||||
float t; // timestamp
|
||||
float n; // portion of vertices used to start
|
||||
float dn; // rate of change in "n"
|
||||
float m; // morph value
|
||||
float dm; // rate of change in "m"
|
||||
} keys[]={
|
||||
{0 ,1 ,0 ,1, 0},
|
||||
{2 ,1 ,-1,1, 0},
|
||||
{10,0 ,1 ,1, 0},
|
||||
{18,1 ,0 ,1, 0},
|
||||
{20,1 ,0 ,1,-1},
|
||||
{24,0.5 ,0 ,1, 0},
|
||||
{26,0.5 ,0 ,1,-1},
|
||||
{30,0.25,0 ,1, 0},
|
||||
{32,0.25,0 ,1,-1},
|
||||
{36,0.125,0,1, 0},
|
||||
{38,0.25,0 ,0, 1},
|
||||
{42,0.5 ,0 ,0, 1},
|
||||
{46,1 ,0 ,0, 1},
|
||||
{50,1 ,0 ,1, 0},
|
||||
};
|
||||
void AnimateParameters() {
|
||||
static float time=0; // global time - used for animation
|
||||
time+=DeltaT;
|
||||
if(time>=50) time=0; // repeat cycle every so many seconds
|
||||
int k=0;
|
||||
while(time>keys[k+1].t) {
|
||||
k++;
|
||||
}
|
||||
float interp = (time-keys[k].t)/(keys[k+1].t-keys[k].t);
|
||||
render_num = vert.num*(keys[k].n + interp*keys[k].dn);
|
||||
morph = keys[k].m + interp*keys[k].dm;
|
||||
morph = (morph>1.0f) ? 1.0f : morph; // clamp value
|
||||
if(render_num>vert.num) render_num=vert.num;
|
||||
if(render_num<0 ) render_num=0;
|
||||
}
|
||||
|
||||
void RenderModel() {
|
||||
AnimateParameters();
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glColor3f(1,1,1);
|
||||
glPushMatrix();
|
||||
glTranslatef(model_position.x,model_position.y,model_position.z);
|
||||
// Rotate by quaternion: model_orientation
|
||||
Vector axis=model_orientation.axis();
|
||||
float angle=model_orientation.angle()*180.0f/3.14f;
|
||||
glRotatef(angle,axis.x,axis.y,axis.z);
|
||||
DrawModelTriangles();
|
||||
StatusDraw();
|
||||
glPopMatrix();
|
||||
|
||||
char buf[256];
|
||||
sprintf(buf,"Polys: %d Vertices: %d ",renderpolycount,render_num);
|
||||
if(morph<1.0) {
|
||||
sprintf(buf+strlen(buf),"<-> %d morph: %4.2f ",
|
||||
(int)(lodbase *render_num),morph);
|
||||
}
|
||||
PostString(buf,0,-2,5);
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="bunnylod" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=bunnylod - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "bunnylod.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "bunnylod.mak" CFG="bunnylod - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "bunnylod - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "bunnylod - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "bunnylod - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib winmm.lib /nologo /subsystem:windows /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "bunnylod - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "bunnylod - Win32 Release"
|
||||
# Name "bunnylod - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bunnygut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\font.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\progmesh.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\rabdata.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winmain.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "bunnylod"=.\bunnylod.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
void PrintString(char *s,int x=0,int y=-1);
|
||||
void PostString(char *_s,int _x,int _y,float _life=5.0);
|
||||
void RenderStrings();
|
||||
|
||||
#endif
|
||||
@ -1,13 +1,16 @@
|
||||
/*
|
||||
* -*- C++ -*-
|
||||
*
|
||||
* A generic template list class.
|
||||
* Fairly typical of the list example you would
|
||||
* find in any c++ book.
|
||||
*/
|
||||
|
||||
#ifndef GENERIC_LIST_H
|
||||
#define GENERIC_LIST_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
|
||||
template<class Type> class List {
|
||||
public:
|
||||
@ -123,8 +126,4 @@ void List<Type>::Remove(Type t){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -1,4 +1,6 @@
|
||||
/*
|
||||
* -*- C++ -*-
|
||||
*
|
||||
* Progressive Mesh type Polygon Reduction Algorithm
|
||||
* by Stan Melax (c) 1998
|
||||
* Permission to use any of this code wherever you want is granted..
|
||||
@ -7,15 +9,14 @@
|
||||
* See the header file progmesh.h for a description of this module
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
//#include <windows.h>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "vector.h"
|
||||
#include "list.h"
|
||||
#include "progmesh.h"
|
||||
#include "vector.hxx"
|
||||
#include "list.hxx"
|
||||
#include "progmesh.hxx"
|
||||
|
||||
#define min(x,y) (((x) <= (y)) ? (x) : (y))
|
||||
#define max(x,y) (((x) >= (y)) ? (x) : (y))
|
||||
@ -1,4 +1,6 @@
|
||||
/*
|
||||
* -*- C++ -*-
|
||||
*
|
||||
* Progressive Mesh type Polygon Reduction Algorithm
|
||||
* by Stan Melax (c) 1998
|
||||
*
|
||||
@ -18,8 +20,8 @@
|
||||
#ifndef PROGRESSIVE_MESH_H
|
||||
#define PROGRESSIVE_MESH_H
|
||||
|
||||
#include "vector.h"
|
||||
#include "list.h"
|
||||
#include "vector.hxx"
|
||||
#include "list.hxx"
|
||||
|
||||
class tridata {
|
||||
public:
|
||||
@ -1,8 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
#include <cassert>
|
||||
|
||||
#include "vector.h"
|
||||
#include "vector.hxx"
|
||||
|
||||
float sqr(float a) {return a*a;}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This module contains a bunch of well understood functions
|
||||
// I apologise if the conventions used here are slightly
|
||||
@ -7,8 +8,8 @@
|
||||
#ifndef GENERIC_VECTOR_H
|
||||
#define GENERIC_VECTOR_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
class Vector {
|
||||
@ -1,453 +0,0 @@
|
||||
/*
|
||||
* Polygon Reduction Demo by Stan Melax (c) 1998
|
||||
* Permission to use any of this code wherever you want is granted..
|
||||
* Although, please do acknowledge authorship if appropriate.
|
||||
*
|
||||
* This module contains the window setup code, mouse input, timing
|
||||
* routines, and that sort of stuff. The interesting modules
|
||||
* to see are bunnygut.cpp and progmesh.cpp.
|
||||
*
|
||||
* The windows 95 specific code for this application was taken from
|
||||
* an example of processing mouse events in an OpenGL program using
|
||||
* the Win32 API from the www.opengl.org web site.
|
||||
*
|
||||
* Under Project->Settings, Link Options, General Category
|
||||
* Add:
|
||||
* Opengl32.lib glu32.lib winmm.lib
|
||||
* to the Object/Library Modules
|
||||
*
|
||||
* You will need have OpenGL libs and include files to compile this
|
||||
* Go to the www.opengl.org web site if you need help with this.
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h> /* must include this before GL/gl.h */
|
||||
#include <GL/gl.h> /* OpenGL header file */
|
||||
#include <GL/glu.h> /* OpenGL utilities header file */
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "vector.h"
|
||||
#include "font.h"
|
||||
|
||||
// Functions and Variables from bunny module
|
||||
extern void InitModel();
|
||||
extern void RenderModel();
|
||||
extern Vector model_position; // position of bunny
|
||||
extern Quaternion model_orientation; // orientation of bunny
|
||||
|
||||
// Global Variables
|
||||
float DeltaT = 0.1f;
|
||||
float FPS;
|
||||
int Width = 512;
|
||||
int Height = 512;
|
||||
int MouseX = 0;
|
||||
int MouseY = 0;
|
||||
Vector MouseVector; // 3D direction mouse points
|
||||
Vector OldMouseVector;
|
||||
int MouseState=0; // true iff left button down
|
||||
float ViewAngle=45.0f;
|
||||
|
||||
HDC hDC; /* device context */
|
||||
HPALETTE hPalette = 0; /* custom palette (if needed) */
|
||||
|
||||
|
||||
void CalcFPSDeltaT(){
|
||||
static int timeinit=0;
|
||||
static int start,start2,current,last;
|
||||
static int frame=0, frame2=0;
|
||||
if(!timeinit){
|
||||
frame=0;
|
||||
start=timeGetTime();
|
||||
timeinit=1;
|
||||
}
|
||||
frame++;
|
||||
frame2++;
|
||||
current=timeGetTime(); // found in winmm.lib
|
||||
double dif=(double)(current-start)/CLOCKS_PER_SEC;
|
||||
double rv = (dif)? (double)frame/(double)dif:-1.0;
|
||||
if(dif>2.0 && frame >10) {
|
||||
start = start2;
|
||||
frame = frame2;
|
||||
start2 = timeGetTime();
|
||||
frame2 = 0;
|
||||
}
|
||||
DeltaT = (float)(current-last)/CLOCKS_PER_SEC;
|
||||
if(current==last) {
|
||||
DeltaT = 0.1f/CLOCKS_PER_SEC; // it just cant be 0
|
||||
}
|
||||
// if(DeltaT>1.0) DeltaT=1.0;
|
||||
FPS = (float)rv;
|
||||
last = current;
|
||||
}
|
||||
|
||||
|
||||
void ComputeMouseVector(){
|
||||
OldMouseVector=MouseVector;
|
||||
float spread = (float)tan(ViewAngle/2*3.14/180);
|
||||
float y = spread * ((Height-MouseY)-Height/2.0f) /(Height/2.0f);
|
||||
float x = spread * (MouseX-Width/2.0f) /(Height/2.0f);
|
||||
Vector v(x ,y,-1);
|
||||
// v=UserOrientation *v;
|
||||
v=normalize(v);
|
||||
MouseVector = v;
|
||||
}
|
||||
|
||||
Quaternion VirtualTrackBall(Vector cop,Vector cor,Vector dir1,Vector dir2) {
|
||||
// Implement track ball functionality to spin stuf on the screen
|
||||
// cop center of projection
|
||||
// cor center of rotation
|
||||
// dir1 old mouse direction
|
||||
// dir2 new mouse direction
|
||||
// pretend there is a sphere around cor. Then find the points
|
||||
// where dir1 and dir2 intersect that sphere. Find the
|
||||
// rotation that takes the first point to the second.
|
||||
float m;
|
||||
// compute plane
|
||||
Vector nrml = cor - cop;
|
||||
// since trackball proportional to distance from cop
|
||||
float fudgefactor = 1.0f/(magnitude(nrml) * 0.25f);
|
||||
nrml = normalize(nrml);
|
||||
float dist = -(nrml^cor);
|
||||
Vector u= planelineintersection(nrml,dist,cop,cop+dir1);
|
||||
u=u-cor;
|
||||
u=u*fudgefactor;
|
||||
m= magnitude(u);
|
||||
if(m>1) {u=u*1.0f/m;}
|
||||
else {
|
||||
u=u - (nrml * (float)sqrt(1-m*m));
|
||||
}
|
||||
Vector v= planelineintersection(nrml,dist,cop,cop+dir2);
|
||||
v=v-cor;
|
||||
v=v*fudgefactor;
|
||||
m= magnitude(v);
|
||||
if(m>1) {v=v*1.0f/m;}
|
||||
else {
|
||||
v=v - (nrml * (float)sqrt(1-m*m));
|
||||
}
|
||||
Vector axis = u*v;
|
||||
float angle;
|
||||
m=magnitude(axis);
|
||||
if(m>1)m=1; // avoid potential floating point error
|
||||
Quaternion q(Vector(1.0f,0.0f,0.0f),0.0f);
|
||||
if(m>0 && (angle=(float)asin(m))>3.14/180) {
|
||||
axis = normalize(axis);
|
||||
q=Quaternion(axis,angle);
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
void SpinIt(){
|
||||
// Change the orientation of the bunny according to mouse drag
|
||||
Quaternion q=VirtualTrackBall(Vector(0,0,0),model_position,
|
||||
OldMouseVector,MouseVector);
|
||||
model_orientation=q*model_orientation;
|
||||
}
|
||||
|
||||
void Reshape(int width, int height){
|
||||
// called initially and when the window changes size
|
||||
Width=width;
|
||||
Height=height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(ViewAngle, (float)width/height, 0.1, 50.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
void PrintStats(){
|
||||
char buf[1024];buf[0]='\0';
|
||||
sprintf(buf,"FPS: %5.2f ",FPS);
|
||||
PostString(buf,0,-1,0);
|
||||
}
|
||||
|
||||
void Display(){
|
||||
// main drawing routine - called every frame
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
// camera at default (zero) position and orientation
|
||||
RenderModel();
|
||||
PrintStats();
|
||||
glLoadIdentity();
|
||||
RenderStrings();
|
||||
glPopMatrix();
|
||||
glFlush();
|
||||
SwapBuffers(hDC); /* nop if singlebuffered */
|
||||
}
|
||||
|
||||
|
||||
LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static PAINTSTRUCT ps;
|
||||
static GLboolean left = GL_FALSE; /* left button currently down? */
|
||||
static GLboolean right = GL_FALSE; /* right button currently down? */
|
||||
static int omx, omy, mx, my;
|
||||
|
||||
switch(uMsg) {
|
||||
case WM_PAINT:
|
||||
BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
case WM_SIZE:
|
||||
Reshape(LOWORD(lParam), HIWORD(lParam));
|
||||
PostMessage(hWnd, WM_PAINT, 0, 0);
|
||||
return 0;
|
||||
case WM_CHAR:
|
||||
switch (wParam) {
|
||||
case 27: /* ESC key */
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
/* if we don't set the capture we won't get mouse move
|
||||
messages when the mouse moves outside the window. */
|
||||
SetCapture(hWnd);
|
||||
MouseX = LOWORD(lParam);
|
||||
MouseY = HIWORD(lParam);
|
||||
ComputeMouseVector();
|
||||
MouseState = 1;
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
MouseX = LOWORD(lParam);
|
||||
MouseY = HIWORD(lParam);
|
||||
if(MouseX & 1 << 15) MouseX -= (1 << 16);
|
||||
if(MouseY & 1 << 15) MouseY -= (1 << 16);
|
||||
ComputeMouseVector();
|
||||
if(MouseState) SpinIt();
|
||||
MouseState=0;
|
||||
/* remember to release the capture when we are finished. */
|
||||
ReleaseCapture();
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
MouseX = LOWORD(lParam);
|
||||
MouseY = HIWORD(lParam);
|
||||
/* Win32 is pretty braindead about the x, y position that
|
||||
it returns when the mouse is off the left or top edge
|
||||
of the window (due to them being unsigned). therefore,
|
||||
roll the Win32's 0..2^16 pointer co-ord range to the
|
||||
more amenable (and useful) 0..+/-2^15. */
|
||||
if(MouseX & 1 << 15) MouseX -= (1 << 16);
|
||||
if(MouseY & 1 << 15) MouseY -= (1 << 16);
|
||||
ComputeMouseVector();
|
||||
if(MouseState) SpinIt();
|
||||
return 0;
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
if (hWnd == (HWND)wParam) break;
|
||||
/* fall through to WM_QUERYNEWPALETTE */
|
||||
case WM_QUERYNEWPALETTE:
|
||||
if (hPalette) {
|
||||
UnrealizeObject(hPalette);
|
||||
SelectPalette(hDC, hPalette, FALSE);
|
||||
RealizePalette(hDC);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
HWND CreateOpenGLWindow(char* title)
|
||||
{
|
||||
// make a double-buffered, rgba, opengl window
|
||||
int n, pf;
|
||||
HWND hWnd;
|
||||
WNDCLASS wc;
|
||||
LOGPALETTE* lpPal;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
static HINSTANCE hInstance = 0;
|
||||
|
||||
/* only register the window class once - use hInstance as a flag. */
|
||||
if (!hInstance) {
|
||||
hInstance = GetModuleHandle(nullptr);
|
||||
wc.style = CS_OWNDC;
|
||||
wc.lpfnWndProc = (WNDPROC)WindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
|
||||
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wc.hbrBackground = nullptr;
|
||||
wc.lpszMenuName = nullptr;
|
||||
wc.lpszClassName = "OpenGL";
|
||||
|
||||
if (!RegisterClass(&wc)) {
|
||||
MessageBox(nullptr, "RegisterClass() failed: "
|
||||
"Cannot register window class.",
|
||||
"Error", MB_OK);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
hWnd = CreateWindow("OpenGL", title, WS_OVERLAPPEDWINDOW |
|
||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
0,0,Width,Height, nullptr, nullptr, hInstance, nullptr);
|
||||
|
||||
if (hWnd == nullptr) {
|
||||
MessageBox(nullptr,
|
||||
"CreateWindow() failed: Cannot create a window.",
|
||||
"Error", MB_OK);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
/* there is no guarantee that the contents of the stack that become
|
||||
the pfd are zeroed, therefore _make sure_ to clear these bits. */
|
||||
memset(&pfd, 0, sizeof(pfd));
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW
|
||||
| PFD_SUPPORT_OPENGL
|
||||
| PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cDepthBits = 32;
|
||||
pfd.cColorBits = 32;
|
||||
|
||||
pf = ChoosePixelFormat(hDC, &pfd);
|
||||
if (pf == 0) {
|
||||
MessageBox(nullptr, "ChoosePixelFormat() failed: "
|
||||
"Cannot find a suitable pixel format.",
|
||||
"Error", MB_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (SetPixelFormat(hDC, pf, &pfd) == FALSE) {
|
||||
MessageBox(nullptr, "SetPixelFormat() failed: "
|
||||
"Cannot set format specified.", "Error", MB_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DescribePixelFormat(hDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
if (pfd.dwFlags & PFD_NEED_PALETTE ||
|
||||
pfd.iPixelType == PFD_TYPE_COLORINDEX) {
|
||||
|
||||
n = 1 << pfd.cColorBits;
|
||||
if (n > 256) n = 256;
|
||||
|
||||
lpPal = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) +
|
||||
sizeof(PALETTEENTRY) * n);
|
||||
memset(lpPal, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n);
|
||||
lpPal->palVersion = 0x300;
|
||||
lpPal->palNumEntries = n;
|
||||
|
||||
GetSystemPaletteEntries(hDC, 0, n, &lpPal->palPalEntry[0]);
|
||||
|
||||
/* if the pixel type is RGBA, then we want to make an RGB ramp,
|
||||
otherwise (color index) set individual colors. */
|
||||
if (pfd.iPixelType == PFD_TYPE_RGBA) {
|
||||
int redMask = (1 << pfd.cRedBits) - 1;
|
||||
int greenMask = (1 << pfd.cGreenBits) - 1;
|
||||
int blueMask = (1 << pfd.cBlueBits) - 1;
|
||||
int i;
|
||||
|
||||
/* fill in the entries with an RGB color ramp. */
|
||||
for (i = 0; i < n; ++i) {
|
||||
lpPal->palPalEntry[i].peRed =
|
||||
(((i >> pfd.cRedShift) & redMask) * 255)
|
||||
/redMask;
|
||||
lpPal->palPalEntry[i].peGreen =
|
||||
(((i >> pfd.cGreenShift) & greenMask) * 255)
|
||||
/greenMask;
|
||||
lpPal->palPalEntry[i].peBlue =
|
||||
(((i >> pfd.cBlueShift) & blueMask) * 255)
|
||||
/blueMask;
|
||||
lpPal->palPalEntry[i].peFlags = 0;
|
||||
}
|
||||
} else {
|
||||
lpPal->palPalEntry[0].peRed = 0;
|
||||
lpPal->palPalEntry[0].peGreen = 0;
|
||||
lpPal->palPalEntry[0].peBlue = 0;
|
||||
lpPal->palPalEntry[0].peFlags = PC_NOCOLLAPSE;
|
||||
lpPal->palPalEntry[1].peRed = 255;
|
||||
lpPal->palPalEntry[1].peGreen = 0;
|
||||
lpPal->palPalEntry[1].peBlue = 0;
|
||||
lpPal->palPalEntry[1].peFlags = PC_NOCOLLAPSE;
|
||||
lpPal->palPalEntry[2].peRed = 0;
|
||||
lpPal->palPalEntry[2].peGreen = 255;
|
||||
lpPal->palPalEntry[2].peBlue = 0;
|
||||
lpPal->palPalEntry[2].peFlags = PC_NOCOLLAPSE;
|
||||
lpPal->palPalEntry[3].peRed = 0;
|
||||
lpPal->palPalEntry[3].peGreen = 0;
|
||||
lpPal->palPalEntry[3].peBlue = 255;
|
||||
lpPal->palPalEntry[3].peFlags = PC_NOCOLLAPSE;
|
||||
}
|
||||
|
||||
hPalette = CreatePalette(lpPal);
|
||||
if (hPalette) {
|
||||
SelectPalette(hDC, hPalette, FALSE);
|
||||
RealizePalette(hDC);
|
||||
}
|
||||
|
||||
free(lpPal);
|
||||
}
|
||||
|
||||
ReleaseDC(hDC, hWnd);
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst,
|
||||
LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
HGLRC hRC; /* opengl context */
|
||||
HWND hWnd; /* window */
|
||||
MSG msg; /* message */
|
||||
|
||||
// InitModel() initializes some data structures and
|
||||
// does the progressive mesh polygon reduction algorithm
|
||||
// on the model.
|
||||
CalcFPSDeltaT(); // to time the algorithm
|
||||
InitModel();
|
||||
CalcFPSDeltaT();
|
||||
|
||||
hWnd = CreateOpenGLWindow("bunnylod by Stan Melax");
|
||||
if (hWnd == nullptr) exit(1);
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
hRC = wglCreateContext(hDC);
|
||||
wglMakeCurrent(hDC, hRC);
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
PostString("Demo by Stan Melax (c)1998",5,-5,20);
|
||||
PostString("Model by Viewpoint Datalabs (c)1996",5,-4,20);
|
||||
char buf[128];
|
||||
PostString("Mesh Reduction Algorithm (non-optimized)",1,0,5);
|
||||
sprintf(buf,"was executed in %5.3f seconds",DeltaT);
|
||||
PostString(buf,2,1,6);
|
||||
|
||||
while (1) {
|
||||
while(PeekMessage(&msg, hWnd, 0, 0, PM_NOREMOVE)) {
|
||||
if(GetMessage(&msg, hWnd, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
} else {
|
||||
// This 'goto' was in the sample code
|
||||
goto quit;
|
||||
}
|
||||
}
|
||||
CalcFPSDeltaT();
|
||||
Display();
|
||||
}
|
||||
|
||||
quit:
|
||||
wglMakeCurrent(nullptr, nullptr);
|
||||
ReleaseDC(hDC, hWnd);
|
||||
wglDeleteContext(hRC);
|
||||
DestroyWindow(hWnd);
|
||||
if (hPalette) DeleteObject(hPalette);
|
||||
return msg.wParam;
|
||||
}
|
||||
@ -50,7 +50,7 @@ Description
|
||||
#include "triFaceList.H"
|
||||
|
||||
// From bunnylod
|
||||
#include "progmesh.h"
|
||||
#include "progmesh.hxx"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
114
bin/foamEtcFile
114
bin/foamEtcFile
@ -7,14 +7,13 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# foamEtcFile
|
||||
# bin/foamEtcFile
|
||||
#
|
||||
# Description
|
||||
# Locate user/group/other file as per '#includeEtc'.
|
||||
@ -33,7 +32,13 @@
|
||||
# \endcode
|
||||
#
|
||||
# Environment
|
||||
# - WM_PROJECT_SITE (unset defaults to PROJECT/site)
|
||||
# FOAM_CONFIG_ETC
|
||||
# Alternative etc directory for shipped files
|
||||
#
|
||||
# FOAM_CONFIG_MODE
|
||||
# Fallback search mode for etc files. Unset is the same as "ugo".
|
||||
#
|
||||
# WM_PROJECT_SITE (unset defaults to PROJECT/site)
|
||||
#
|
||||
# Note
|
||||
# This script must exist in the project 'bin' directory
|
||||
@ -46,8 +51,8 @@
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: foamEtcFile [OPTION] fileName [-- args]
|
||||
foamEtcFile [OPTION] [-list|-list-test] [fileName]
|
||||
Usage: ${0##*/} [OPTION] fileName [-- args]
|
||||
${0##*/} [OPTION] [-list|-list-test] [fileName]
|
||||
|
||||
options:
|
||||
-all (-a) Return all files (otherwise stop after the first match)
|
||||
@ -61,8 +66,8 @@ options:
|
||||
-config Add config directory prefix for shell type:
|
||||
with -csh* for a config.csh/ prefix
|
||||
with -sh* for a config.sh/ prefix
|
||||
-show-api Print api value from wmake/rules, or meta-info and exit
|
||||
-show-patch Print patch value from meta-info and exit
|
||||
-show-api Print META-INFO api value and exit
|
||||
-show-patch Print META-INFO patch value and exit
|
||||
-with-api=NUM Specify alternative api value to search with
|
||||
-quiet (-q) Suppress all normal output
|
||||
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
|
||||
@ -106,64 +111,40 @@ projectDir="$(\cd $(dirname $binDir) && \pwd -L)" # Project dir
|
||||
|
||||
userDir="$HOME/.OpenFOAM" # As per foamVersion.H
|
||||
groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
|
||||
optMode=ugo # Default search = 'ugo'
|
||||
|
||||
# Environment overrides
|
||||
case "$FOAM_CONFIG_MODE" in ([ugo]*) optMode="$FOAM_CONFIG_MODE" ;; esac
|
||||
|
||||
# Verify validity of FOAM_CONFIG_ETC
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ ! -d "$FOAM_CONFIG_ETC" ] || [ "$FOAM_CONFIG_ETC" = "$projectDir/etc" ]
|
||||
then
|
||||
# Bad directory or redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# The API locations. See wmake/wmakeBuildInfo
|
||||
rulesFile="$projectDir/wmake/rules/General/general"
|
||||
metaInfoDir="$projectDir/META-INFO"
|
||||
|
||||
# Get api from rules/General/general
|
||||
#
|
||||
# Failure modes:
|
||||
# - No api information (can't find file etc).
|
||||
# -> Fatal for building, but could be OK for a stripped down version
|
||||
#
|
||||
# Fallback. Get from api-info
|
||||
#
|
||||
getApi()
|
||||
# Get a value from META-INFO/api-info
|
||||
# $1 : keyword
|
||||
getApiInfo()
|
||||
{
|
||||
local value
|
||||
|
||||
value="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' $rulesFile 2>/dev/null)"
|
||||
if [ -z "$value" ] && [ -f "$metaInfoDir/api-info" ]
|
||||
then
|
||||
# Fallback. Get from api-info
|
||||
value="$(sed -ne 's@^ *api *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
|
||||
fi
|
||||
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
echo "$value"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Get patch from meta-info / api-info
|
||||
#
|
||||
# Failure modes:
|
||||
# - No patch information (can't find file etc).
|
||||
#
|
||||
getPatchLevel()
|
||||
{
|
||||
local value
|
||||
|
||||
# Fallback. Get from api-info
|
||||
value="$(sed -ne 's@^ *patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
|
||||
value="$(sed -ne 's@^'"$1"' *= *\([0-9][0-9]*\).*@\1@p' "$projectDir"/META-INFO/api-info 2>/dev/null)"
|
||||
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
echo "$value"
|
||||
else
|
||||
echo "Could not determine OPENFOAM '$1' value" 1>&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
optMode=ugo # Default mode is always 'ugo'
|
||||
unset shellOutput verboseOutput
|
||||
unset optAll optConfig optList projectApi
|
||||
|
||||
@ -174,14 +155,12 @@ do
|
||||
-h | -help*)
|
||||
printHelp
|
||||
;;
|
||||
-show-api)
|
||||
# Show API and exit
|
||||
getApi
|
||||
-show-api) # Show API and exit
|
||||
getApiInfo api
|
||||
exit $?
|
||||
;;
|
||||
-show-patch)
|
||||
# Show patch level and exit
|
||||
getPatchLevel
|
||||
-show-patch) # Show patch level and exit
|
||||
getApiInfo patch
|
||||
exit $?
|
||||
;;
|
||||
-with-api=*)
|
||||
@ -208,7 +187,7 @@ do
|
||||
-config)
|
||||
optConfig=true
|
||||
;;
|
||||
-mode=[ugoa]*)
|
||||
-mode=[ugo]*)
|
||||
optMode="${1#*=}"
|
||||
;;
|
||||
-m | -mode)
|
||||
@ -216,7 +195,7 @@ do
|
||||
shift
|
||||
# Sanity check. Handles missing argument too.
|
||||
case "$optMode" in
|
||||
([ugoa]*)
|
||||
([ugo]*)
|
||||
;;
|
||||
(*)
|
||||
die "invalid mode '$optMode'"
|
||||
@ -257,8 +236,7 @@ done
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Establish the API value
|
||||
[ -n "$projectApi" ] || projectApi=$(getApi)
|
||||
|
||||
[ -n "$projectApi" ] || projectApi=$(getApiInfo api)
|
||||
|
||||
# Split arguments into filename (for searching) and trailing bits for shell eval
|
||||
# Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile)
|
||||
@ -293,23 +271,23 @@ fi
|
||||
|
||||
# Define the various places to be searched:
|
||||
unset dirList
|
||||
case "$optMode" in (*[au]*) # (A)ll or (U)ser
|
||||
case "$optMode" in (*[u]*) # (U)ser
|
||||
dirList="$dirList $userDir/$projectApi $userDir"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$optMode" in (*[ag]*) # (A)ll or (G)roup == site
|
||||
case "$optMode" in (*[g]*) # (G)roup == site
|
||||
dirList="$dirList $groupDir/$projectApi/etc $groupDir/etc"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$optMode" in (*[ao]*) # (A)ll or (O)ther == shipped
|
||||
dirList="$dirList $projectDir/etc"
|
||||
case "$optMode" in (*[o]*) # (O)ther == shipped
|
||||
dirList="$dirList $FOAM_CONFIG_ETC $projectDir/etc"
|
||||
;;
|
||||
esac
|
||||
set -- $dirList
|
||||
|
||||
[ "$#" -ge 1 ] || die "No directories to scan. Programming error?"
|
||||
[ "$#" -ge 1 ] || die "No directories to scan. Programming or user error?"
|
||||
exitCode=2 # Fallback is a FileNotFound error
|
||||
|
||||
|
||||
@ -318,7 +296,7 @@ exitCode=2 # Fallback is a FileNotFound error
|
||||
#
|
||||
|
||||
# Special handling of config.sh/ , config.csh/ directories
|
||||
if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ]
|
||||
if [ -n "$optConfig" ] && [ -n "$shellOutput" ] && [ -n "$fileName" ]
|
||||
then
|
||||
case "$shellOutput" in
|
||||
csh*)
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
# or {user,site} locations and copy it into the case directory.
|
||||
#
|
||||
# Environment
|
||||
# FOAM_API
|
||||
# FOAM_CONFIG_ETC
|
||||
# WM_PROJECT_DIR
|
||||
# WM_PROJECT_SITE
|
||||
#
|
||||
@ -81,9 +81,7 @@ die()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
projectDir="$WM_PROJECT_DIR" # Project dir
|
||||
userDir="$HOME/.OpenFOAM" # As per foamVersion.H
|
||||
groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
|
||||
projectApi="$FOAM_API"
|
||||
unset projectApi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@ -163,20 +161,12 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# No api specified -with-api= or from environment (FOAM_API)
|
||||
if [ -z "$projectApi" ]
|
||||
then
|
||||
projectApi="$(foamEtcFile -show-api 2>/dev/null)"
|
||||
fi
|
||||
# The places to be searched.
|
||||
# Like foamEtcFile, but "etc/caseDicts/" for the projectDir
|
||||
|
||||
|
||||
# Define the various places to be searched.
|
||||
# Similar to foamEtcFile, but with etc/caseDicts/ for the projectDir
|
||||
# Filter out nonexistent directories later
|
||||
|
||||
searchDirs="${projectApi:+$userDir/$projectApi} $userDir \
|
||||
${projectApi:+$groupDir/$projectApi/etc} $groupDir/etc \
|
||||
$projectDir/etc/caseDicts";
|
||||
searchDirs="\
|
||||
$("$projectDir"/bin/foamEtcFile -list-test -mode=ug ${projectApi:+-with-api=$projectApi} 2>/dev/null) \
|
||||
$("$projectDir"/bin/foamEtcFile -list -mode=o caseDicts 2>/dev/null)";
|
||||
|
||||
## echo "Using <$searchDirs>" 1>&2
|
||||
|
||||
|
||||
13
bin/foamLog
13
bin/foamLog
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -38,8 +39,6 @@
|
||||
#------------------------------------------------------------------------------
|
||||
Script="${0##*/}"
|
||||
toolsDir="${0%/*}/tools"
|
||||
groupDir="${WM_PROJECT_SITE:-${WM_PROJECT_DIR:-<unknown>}/site}"
|
||||
userDir="$HOME/.OpenFOAM"
|
||||
|
||||
usage() {
|
||||
exec 1>&2
|
||||
@ -91,13 +90,9 @@ cat <<HELP
|
||||
The value taken will be the first (non-space)word after this column.
|
||||
|
||||
The database ($Script.db) will taken from these locations:
|
||||
.
|
||||
$userDir/$FOAM_API/
|
||||
$userDir/
|
||||
$groupDir/$FOAM_API/etc/
|
||||
$groupDir/etc/
|
||||
$WM_PROJECT_DIR/etc/
|
||||
$toolsDir
|
||||
./
|
||||
$(foamEtcFile -list | sed -e 's#^# #')
|
||||
$toolsDir
|
||||
|
||||
option -quiet : suppresses the default information and only prints the
|
||||
extracted variables.
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -32,7 +33,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
DIR="$FOAM_ETC/codeTemplates/app"
|
||||
DIR="$WM_PROJECT_DIR/etc/codeTemplates/app"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -32,7 +33,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
DIR="$FOAM_ETC/codeTemplates/BC"
|
||||
DIR="$WM_PROJECT_DIR/etc/codeTemplates/BC"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -33,7 +34,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
DIR="$FOAM_ETC/codeTemplates/functionObject"
|
||||
DIR="$WM_PROJECT_DIR/etc/codeTemplates/functionObject"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
|
||||
272
bin/tools/create-mpi-config
Executable file
272
bin/tools/create-mpi-config
Executable file
@ -0,0 +1,272 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# bin/tools/create-mpi-config
|
||||
#
|
||||
# Description
|
||||
# Define hard-coded packaging settings for MPI flavours,
|
||||
# primarily for system openmpi.
|
||||
# This eliminates a runtime dependency on mpicc, for example.
|
||||
#
|
||||
# Instead of querying/parsing 'mpicc --showme:link' each time,
|
||||
# it is done once during packaging.
|
||||
#
|
||||
# Environment
|
||||
# FOAM_MPI, MPI_ARCH_PATH, DEB_TARGET_MULTIARCH
|
||||
#
|
||||
# Possible Dependencies
|
||||
# - dpkg-architecture
|
||||
# - mpicc
|
||||
#
|
||||
# Notes
|
||||
# Run from top-level directory when creating config files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
printHelp() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
|
||||
usage: ${0##*/} options
|
||||
|
||||
options:
|
||||
-dry-run Report but do not write config files
|
||||
-no-mpicc Bypass any use of mpicc
|
||||
-query-openmpi Report installation directory for system openmpi
|
||||
-write-openmpi Query system openmpi and write config files
|
||||
-write Write config files using FOAM_MPI, MPI_ARCH_PATH
|
||||
|
||||
Define hard-coded packaging settings for MPI flavours.
|
||||
|
||||
Equivalent options:
|
||||
-write-system-openmpi | -write-openmpi
|
||||
-query-system-openmpi | -query-openmpi
|
||||
|
||||
USAGE
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
exec 1>&2
|
||||
echo
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Options
|
||||
unset optDryRun
|
||||
useMpicc=true
|
||||
|
||||
# Get installation directory for system openmpi
|
||||
# - from "mpicc --showme:link"
|
||||
# - manual fallback
|
||||
#
|
||||
# The mpicc content looks like this:
|
||||
# ----
|
||||
# -pthread -L/usr/lib64/mpi/gcc/openmpi/lib64 -lmpi
|
||||
# ----
|
||||
|
||||
query_system_openmpi()
|
||||
{
|
||||
unset arch_path
|
||||
|
||||
if [ "$useMpicc" = true ]
|
||||
then
|
||||
arch_path=$(mpicc --showme:link 2>/dev/null | sed -e 's#^.*-L\([^ ]*\).*#\1#')
|
||||
arch_path="${arch_path%/*}"
|
||||
|
||||
if [ -n "$arch_path" ]
|
||||
then
|
||||
echo "$arch_path"
|
||||
return 0 # Clean exit
|
||||
fi
|
||||
|
||||
echo "No mpicc found. Attempt manually" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
# Manual discovery
|
||||
if [ -z "$DEB_TARGET_MULTIARCH" ]
|
||||
then
|
||||
DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
# Include is under /usr/lib... (eg, debian, openSUSE)
|
||||
for testdir in \
|
||||
/usr/lib/"${DEB_TARGET_MULTIARCH:+${DEB_TARGET_MULTIARCH}/}"openmpi/include \
|
||||
/usr/lib64/mpi/gcc/openmpi/include \
|
||||
;
|
||||
do
|
||||
if [ -e "$testdir/mpi.h" ]
|
||||
then
|
||||
echo "${testdir%/*}"
|
||||
return 0 # Clean exit
|
||||
fi
|
||||
done
|
||||
|
||||
# Include is under /usr/include (eg, RedHat)
|
||||
for testdir in \
|
||||
/usr/include/openmpi-"$(uname -m)" \
|
||||
/usr/include/openmpi \
|
||||
;
|
||||
do
|
||||
if [ -e "$testdir/mpi.h" ]
|
||||
then
|
||||
echo "/usr"
|
||||
return 0 # Clean exit
|
||||
fi
|
||||
done
|
||||
|
||||
# Failed (should not happen)
|
||||
# - report '/usr', but with error code 2
|
||||
echo "/usr"
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
# Generate etc/config.{csh,sh}/MPI-TYPE files
|
||||
# based on the values for FOAM_MPI and MPI_ARCH_PATH
|
||||
|
||||
create_files()
|
||||
{
|
||||
[ -n "$FOAM_MPI" ] || die "FOAM_MPI not set"
|
||||
|
||||
if [ -d "$MPI_ARCH_PATH" ]
|
||||
then
|
||||
echo "Define $FOAM_MPI with $MPI_ARCH_PATH" 1>&2
|
||||
|
||||
case "$FOAM_MPI" in
|
||||
(openmpi-system)
|
||||
configDir="etc/config.sh"
|
||||
if [ "$optDryRun" = true ]
|
||||
then
|
||||
cat << CONTENT 1>&2
|
||||
dry-run: $configDir/$FOAM_MPI
|
||||
#
|
||||
# Packaging configured value for $FOAM_MPI
|
||||
export MPI_ARCH_PATH="$MPI_ARCH_PATH"
|
||||
|
||||
CONTENT
|
||||
elif [ -d "$configDir" ]
|
||||
then
|
||||
echo "Write $configDir/$FOAM_MPI" 1>&2
|
||||
cat << CONTENT > "$configDir/$FOAM_MPI"
|
||||
# $configDir/$FOAM_MPI
|
||||
#
|
||||
# Packaging configured value for $FOAM_MPI
|
||||
|
||||
export MPI_ARCH_PATH="$MPI_ARCH_PATH"
|
||||
#----
|
||||
CONTENT
|
||||
else
|
||||
echo "Cannot write $configDir/$FOAM_MPI - no directory" 1>&2
|
||||
fi
|
||||
|
||||
configDir="etc/config.csh"
|
||||
if [ "$optDryRun" = true ]
|
||||
then
|
||||
cat << CONTENT 1>&2
|
||||
dry-run: $configDir/$FOAM_MPI
|
||||
#
|
||||
# Packaging configured value for $FOAM_MPI
|
||||
setenv MPI_ARCH_PATH "$MPI_ARCH_PATH"
|
||||
|
||||
CONTENT
|
||||
elif [ -d "$configDir" ]
|
||||
then
|
||||
echo "Write $configDir/$FOAM_MPI" 1>&2
|
||||
cat << CONTENT > "$configDir/$FOAM_MPI"
|
||||
# $configDir/$FOAM_MPI
|
||||
#
|
||||
# Packaging configured value for $FOAM_MPI
|
||||
|
||||
setenv MPI_ARCH_PATH "$MPI_ARCH_PATH"
|
||||
#----
|
||||
CONTENT
|
||||
else
|
||||
echo "Cannot write $configDir/$FOAM_MPI - no directory" 1>&2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "Warning: $FOAM_MPI with bad MPI_ARCH_PATH: $MPI_ARCH_PATH" 1>&2
|
||||
# TBD - remove old/bad entries?
|
||||
#
|
||||
# for file in "etc/config.sh/$FOAM_MPI" "etc/config.csh/$FOAM_MPI"
|
||||
# do
|
||||
# [ -f "$file" ] && rm -f "$file"
|
||||
# done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help* | --help*)
|
||||
printHelp
|
||||
;;
|
||||
'')
|
||||
# Discard empty arguments
|
||||
;;
|
||||
|
||||
-dry-run)
|
||||
optDryRun=true
|
||||
;;
|
||||
|
||||
-no-mpicc)
|
||||
unset useMpicc
|
||||
;;
|
||||
|
||||
-query-openmpi | -query-system-openmpi)
|
||||
query_system_openmpi
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-write-openmpi | -write-system-openmpi)
|
||||
if MPI_ARCH_PATH=$(query_system_openmpi)
|
||||
then
|
||||
FOAM_MPI="openmpi-system"
|
||||
create_files
|
||||
else
|
||||
die "Failed query for system openmpi"
|
||||
fi
|
||||
;;
|
||||
|
||||
-write)
|
||||
create_files
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Ignore unknown option/argument: '$1'" 1>&2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0 # A clean exit, if we get this far
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@ -7,11 +7,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# foamConfigurePaths
|
||||
@ -20,71 +19,26 @@
|
||||
# Adjust hardcoded installation versions and paths
|
||||
# in etc/{bashrc,cshrc} and etc/config.{sh,csh}/
|
||||
#
|
||||
# Requires
|
||||
# - sed
|
||||
# - bin/foamEtcFile
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_ETC
|
||||
# Alternative etc directory for shipped files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
printHelp() {
|
||||
|
||||
usage: ${0##*/} options
|
||||
|
||||
Basic
|
||||
-project-path DIR specify 'WM_PROJECT_DIR' (eg, /opt/openfoam1806-patch1)
|
||||
-version VER specify project version (eg, v1806)
|
||||
-sp | -SP | -float32 single precision (WM_PRECISION_OPTION)
|
||||
-dp | -DP | -float64 double precision (WM_PRECISION_OPTION)
|
||||
-spdp | -SPDP mixed single/double precision
|
||||
-int32 | -int64 the 'WM_LABEL_SIZE'
|
||||
|
||||
Compiler
|
||||
-system NAME specify 'system' compiler to use (eg, Gcc, Icc,...)
|
||||
-third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...)
|
||||
-gcc VER specify 'gcc_version' for ThirdParty Gcc
|
||||
-clang VER specify 'clang_version' for ThirdParty Clang
|
||||
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
|
||||
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
||||
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
||||
|
||||
MPI
|
||||
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
|
||||
-openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI'
|
||||
-openmpi-system use system openmpi
|
||||
-openmpi-third use ThirdParty openmpi (using default version)
|
||||
|
||||
Components
|
||||
-adios VER specify 'adios2_version'
|
||||
-adios-path DIR specify 'ADIOS2_ARCH_PATH'
|
||||
-boost VER specify 'boost_version'
|
||||
-boost-path DIR specify 'BOOST_ARCH_PATH'
|
||||
-cgal ver specify 'cgal_version'
|
||||
-cgal-path DIR specify 'CGAL_ARCH_PATH'
|
||||
-cmake VER specify 'cmake_version'
|
||||
-fftw VER specify 'fffw_version'
|
||||
-fftw-path DIR specify 'FFTW_ARCH_PATH'
|
||||
-kahip VER specify 'KAHIP_VERSION'
|
||||
-kahip-path DIR specify 'KAHIP_ARCH_PATH'
|
||||
-metis ver specify 'METIS_VERSION'
|
||||
-metis-path DIR specify 'METIS_ARCH_PATH'
|
||||
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
|
||||
-scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/scotch_6.0.4)
|
||||
|
||||
Graphics
|
||||
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system)
|
||||
-paraview-qt VER specify 'ParaView_QT' (eg, qt-system)
|
||||
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1)
|
||||
-vtk VER specify 'vtk_version' (eg, VTK-7.1.0)
|
||||
-mesa VER specify 'mesa_version' (eg, mesa-13.0.1)
|
||||
|
||||
Misc
|
||||
case "$1" in
|
||||
(*compat*)
|
||||
cat<<HELP_COMPAT
|
||||
Obsolete options:
|
||||
-foamInstall DIR [obsolete]
|
||||
-projectName NAME [obsolete]
|
||||
-sigfpe|-no-sigfpe [obsolete - now under etc/controlDict]
|
||||
-archOption 32|64 [obsolete setting of 'WM_ARCH_OPTION' - edit manually]
|
||||
|
||||
|
||||
Adjusts hardcoded versions and installation paths (POSIX and C-shell).
|
||||
|
||||
|
||||
Equivalent options:
|
||||
-version -foamVersion --projectVersion
|
||||
-archOption --archOption
|
||||
@ -93,11 +47,96 @@ Equivalent options:
|
||||
-paraview-path --paraviewInstall | -paraviewInstall
|
||||
-scotch --scotchVersion | -scotchVersion
|
||||
-scotch-path --scotchArchPath | -scotchArchPath
|
||||
-system-compiler -system
|
||||
-third-compiler -third
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
HELP_COMPAT
|
||||
exit 0 # A clean exit
|
||||
;;
|
||||
esac
|
||||
|
||||
cat<<HELP_HEAD
|
||||
|
||||
usage: $0 options
|
||||
|
||||
Options
|
||||
-h | -help Display short help and exit
|
||||
-help-compat Display compatibility options and exit
|
||||
-help-full Display full help and exit
|
||||
|
||||
Basic
|
||||
-etc=DIR set FOAM_CONFIG_ETC for alternative project files
|
||||
-project-path DIR specify 'WM_PROJECT_DIR' (eg, /opt/openfoam1806-patch1)
|
||||
-version VER specify project version (eg, v1806)
|
||||
-sp | -SP | -float32 single precision (WM_PRECISION_OPTION)
|
||||
-dp | -DP | -float64 double precision (WM_PRECISION_OPTION)
|
||||
-spdp | -SPDP mixed precision (WM_PRECISION_OPTION)
|
||||
-int32 | -int64 label-size (WM_LABEL_SIZE)
|
||||
|
||||
Compiler
|
||||
-system-compiler NAME The 'system' compiler to use (eg, Gcc, Clang, Icc,...)
|
||||
-third-compiler NAME The 'ThirdParty' compiler to use (eg, Clang40,...)
|
||||
-gcc VER The 'default_gcc_version' for ThirdParty Gcc
|
||||
-clang VER The 'default_clang_version' for ThirdParty Clang
|
||||
gmp-VERSION For ThirdParty gcc (gmp-system for system library)
|
||||
mpfr-VERSION For ThirdParty gcc (mpfr-system for system library)
|
||||
mpc-VERSION For ThirdParty gcc (mpc-system for system library)
|
||||
|
||||
MPI
|
||||
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
|
||||
-openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI'
|
||||
-openmpi-system use system openmpi
|
||||
-openmpi-third use ThirdParty openmpi (using default version)
|
||||
|
||||
Components versions (ThirdParty)
|
||||
-adios VER specify 'adios2_version'
|
||||
-boost VER specify 'boost_version'
|
||||
-cgal VER specify 'cgal_version'
|
||||
-cmake VER specify 'cmake_version'
|
||||
-fftw VER specify 'fffw_version'
|
||||
-kahip VER specify 'KAHIP_VERSION'
|
||||
-metis VER specify 'METIS_VERSION'
|
||||
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
|
||||
|
||||
HELP_HEAD
|
||||
|
||||
case "$1" in
|
||||
(*full*)
|
||||
cat<<HELP_FULL
|
||||
Components specified by absolute path
|
||||
-adios-path DIR Path for 'ADIOS2_ARCH_PATH' (overrides -adios)
|
||||
-boost-path DIR Path for 'BOOST_ARCH_PATH' (overrides -boost)
|
||||
-cgal-path DIR Path for 'CGAL_ARCH_PATH' (overrides -cgal)
|
||||
-fftw-path DIR Path for 'FFTW_ARCH_PATH' (overrides -fftw)
|
||||
-kahip-path DIR Path for 'KAHIP_ARCH_PATH' (overrides -kahip)
|
||||
-metis-path DIR Path for 'METIS_ARCH_PATH' (overrides -metis)
|
||||
-scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch)
|
||||
|
||||
Graphics
|
||||
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system)
|
||||
-paraview-qt VER specify 'ParaView_QT' (eg, qt-system)
|
||||
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1)
|
||||
-llvm VER specify 'mesa_llvm'
|
||||
-mesa VER specify 'mesa_version' (eg, mesa-13.0.1)
|
||||
-vtk VER specify 'vtk_version' (eg, VTK-7.1.0)
|
||||
-llvm-path DIR Path for 'LLVM_ARCH_PATH' (overrides -llvm)
|
||||
-mesa-path DIR Path for 'MESA_ARCH_PATH' (overrides -mesa)
|
||||
-vtk-path DIR Path for 'VTK_DIR' (overrides -vtk)
|
||||
|
||||
HELP_FULL
|
||||
;;
|
||||
esac
|
||||
|
||||
cat<<HELP_TAIL_COMMON
|
||||
Adjusts hardcoded versions and installation paths (POSIX and C-shell)
|
||||
for OpenFOAM.
|
||||
|
||||
HELP_TAIL_COMMON
|
||||
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
@ -106,16 +145,32 @@ die()
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo "See '$0 -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
projectDir="$(\pwd -L)" # Project dir
|
||||
|
||||
# Check that it appears to be an OpenFOAM installation
|
||||
[ -f etc/bashrc -a -d etc/config.sh ] || \
|
||||
usage "Please run from top-level directory of installation"
|
||||
if [ -f etc/bashrc ] && [ -d "META-INFO" ]
|
||||
then
|
||||
echo "Configuring OpenFOAM ($projectDir)" 1>&2
|
||||
else
|
||||
die "Please run from the OpenFOAM top-level installation directory" \
|
||||
"No etc/bashrc or META-INFO/ found"
|
||||
fi
|
||||
|
||||
# Use foamEtcFile to locate files, but only edit shipped files
|
||||
if [ -x bin/foamEtcFile ]
|
||||
then
|
||||
_foamEtc() {
|
||||
./bin/foamEtcFile -mode=o "$@"
|
||||
}
|
||||
else
|
||||
die "No bin/foamEtcFile found in installation"
|
||||
fi
|
||||
|
||||
|
||||
# Check if argument matches the expected input. Respects case.
|
||||
@ -146,18 +201,22 @@ _inlineSed()
|
||||
local replacement="$3"
|
||||
local msg="$4"
|
||||
local cmd='/^[^#]/s@'"$regexp"'@'"$replacement"'@'
|
||||
local localFile
|
||||
|
||||
[ -f "$file" ] || {
|
||||
echo "Missing file: $file"
|
||||
exit 2 # Fatal
|
||||
}
|
||||
|
||||
# Local filename (for reporting)
|
||||
localFile="$(echo "$file" | sed -e "s#^$projectDir/##")"
|
||||
|
||||
grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \
|
||||
echo "Failed: ${msg:-replacement} in $file"
|
||||
echo "Failed: ${msg:-replacement} in $localFile"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$msg" ] && echo " $msg ($file)"
|
||||
[ -n "$msg" ] && echo " $msg ($localFile)"
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -183,7 +242,7 @@ replace()
|
||||
"$file" \
|
||||
"$key=.*" \
|
||||
"$key=$val" \
|
||||
"Replaced $key setting by '$val'"
|
||||
"Replaced $key by '$val'"
|
||||
done
|
||||
}
|
||||
|
||||
@ -206,12 +265,34 @@ replaceCsh()
|
||||
|
||||
_inlineSed \
|
||||
"$file" \
|
||||
"setenv *$key [^ #]*" \
|
||||
"setenv [ ]*$key [^ #]*" \
|
||||
"setenv $key $val" \
|
||||
"Replaced $key setenv by '$val'"
|
||||
"Replaced $key by '$val'"
|
||||
done
|
||||
}
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replace()
|
||||
replaceEtc()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
|
||||
file=$(_foamEtc "$file")
|
||||
replace $file "$@"
|
||||
}
|
||||
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replaceCsh()
|
||||
replaceEtcCsh()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
|
||||
file=$(_foamEtc "$file")
|
||||
replaceCsh $file "$@"
|
||||
}
|
||||
|
||||
|
||||
# Get the option's value (argument), or die on missing or empty argument
|
||||
# $1 option
|
||||
# $2 value
|
||||
@ -275,23 +356,62 @@ unset adjusted optMpi
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help* | --help*)
|
||||
usage
|
||||
-help-c*) # Compat help
|
||||
printHelp -compat
|
||||
;;
|
||||
-help-f*) # Full help
|
||||
printHelp -full
|
||||
;;
|
||||
-h | -help*) # Short help
|
||||
printHelp
|
||||
;;
|
||||
'')
|
||||
# Discard empty arguments
|
||||
;;
|
||||
|
||||
-debug-list)
|
||||
# Undocumented (experimental)
|
||||
# TDB: List files that can be edited by this script
|
||||
cat << CONFIG_SH
|
||||
etc/bashrc
|
||||
etc/config.sh/adios2
|
||||
etc/config.sh/compiler
|
||||
etc/config.sh/paraview
|
||||
etc/config.sh/vtk
|
||||
etc/config.sh/CGAL
|
||||
etc/config.sh/FFTW
|
||||
etc/config.sh/metis
|
||||
etc/config.sh/kahip
|
||||
etc/config.sh/scotch
|
||||
CONFIG_SH
|
||||
|
||||
cat << CONFIG_CSH
|
||||
etc/cshrc
|
||||
etc/config.csh/adios2
|
||||
etc/config.csh/compiler
|
||||
etc/config.csh/paraview
|
||||
etc/config.csh/vtk
|
||||
etc/config.csh/CGAL
|
||||
etc/config.csh/FFTW
|
||||
CONFIG_CSH
|
||||
exit 0
|
||||
;;
|
||||
|
||||
## Basic ##
|
||||
|
||||
-etc=*)
|
||||
# Define FOAM_CONFIG_ETC for finding files
|
||||
export FOAM_CONFIG_ETC="${1#*=}"
|
||||
;;
|
||||
|
||||
-project-path)
|
||||
# Replace WM_PROJECT_DIR=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
replaceCsh etc/cshrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
|
||||
removeBashMagic etc/bashrc
|
||||
removeCshMagic etc/cshrc
|
||||
removeBashMagic $(_foamEtc bashrc)
|
||||
removeCshMagic $(_foamEtc cshrc)
|
||||
|
||||
adjusted=true
|
||||
shift
|
||||
@ -300,8 +420,8 @@ do
|
||||
-version | -foamVersion | --projectVersion)
|
||||
# Replace WM_PROJECT_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc WM_PROJECT_VERSION "$optionValue"
|
||||
replaceCsh etc/cshrc WM_PROJECT_VERSION "$optionValue"
|
||||
replaceEtc bashrc WM_PROJECT_VERSION "$optionValue"
|
||||
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -315,30 +435,30 @@ do
|
||||
|
||||
-sp | -SP | -float32)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "SP"
|
||||
replaceCsh etc/cshrc WM_PRECISION_OPTION "SP"
|
||||
replaceEtc bashrc WM_PRECISION_OPTION "SP"
|
||||
replaceEtcCsh cshrc WM_PRECISION_OPTION "SP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-dp | -DP | -float64)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "DP"
|
||||
replaceCsh etc/cshrc WM_PRECISION_OPTION "DP"
|
||||
replaceEtc bashrc WM_PRECISION_OPTION "DP"
|
||||
replaceEtcCsh cshrc WM_PRECISION_OPTION "DP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-spdp | -SPDP)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "SPDP"
|
||||
replaceCsh etc/cshrc WM_PRECISION_OPTION "SPDP"
|
||||
replaceEtc bashrc WM_PRECISION_OPTION "SPDP"
|
||||
replaceEtcCsh cshrc WM_PRECISION_OPTION "SPDP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-int32 | -int64)
|
||||
# Replace WM_LABEL_SIZE=...
|
||||
optionValue="${1#-int}"
|
||||
replace etc/bashrc WM_LABEL_SIZE "$optionValue"
|
||||
replaceCsh etc/cshrc WM_LABEL_SIZE "$optionValue"
|
||||
replaceEtc bashrc WM_LABEL_SIZE "$optionValue"
|
||||
replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
@ -346,43 +466,43 @@ do
|
||||
## Compiler ##
|
||||
|
||||
-clang)
|
||||
# Replace clang_version=...
|
||||
# Replace default_clang_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/compiler clang_version "$optionValue"
|
||||
replace etc/config.csh/compiler clang_version "$optionValue"
|
||||
replaceEtc config.sh/compiler default_clang_version "$optionValue"
|
||||
replaceEtc config.csh/compiler default_clang_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-gcc)
|
||||
# Replace gcc_version=...
|
||||
# Replace default_gcc_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/compiler gcc_version "$optionValue"
|
||||
replace etc/config.csh/compiler gcc_version "$optionValue"
|
||||
replaceEtc config.sh/compiler default_gcc_version "$optionValue"
|
||||
replaceEtc config.csh/compiler default_gcc_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-system)
|
||||
-system-compiler | -system)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc \
|
||||
replaceEtc bashrc \
|
||||
WM_COMPILER_TYPE system \
|
||||
WM_COMPILER "$optionValue"
|
||||
replaceCsh etc/cshrc \
|
||||
replaceEtcCsh cshrc \
|
||||
WM_COMPILER_TYPE system \
|
||||
WM_COMPILER "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-third | -ThirdParty)
|
||||
-third-compiler | -third | -ThirdParty)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc \
|
||||
replaceEtc bashrc \
|
||||
WM_COMPILER_TYPE ThirdParty \
|
||||
WM_COMPILER "$optionValue"
|
||||
replaceCsh etc/cshrc \
|
||||
replaceEtcCsh cshrc \
|
||||
WM_COMPILER_TYPE ThirdParty \
|
||||
WM_COMPILER "$optionValue"
|
||||
adjusted=true
|
||||
@ -391,22 +511,22 @@ do
|
||||
|
||||
gmp-[4-9]* | gmp-system)
|
||||
# gcc-related package
|
||||
replace etc/config.sh/compiler gmp_version "$1"
|
||||
replace etc/config.csh/compiler gmp_version "$1"
|
||||
replaceEtc config.sh/compiler default_gmp_version "$1"
|
||||
replaceEtc config.csh/compiler default_gmp_version "$1"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
mpfr-[2-9]* | mpfr-system)
|
||||
# gcc-related package
|
||||
replace etc/config.sh/compiler mpfr_version "$1"
|
||||
replace etc/config.csh/compiler mpfr_version "$1"
|
||||
replaceEtc config.sh/compiler default_mpfr_version "$1"
|
||||
replaceEtc config.csh/compiler default_mpfr_version "$1"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
mpc-[0-9]* | mpc-system)
|
||||
# gcc-related package
|
||||
replace etc/config.sh/compiler mpc_version "$1"
|
||||
replace etc/config.csh/compiler mpc_version "$1"
|
||||
replaceEtc config.sh/compiler default_mpc_version "$1"
|
||||
replaceEtc config.csh/compiler default_mpc_version "$1"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
@ -416,8 +536,8 @@ do
|
||||
-mpi)
|
||||
# Explicitly set WM_MPLIB=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc WM_MPLIB "$optionValue"
|
||||
replaceCsh etc/bashrc WM_MPLIB "$optionValue"
|
||||
replaceEtc bashrc WM_MPLIB "$optionValue"
|
||||
replaceEtcCsh cshrc WM_MPLIB "$optionValue"
|
||||
optMpi=system
|
||||
adjusted=true
|
||||
shift
|
||||
@ -432,34 +552,34 @@ do
|
||||
_matches "$optMpi" "$expected" || \
|
||||
die "'$1' has bad value: '$optMpi'"
|
||||
|
||||
_inlineSed etc/config.sh/mpi \
|
||||
_inlineSed $(_foamEtc config.sh/mpi) \
|
||||
"FOAM_MPI=$expected" \
|
||||
"FOAM_MPI=$optMpi" \
|
||||
"Replaced 'FOAM_MPI=$expected' setting by 'FOAM_MPI=$optMpi'"
|
||||
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optMpi'"
|
||||
|
||||
_inlineSed etc/config.csh/mpi \
|
||||
_inlineSed $(_foamEtc config.csh/mpi) \
|
||||
"FOAM_MPI $expected" \
|
||||
"FOAM_MPI $optMpi" \
|
||||
"Replaced 'FOAM_MPI $expected' setting by 'FOAM_MPI $optMpi'"
|
||||
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optMpi'"
|
||||
|
||||
replace etc/bashrc WM_MPLIB OPENMPI
|
||||
replaceCsh etc/cshrc WM_MPLIB OPENMPI
|
||||
replaceEtc bashrc WM_MPLIB OPENMPI
|
||||
replaceEtcCsh cshrc WM_MPLIB OPENMPI
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-openmpi-system)
|
||||
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
|
||||
replace etc/bashrc WM_MPLIB SYSTEMOPENMPI
|
||||
replaceCsh etc/cshrc WM_MPLIB SYSTEMOPENMPI
|
||||
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI
|
||||
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI
|
||||
optMpi=system
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-openmpi-third)
|
||||
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
|
||||
replace etc/bashrc WM_MPLIB OPENMPI
|
||||
replaceCsh etc/cshrc WM_MPLIB OPENMPI
|
||||
replaceEtc bashrc WM_MPLIB OPENMPI
|
||||
replaceEtcCsh cshrc WM_MPLIB OPENMPI
|
||||
optMpi=third
|
||||
adjusted=true
|
||||
;;
|
||||
@ -470,8 +590,8 @@ do
|
||||
-adios | -adios2)
|
||||
# Replace adios2_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/adios2 adios2_version "$optionValue"
|
||||
replace etc/config.csh/adios2 adios2_version "$optionValue"
|
||||
replaceEtc config.sh/adios2 adios2_version "$optionValue"
|
||||
replaceEtc config.csh/adios2 adios2_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -479,8 +599,8 @@ do
|
||||
-adios-path | -adios2-path)
|
||||
# Replace ADIOS2_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
replaceCsh etc/config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -488,8 +608,8 @@ do
|
||||
-boost)
|
||||
# Replace boost_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL boost_version "$optionValue"
|
||||
replace etc/config.csh/CGAL boost_version "$optionValue"
|
||||
replaceEtc config.sh/CGAL boost_version "$optionValue"
|
||||
replaceEtc config.csh/CGAL boost_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -497,8 +617,8 @@ do
|
||||
-boost-path)
|
||||
# Replace BOOST_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
replaceCsh etc/config.csh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtcCsh config.csh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -506,8 +626,8 @@ do
|
||||
-cgal)
|
||||
# Replace cgal_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL cgal_version "$optionValue"
|
||||
replace etc/config.csh/CGAL cgal_version "$optionValue"
|
||||
replaceEtc config.sh/CGAL cgal_version "$optionValue"
|
||||
replaceEtc config.csh/CGAL cgal_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -515,8 +635,8 @@ do
|
||||
-cgal-path)
|
||||
# Replace CGAL_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
replaceCsh etc/config.csh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
replaceEtc config.sh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
replaceEtcCsh config.csh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -524,8 +644,8 @@ do
|
||||
-fftw)
|
||||
# Replace fftw_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/FFTW fftw_version "$optionValue"
|
||||
replace etc/config.csh/FFTW fftw_version "$optionValue"
|
||||
replaceEtc config.sh/FFTW fftw_version "$optionValue"
|
||||
replaceEtc config.csh/FFTW fftw_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -533,8 +653,8 @@ do
|
||||
-fftw-path)
|
||||
# Replace FFTW_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
replaceCsh etc/config.csh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtcCsh config.csh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -542,8 +662,8 @@ do
|
||||
-cmake)
|
||||
# Replace cmake_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/paraview cmake_version "$optionValue"
|
||||
replace etc/config.csh/paraview cmake_version "$optionValue"
|
||||
replaceEtc config.sh/paraview cmake_version "$optionValue"
|
||||
replaceEtc config.csh/paraview cmake_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -551,7 +671,7 @@ do
|
||||
-kahip)
|
||||
# Replace KAHIP_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/kahip KAHIP_VERSION "$optionValue"
|
||||
replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -559,7 +679,7 @@ do
|
||||
-kahip-path)
|
||||
# Replace KAHIP_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -567,7 +687,7 @@ do
|
||||
-metis)
|
||||
# Replace METIS_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/metis METIS_VERSION "$optionValue"
|
||||
replaceEtc config.sh/metis METIS_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -575,7 +695,7 @@ do
|
||||
-metis-path)
|
||||
# Replace METIS_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -583,7 +703,7 @@ do
|
||||
-scotch | -scotchVersion | --scotchVersion)
|
||||
# Replace SCOTCH_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/scotch SCOTCH_VERSION "$optionValue"
|
||||
replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -591,7 +711,7 @@ do
|
||||
-scotch-path | -scotchArchPath | --scotchArchPath)
|
||||
# Replace SCOTCH_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -606,8 +726,8 @@ do
|
||||
_matches "$optionValue" "$expected" || \
|
||||
[ "$optionValue" != "${optionValue%system}" ] || \
|
||||
die "'$1' has bad value: '$optionValue'"
|
||||
replace etc/config.sh/paraview ParaView_VERSION "$optionValue"
|
||||
replace etc/config.csh/paraview ParaView_VERSION "$optionValue"
|
||||
replaceEtc config.sh/paraview ParaView_VERSION "$optionValue"
|
||||
replaceEtc config.csh/paraview ParaView_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -615,8 +735,8 @@ do
|
||||
-paraview-qt)
|
||||
# Replace ParaView_QT=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/paraview ParaView_QT "$optionValue"
|
||||
replace etc/config.csh/paraview ParaView_QT "$optionValue"
|
||||
replaceEtc config.sh/paraview ParaView_QT "$optionValue"
|
||||
replaceEtc config.csh/paraview ParaView_QT "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -624,17 +744,17 @@ do
|
||||
-paraview-path | -paraviewInstall | --paraviewInstall)
|
||||
# Replace ParaView_DIR=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/paraview ParaView_DIR \""$optionValue\""
|
||||
replaceCsh etc/config.csh/paraview ParaView_DIR \""$optionValue\""
|
||||
replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\""
|
||||
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-vtk)
|
||||
# Replace vtk_version=...
|
||||
-llvm)
|
||||
# Replace mesa_llvm=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/vtk vtk_version "$optionValue"
|
||||
replace etc/config.csh/vtk vtk_version "$optionValue"
|
||||
replaceEtc config.sh/vtk mesa_llvm "$optionValue"
|
||||
replaceEtc config.csh/vtk mesa_llvm "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -642,8 +762,44 @@ do
|
||||
-mesa)
|
||||
# Replace mesa_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/vtk mesa_version "$optionValue"
|
||||
replace etc/config.csh/vtk mesa_version "$optionValue"
|
||||
replaceEtc config.sh/vtk mesa_version "$optionValue"
|
||||
replaceEtc config.csh/vtk mesa_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-vtk)
|
||||
# Replace vtk_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replaceEtc config.sh/vtk vtk_version "$optionValue"
|
||||
replaceEtc config.csh/vtk vtk_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-llvm-path)
|
||||
# Replace LLVM_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optionValue\""
|
||||
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-mesa-path)
|
||||
# Replace MESA_ARCH_PATH...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optionValue\""
|
||||
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-vtk-path)
|
||||
# Replace VTK_DIR...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replaceEtc config.sh/vtk VTK_DIR \""$optionValue\""
|
||||
replaceEtcCsh config.csh/vtk VTK_DIR \""$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
@ -7,23 +7,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016-2017 CINECA
|
||||
# Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# 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/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# foamCreateModuleInclude
|
||||
@ -134,15 +121,24 @@ syspath() {
|
||||
# Frontend: do all basic sanity checks in the front-end only
|
||||
if [ -z "$optBackend" ]
|
||||
then
|
||||
# Check that it appears to be an OpenFOAM installation
|
||||
[ -d "$projectDir" -a -f "$projectDir/etc/bashrc" ] || \
|
||||
die "Incorrect projectDir? $projectDir"
|
||||
|
||||
# Check preloads
|
||||
for file in "$preloads"
|
||||
do
|
||||
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2
|
||||
done
|
||||
if [ -n "$preloads" ]
|
||||
then
|
||||
for file in $preloads
|
||||
do
|
||||
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2
|
||||
done
|
||||
fi
|
||||
|
||||
# Check that it appears to be an OpenFOAM installation
|
||||
# could also check [ -d "$projectDir/META-INFO" ]
|
||||
if [ -d "$projectDir" ] && [ -f "etc/bashrc" ]
|
||||
then
|
||||
echo "Appears to be an OpenFOAM installation" 1>&2
|
||||
else
|
||||
die "Incorrect OpenFOAM projectDir?" \
|
||||
" $projectDir"
|
||||
fi
|
||||
|
||||
# Call itself with clean environment.
|
||||
# Tag the start/end of the original PATH, MANPATH, LD_LIBRARY_PATH
|
||||
@ -234,6 +230,9 @@ unset FOAM_INST_DIR WM_PROJECT_INST_DIR
|
||||
unset WM_PROJECT_USER_DIR WM_THIRD_PARTY_DIR
|
||||
unset SCOTCH_VERSION
|
||||
|
||||
# Probably don't want these either
|
||||
unset FOAM_CONFIG_MODE
|
||||
|
||||
|
||||
# Also remove user directories as being unreliable
|
||||
|
||||
@ -283,7 +282,7 @@ unalias util 2>/dev/null
|
||||
#------------------------------------------------
|
||||
|
||||
# Generalize environment.
|
||||
# This needs rethinking since it largely duplicates logic from the etc/config.sh/settings
|
||||
# Needs rethinking, it largely duplicates logic from etc/config.sh/settings
|
||||
rewriteEnv()
|
||||
{
|
||||
sed \
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# tools/lib-dir [OPTION] DIR [LIBEXT]
|
||||
@ -135,7 +134,7 @@ then
|
||||
fi
|
||||
|
||||
# 2) Use fallback if the previous failed
|
||||
if [ -z "$resolved" -a -n "$alt" ]
|
||||
if [ -z "$resolved" ] && [ -n "$alt" ]
|
||||
then
|
||||
# Fallback
|
||||
case "$alt" in
|
||||
|
||||
@ -1,193 +0,0 @@
|
||||
#!/bin/bash
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2019 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Script
|
||||
# openfoam [args]
|
||||
#
|
||||
# Description
|
||||
# Open an interactive bash session with an OpenFOAM environment,
|
||||
# or run an OpenFOAM application (with arguments) after first sourcing
|
||||
# the OpenFOAM etc/bashrc file from the project directory.
|
||||
#
|
||||
# This script normally exists in $WM_PROJECT_DIR/bin/tools but can also
|
||||
# be modified to use a hard-coded PROJECT_DIR entry and placed elsewhere
|
||||
# in the filesystem (eg, /usr/bin).
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# Hard-coded value (eg, with autoconfig)
|
||||
projectDir="@PROJECT_DIR@"
|
||||
|
||||
if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ]
|
||||
then
|
||||
# Auto-detect from location
|
||||
toolsDir="${0%/*}" # The bin/tools dir
|
||||
projectDir="${toolsDir%/bin/tools}" # Project dir
|
||||
|
||||
case "$projectDir" in
|
||||
(/bin | /usr/bin | /usr/local/bin)
|
||||
# This shouldn't happen.
|
||||
# If copied to a system dir, should also be using hard-coded values!
|
||||
echo "Warning: suspicious looking project dir: $projectDir" 1>&2
|
||||
;;
|
||||
|
||||
("$toolsDir")
|
||||
# Eg, called as ./openfoam etc - need to try harder
|
||||
projectDir="$(\cd $(dirname $0)/../.. && \pwd -L)" || unset projectDir
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION] [application ...]
|
||||
|
||||
options:
|
||||
-prefix=DIR Specify alternative OpenFOAM directory
|
||||
-sp Single precision
|
||||
-dp Double precision
|
||||
-spdp Mixed single/double precision
|
||||
-int32 | -int64 The label-size
|
||||
-help Print the usage
|
||||
|
||||
Open an interactive bash session with an OpenFOAM environment,
|
||||
or run an OpenFOAM application (with arguments) after first sourcing
|
||||
the OpenFOAM etc/bashrc file from the project directory:
|
||||
($projectDir)
|
||||
|
||||
For more information: www.OpenFOAM.com
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Only preserve settings for non-interactive?
|
||||
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
unset _foamSettings FOAM_SETTINGS
|
||||
else
|
||||
_foamSettings="$FOAM_SETTINGS"
|
||||
fi
|
||||
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help*)
|
||||
usage
|
||||
;;
|
||||
-prefix=* | -foam=*)
|
||||
projectDir="${1#*=}"
|
||||
;;
|
||||
|
||||
-sp | -SP)
|
||||
# WM_PRECISION_OPTION=...
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=SP"
|
||||
;;
|
||||
|
||||
-dp | -DP)
|
||||
# WM_PRECISION_OPTION=...
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=DP"
|
||||
;;
|
||||
|
||||
-spdp | -SPDP)
|
||||
# WM_PRECISION_OPTION=...
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=SPDP"
|
||||
;;
|
||||
|
||||
-int32 | -int64)
|
||||
# WM_LABEL_SIZE=...
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_LABEL_SIZE=${1#-int}"
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "Error: unknown option: '$1'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Remove current OpenFOAM environment
|
||||
if [ -d "$WM_PROJECT_DIR" ] && [ -f "$WM_PROJECT_DIR/etc/config.sh/unset" ]
|
||||
then
|
||||
. "$WM_PROJECT_DIR/etc/config.sh/unset"
|
||||
fi
|
||||
|
||||
[ -d "$projectDir" ] || {
|
||||
echo "Error: no project dir: $projectDir" 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
_foamSourceBashEnv="$projectDir/etc/bashrc"
|
||||
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
# Interactive shell
|
||||
_foamSourceBashEnv="$projectDir/bin/tools/source-bashrc"
|
||||
fi
|
||||
|
||||
[ -f "$_foamSourceBashEnv" ] || {
|
||||
echo "Error: file not found: $_foamSourceBashEnv" 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
# Source user ~/.bashrc and OpenFOAM etc/bashrc.
|
||||
# 1) Can either use a tmp file, or 2) chain off to a dedicated file
|
||||
# We use a dedicated file.
|
||||
|
||||
if [ -n "$_foamSettings" ]
|
||||
then
|
||||
export FOAM_SETTINGS="$_foamSettings"
|
||||
fi
|
||||
|
||||
## echo "Source with $_foamSourceBashEnv with '$FOAM_SETTINGS'" 1>&2
|
||||
|
||||
# Interactive shell (newer bash can use --init-file instead of --rcfile)
|
||||
exec bash --rcfile "$_foamSourceBashEnv" -i
|
||||
|
||||
else
|
||||
# Non-interactive
|
||||
|
||||
# Source bashrc within a function to preserve command-line arguments
|
||||
# - this will not have aliases, but working non-interactively anyhow
|
||||
sourceBashrc()
|
||||
{
|
||||
. "$_foamSourceBashEnv" $_foamSettings
|
||||
}
|
||||
|
||||
sourceBashrc
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
19
bin/tools/openfoam.in
Normal file
19
bin/tools/openfoam.in
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
exec "@PROJECT_DIR@"/etc/openfoam "$@"
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Description
|
||||
# Forwarding to OpenFOAM etc/openfoam bash session script.
|
||||
# Uses a hard-code directory path (eg, generated with autoconfig).
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,34 +5,36 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# bin/tools/source-bashrc
|
||||
#
|
||||
# Description
|
||||
# Source user ~/.bashrc and OpenFOAM etc/bashrc
|
||||
# Source user ~/.bashrc and OpenFOAM etc/bashrc.
|
||||
# Not normally sourced manually, but from bash with the --rcfile option.
|
||||
#
|
||||
# This file is normally not sourced manually,
|
||||
# but from bash with the --rcfile option.
|
||||
#------------------------------------------------------------------------------
|
||||
# Hard-coded value (eg, with autoconfig)
|
||||
# Hard-coded directory path (eg, autoconfig)
|
||||
projectDir="@PROJECT_DIR@"
|
||||
|
||||
if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ]
|
||||
then
|
||||
# Auto-detect (as per OpenFOAM etc/bashrc)
|
||||
# Auto-detect location (as per OpenFOAM etc/bashrc)
|
||||
# --
|
||||
# Assuming this file is $WM_PROJECT_DIR/bin/tools/source-bashrc,
|
||||
# the next lines should work when sourced by BASH or ZSH shells.
|
||||
# --
|
||||
|
||||
projectDir="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
|
||||
[ -n "$projectDir" ] && projectDir="$(\cd $(dirname $projectDir)/../.. && \pwd -L)" || unset projectDir
|
||||
if [ -n "$projectDir" ]
|
||||
then
|
||||
projectDir="$(\cd "$(dirname "$projectDir")"/../.. && \pwd -L)" || \
|
||||
unset projectDir
|
||||
fi
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -66,7 +68,7 @@ then
|
||||
# Some feedback
|
||||
if [ -n "$PS1" ] && [ -d "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
info="$(foamEtcFile -show-patch 2>/dev/null)"
|
||||
info="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch 2>/dev/null)"
|
||||
|
||||
# echo "Using: OpenFOAM-$WM_PROJECT_VERSION ($FOAM_API${info:+ patch=$info}) - visit www.openfoam.com" 1>&2
|
||||
echo "Using: OpenFOAM-$WM_PROJECT_VERSION${info:+ (patch=$info)} - visit www.openfoam.com" 1>&2
|
||||
|
||||
1
doc/modules/README
Normal file
1
doc/modules/README
Normal file
@ -0,0 +1 @@
|
||||
Modules-related documents when collated for an installation package.
|
||||
70
doc/openfoam.1.in
Normal file
70
doc/openfoam.1.in
Normal file
@ -0,0 +1,70 @@
|
||||
.TH "OPENFOAM" 1 "OpenFOAM-version" "www.openfoam.com" "OpenFOAM Commands Manual"
|
||||
|
||||
.SH NAME
|
||||
openfoam \- OpenFOAM bash(1) session
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBopenfoam\fR [\fIOPTIONS\fR] [\fIapplication ...\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
Activate an \fBOpenFOAM\fR environment in an interactive or
|
||||
non-interactive bash(1) session.
|
||||
|
||||
If no application is given, an interactive bash session will be used.
|
||||
If an application (optionally with arguments) is provided, the
|
||||
OpenFOAM \fIetc/bashrc\fR file will be sourced from the project directory
|
||||
prior to running the application.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-c\fR \fIcommand\fR
|
||||
Execute shell commands with OpenFOAM environment
|
||||
.TP
|
||||
\fB\-D\fR\fIkey=[value]\fR
|
||||
Define key/value to pass as a preference
|
||||
.TP
|
||||
\fB\-sp\fR
|
||||
Use single precision for scalar-size
|
||||
.TP
|
||||
\fB\-dp\fR
|
||||
Use double precision for scalar-size
|
||||
.TP
|
||||
\fB\-spdp\fR
|
||||
Use single precision for scalar-size, double for solve-scalar size
|
||||
.TP
|
||||
\fB\-int32\fR
|
||||
Use 32-bit label-size
|
||||
.TP
|
||||
\fB\-int64\fR
|
||||
Use 64-bit label-size
|
||||
.TP
|
||||
\fB\-prefix=DIR\fR
|
||||
Specify alternative OpenFOAM project directory
|
||||
.TP
|
||||
\fB\-show-api\fR | \fB\-version\fR
|
||||
Print META-INFO api value and exit
|
||||
.TP
|
||||
\fB\-show-patch\fR
|
||||
Print META-INFO patch value and exit
|
||||
.TP
|
||||
\fB\-show-prefix\fR
|
||||
Print project directory and exit
|
||||
.TP
|
||||
\fB\-help\fR
|
||||
Print the usage
|
||||
|
||||
.SH ARGUMENTS
|
||||
|
||||
If arguments remain after option processing, the first argument is
|
||||
assumed to be an application with options and arguments.
|
||||
|
||||
.SH FILES
|
||||
|
||||
The \fIetc/bashrc\fR file from the OpenFOAM project directory supplies
|
||||
the environment settings.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
Online documentation https://www.openfoam.com/documentation/
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2020 OpenCFD Ltd.
|
||||
25
etc/bashrc
25
etc/bashrc
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/bashrc
|
||||
@ -30,11 +29,22 @@
|
||||
# - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.sh
|
||||
# - $WM_PROJECT_SITE/etc/prefs.sh
|
||||
#
|
||||
# Some settings can also be overridden on the command-line when
|
||||
# sourcing this file. For example,
|
||||
#
|
||||
# . /path/etc/bashrc WM_COMPILER=Clang WM_LABEL_SIZE=64
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_ETC
|
||||
# - alternative/additional location for OpenFOAM etc/ directory
|
||||
#
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
# - no influence on OpenFOAM applications, just the config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
# WM_PROJECT_SITE (optional directory)
|
||||
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
|
||||
#
|
||||
@ -132,6 +142,11 @@ projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
|
||||
# * on a 32-bit OS this option is ignored (always 32-bit)
|
||||
#export WM_ARCH_OPTION=64
|
||||
|
||||
# [FOAM_EXTRA_CXXFLAGS]
|
||||
# Additional compilation flags - do not inherit from the environment.
|
||||
# Set after sourcing or via <prefs.sh> to avoid surprises.
|
||||
unset FOAM_EXTRA_CXXFLAGS
|
||||
|
||||
################################################################################
|
||||
# NO (NORMAL) USER EDITING BELOW HERE
|
||||
|
||||
|
||||
@ -9,8 +9,13 @@
|
||||
type forces;
|
||||
libs ("libforces.so");
|
||||
|
||||
writeControl timeStep;
|
||||
writeInterval 1;
|
||||
// How often force and moment volume fields will be written
|
||||
writeControl writeTime; // none
|
||||
|
||||
// How often the forces force.dat and moment.dat data files are updated
|
||||
// Note: .dat files are always updated on writeControl times
|
||||
executeControl timeStep;
|
||||
executeInterval 1;
|
||||
|
||||
log off;
|
||||
|
||||
|
||||
@ -8,9 +8,10 @@
|
||||
Description
|
||||
Solves a transport equation for a scalar field.
|
||||
|
||||
The name of the scalar field is specified in this file. A sample scalar
|
||||
field file, that must be initialised for the case, typically in the 0
|
||||
directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport.
|
||||
The name of the scalar field is specified in this file.
|
||||
A sample scalar field file, that must be initialised for the case,
|
||||
typically in the 0 directory,
|
||||
is available in tetc/caseDicts/solvers/scalarTransport
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/compiler
|
||||
@ -24,14 +23,19 @@
|
||||
|
||||
switch ("$WM_COMPILER_TYPE")
|
||||
case ThirdParty:
|
||||
# Default versions of GMP, MPFR, MPC - override as necessary
|
||||
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
|
||||
|
||||
set gmp_version=gmp-system
|
||||
set mpfr_version=mpfr-system
|
||||
set mpc_version=mpc-system
|
||||
set default_clang_version=llvm-3.7.1
|
||||
set default_gcc_version=gcc-4.8.5
|
||||
|
||||
set default_gmp_version=gmp-system
|
||||
set default_mpfr_version=mpfr-system
|
||||
set default_mpc_version=mpc-system
|
||||
|
||||
switch ("$WM_COMPILER")
|
||||
case Gcc:
|
||||
set gcc_version="$default_gcc_version"
|
||||
breaksw
|
||||
case Gcc48*:
|
||||
set gcc_version=gcc-4.8.5
|
||||
breaksw
|
||||
@ -95,7 +99,10 @@ case ThirdParty:
|
||||
case Gcc92*:
|
||||
set gcc_version=gcc-9.2.0
|
||||
breaksw
|
||||
|
||||
case Clang:
|
||||
set clang_version="$default_clang_version"
|
||||
breaksw
|
||||
case Clang37*:
|
||||
set clang_version=llvm-3.7.1
|
||||
breaksw
|
||||
@ -126,6 +133,7 @@ case ThirdParty:
|
||||
case Clang90*:
|
||||
set clang_version=llvm-9.0.0
|
||||
breaksw
|
||||
|
||||
default:
|
||||
/bin/cat << UNKNOWN_COMPILER
|
||||
===============================================================================
|
||||
@ -143,4 +151,7 @@ UNKNOWN_COMPILER
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
unset default_gcc_version default_clang_version
|
||||
unset default_gmp_version default_mpfr_version default_mpc_version
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -9,15 +9,17 @@
|
||||
# Copyright (C) 2017 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# config.csh/example/compiler
|
||||
# - sourced by OpenFOAM-*/etc/config.csh/settings
|
||||
#
|
||||
# Description
|
||||
# Example of fine tuning ThirdParty compiler settings for OpenFOAM
|
||||
# Older example of fine tuning compiler settings for OpenFOAM
|
||||
#
|
||||
# The preferred mechanism is now with a "compiler-$WM_COMPILER" file
|
||||
# in one of the etc/ directories.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -26,7 +28,7 @@ eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -config -mode=o compiler`
|
||||
|
||||
# Modify/override compiler settings
|
||||
switch ("$WM_COMPILER")
|
||||
case Gcc70:
|
||||
case Gcc70*:
|
||||
set gcc_version=gcc-7.0.0
|
||||
set gmp_version=gmp-6.1.2
|
||||
set mpfr_version=mpfr-3.1.5
|
||||
|
||||
28
etc/config.csh/example/compiler-Gcc92
Normal file
28
etc/config.csh/example/compiler-Gcc92
Normal file
@ -0,0 +1,28 @@
|
||||
#----------------------------------*-sh-*--------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# config.csh/example/compiler-Gcc92
|
||||
# - sourced by OpenFOAM-*/etc/config.csh/compiler
|
||||
#
|
||||
# Description
|
||||
# Example of fine tuning compiler settings with a hook
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Modify/override compiler settings
|
||||
set gcc_version=gcc-9.2.0
|
||||
set gmp_version=gmp-6.2.0
|
||||
set mpfr_version=mpfr-4.0.2
|
||||
set mpc_version=mpc-1.1.0
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/functions
|
||||
@ -36,25 +35,13 @@ alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
|
||||
alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
|
||||
|
||||
# Echo values when FOAM_VERBOSE is on, no-op otherwise
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
alias _foamEcho 'echo \!*'
|
||||
else
|
||||
alias _foamEcho 'true'
|
||||
endif
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
if ($?FOAM_CONFIG_NOUSER) then
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose -mode=o \!*`'
|
||||
else
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
|
||||
endif
|
||||
alias _foamEcho 'echo \!*'
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
|
||||
else
|
||||
if ($?FOAM_CONFIG_NOUSER) then
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -mode=o \!*`'
|
||||
else
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
|
||||
endif
|
||||
alias _foamEcho 'true'
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/settings
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/setup
|
||||
@ -19,10 +18,11 @@
|
||||
# Finalize setup of OpenFOAM environment for C-shell (csh, tcsh)
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -78,18 +78,25 @@ endif
|
||||
|
||||
|
||||
# Overrides via <prefs.csh>
|
||||
# 1. other (system) values
|
||||
# 1. Always use (O)ther values from the OpenFOAM project etc/ directory
|
||||
_foamEtc -mode=o prefs.csh
|
||||
|
||||
# 2. user or group values (unless disabled)
|
||||
if (! $?FOAM_CONFIG_NOUSER ) then
|
||||
_foamEtc -mode=ug prefs.csh
|
||||
# 2. (U)ser or (G)roup values (unless disabled). Could use some more work
|
||||
if ($?FOAM_CONFIG_MODE) then
|
||||
set configMode="${FOAM_CONFIG_MODE:s/o//}" # Already handled O(ther)
|
||||
else
|
||||
set configMode="ug"
|
||||
endif
|
||||
|
||||
# Is the remainder valid - has U(ser) or G(roup)?
|
||||
switch ("$configMode")
|
||||
case *[ug]*:
|
||||
_foamEtc -mode="$configMode" prefs.csh
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
# Capture and evaluate any command-line parameters
|
||||
# These can be used to set/unset values, specify additional files etc.
|
||||
setenv FOAM_SETTINGS "${*}"
|
||||
setenv FOAM_SETTINGS "$argv[*]"
|
||||
|
||||
while ( $#argv > 0 )
|
||||
switch ($argv[1])
|
||||
@ -120,6 +127,16 @@ while ( $#argv > 0 )
|
||||
shift
|
||||
end
|
||||
|
||||
# The prefs may have injected a FOAM_CONFIG_ETC value.
|
||||
# Verify that it makes sense before continuing.
|
||||
if ( $?FOAM_CONFIG_ETC ) then
|
||||
if ( ! -d "$FOAM_CONFIG_ETC" ) then
|
||||
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC"
|
||||
else if ( "$FOAM_CONFIG_ETC" == "$WM_PROJECT_DIR/etc" ) then
|
||||
unsetenv FOAM_CONFIG_ETC
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/unset
|
||||
@ -46,20 +45,15 @@ endif
|
||||
|
||||
unsetenv WM_ARCH
|
||||
unsetenv WM_ARCH_OPTION
|
||||
unsetenv WM_CC
|
||||
unsetenv WM_CFLAGS
|
||||
unsetenv WM_COMPILER
|
||||
unsetenv WM_COMPILER_ARCH
|
||||
unsetenv WM_COMPILER_TYPE
|
||||
unsetenv WM_COMPILER_LIB_ARCH
|
||||
unsetenv WM_COMPILE_OPTION
|
||||
unsetenv WM_CXX
|
||||
unsetenv WM_CXXFLAGS
|
||||
unsetenv WM_DIR
|
||||
unsetenv WM_HOSTS
|
||||
unsetenv WM_LABEL_OPTION
|
||||
unsetenv WM_LABEL_SIZE
|
||||
unsetenv WM_LDFLAGS
|
||||
unsetenv WM_MPLIB
|
||||
unsetenv WM_NCOMPPROCS
|
||||
unsetenv WM_OPTIONS
|
||||
@ -75,6 +69,11 @@ unsetenv WM_PROJECT_VERSION
|
||||
unsetenv WM_SCHEDULER
|
||||
unsetenv WM_THIRD_PARTY_DIR
|
||||
|
||||
# Older variables
|
||||
|
||||
# Before 1906
|
||||
unsetenv WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Unset FOAM_* environment variables
|
||||
@ -83,9 +82,12 @@ unsetenv FOAM_API
|
||||
unsetenv FOAM_APPBIN
|
||||
unsetenv FOAM_APP
|
||||
unsetenv FOAM_CODE_TEMPLATES
|
||||
unsetenv FOAM_CONFIG_ETC
|
||||
unsetenv FOAM_CONFIG_MODE
|
||||
unsetenv FOAM_ETC
|
||||
unsetenv FOAM_EXTRA_CXXFLAGS
|
||||
unsetenv FOAM_EXTRA_LDFLAGS
|
||||
unsetenv FOAM_EXT_LIBBIN
|
||||
unsetenv FOAM_INST_DIR
|
||||
unsetenv FOAM_JOB_DIR
|
||||
unsetenv FOAM_LIBBIN
|
||||
unsetenv FOAM_MPI
|
||||
@ -102,6 +104,10 @@ unsetenv FOAM_USER_APPBIN
|
||||
unsetenv FOAM_USER_LIBBIN
|
||||
unsetenv FOAM_UTILITIES
|
||||
|
||||
# Old variables
|
||||
|
||||
# Before 1812
|
||||
unsetenv FOAM_INST_DIR
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Unset MPI-related environment variables
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/compiler
|
||||
@ -24,13 +23,21 @@
|
||||
|
||||
case "$WM_COMPILER_TYPE" in
|
||||
ThirdParty)
|
||||
# Default versions of GMP, MPFR, MPC - override as necessary
|
||||
gmp_version=gmp-system
|
||||
mpfr_version=mpfr-system
|
||||
mpc_version=mpc-system
|
||||
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
|
||||
|
||||
default_clang_version=llvm-3.7.1
|
||||
default_gcc_version=gcc-4.8.5
|
||||
|
||||
default_gmp_version=gmp-system
|
||||
default_mpfr_version=mpfr-system
|
||||
default_mpc_version=mpc-system
|
||||
|
||||
gmp_version="$default_gmp_version"
|
||||
mpfr_version="$default_mpfr_version"
|
||||
mpc_version="$default_mpc_version"
|
||||
|
||||
case "$WM_COMPILER" in
|
||||
Gcc |\
|
||||
Gcc) gcc_version="$default_gcc_version" ;;
|
||||
Gcc48*) gcc_version=gcc-4.8.5 ;;
|
||||
Gcc49*) gcc_version=gcc-4.9.4 ;;
|
||||
Gcc51*) gcc_version=gcc-5.1.0 ;;
|
||||
@ -54,7 +61,7 @@ ThirdParty)
|
||||
Gcc91*) gcc_version=gcc-9.1.0 ;;
|
||||
Gcc92*) gcc_version=gcc-9.2.0 ;;
|
||||
|
||||
Clang |\
|
||||
Clang) clang_version="$default_clang_version" ;;
|
||||
Clang37*) clang_version=llvm-3.7.1 ;;
|
||||
Clang38*) clang_version=llvm-3.8.1 ;;
|
||||
Clang39*) clang_version=llvm-3.9.1 ;;
|
||||
@ -83,4 +90,7 @@ UNKNOWN_COMPILER
|
||||
;;
|
||||
esac
|
||||
|
||||
unset default_gcc_version default_clang_version
|
||||
unset default_gmp_version default_mpfr_version default_mpc_version
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -9,15 +9,17 @@
|
||||
# Copyright (C) 2017 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# config.sh/example/compiler
|
||||
# - sourced by OpenFOAM-*/etc/config.sh/settings
|
||||
#
|
||||
# Description
|
||||
# Example of fine tuning compiler versions and settings for OpenFOAM
|
||||
# Older example of fine tuning compiler settings for OpenFOAM.
|
||||
#
|
||||
# The preferred mechanism is now with a "compiler-$WM_COMPILER" file
|
||||
# in one of the etc/ directories.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -26,18 +28,12 @@ eval $($WM_PROJECT_DIR/bin/foamEtcFile -sh -config -mode=o compiler)
|
||||
|
||||
# Modify/override compiler settings
|
||||
case "$WM_COMPILER" in
|
||||
Gcc70)
|
||||
Gcc70*)
|
||||
gcc_version=gcc-7.0.0
|
||||
gmp_version=gmp-6.1.2
|
||||
mpfr_version=mpfr-3.1.5
|
||||
mpc_version=mpc-1.0.3
|
||||
;;
|
||||
Gcc48u)
|
||||
# Example of using the system GCC 4.8 in Ubuntu 15.10. Keep in mind you
|
||||
# will also need to create the respective directory in "wmake/rules"
|
||||
export CC='gcc-4.8'
|
||||
export CXX='g++-4.8'
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
28
etc/config.sh/example/compiler-Gcc92
Normal file
28
etc/config.sh/example/compiler-Gcc92
Normal file
@ -0,0 +1,28 @@
|
||||
#----------------------------------*-sh-*--------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# config.sh/example/compiler-Gcc92
|
||||
# - sourced by OpenFOAM-*/etc/config.sh/compiler
|
||||
#
|
||||
# Description
|
||||
# Example of fine tuning compiler settings with a hook
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Modify/override compiler settings
|
||||
gcc_version=gcc-9.2.0
|
||||
gmp_version=gmp-6.2.0
|
||||
mpfr_version=mpfr-4.0.2
|
||||
mpc_version=mpc-1.1.0
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/functions
|
||||
@ -39,32 +38,25 @@ then
|
||||
{
|
||||
foamVar_name="$1"
|
||||
shift
|
||||
eval "$($foamClean -sh-env=$foamVar_name $@)"
|
||||
eval "$($foamClean -sh-env="$foamVar_name" "$@")"
|
||||
unset "foamVar_name"
|
||||
}
|
||||
|
||||
# Echo values to stderr when FOAM_VERBOSE is on, no-op otherwise
|
||||
unset -f _foamEcho 2>/dev/null
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
_foamEcho() { echo "$@" 1>&2; }
|
||||
else
|
||||
_foamEcho() { true; }
|
||||
fi
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
|
||||
unset -f _foamEcho 2>/dev/null
|
||||
unset -f _foamEtc 2>/dev/null
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
_foamEtc()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
|
||||
_foamEcho() { echo "$@" 1>&2; }
|
||||
_foamEtc() {
|
||||
eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh-verbose "$@")";
|
||||
}
|
||||
else
|
||||
_foamEtc()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
|
||||
_foamEcho() { true; }
|
||||
_foamEtc() {
|
||||
eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh "$@")";
|
||||
}
|
||||
fi
|
||||
|
||||
@ -162,7 +154,7 @@ then
|
||||
# - use lib-dir script instead of rewriting
|
||||
_foamAddLibAuto()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $@)";
|
||||
eval "$("$WM_PROJECT_DIR"/bin/tools/lib-dir -sh "$@")";
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
@ -9,12 +9,11 @@
|
||||
# Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/gperftools
|
||||
# - sourced by OpenFOAM-*/etc/bashrc
|
||||
# Not normally sourced by OpenFOAM-*/etc/bashrc
|
||||
#
|
||||
# Description
|
||||
# Setup file for GPERFTOOLS binaries/libraries.
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/paraview
|
||||
@ -109,7 +108,7 @@ case "$ParaView_VERSION" in
|
||||
|
||||
(system)
|
||||
unset PV_PLUGIN_PATH
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} -config paraview-system)"
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh -config paraview-system)"
|
||||
;;
|
||||
|
||||
(*)
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/settings
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/setup
|
||||
@ -19,15 +18,16 @@
|
||||
# Finalize setup of OpenFOAM environment for POSIX shell.
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# [FOAM_API] - The API level for the project
|
||||
export FOAM_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
|
||||
export FOAM_API=$("$WM_PROJECT_DIR/bin/foamEtcFile" -show-api)
|
||||
|
||||
# The installation parent directory
|
||||
prefixDir="${WM_PROJECT_DIR%/*}"
|
||||
@ -83,11 +83,22 @@ fi
|
||||
|
||||
|
||||
# Overrides via <prefs.sh>
|
||||
# 1. other (system) values
|
||||
# 1. Always use O(ther) values from the OpenFOAM project etc/ directory
|
||||
_foamEtc -mode=o prefs.sh
|
||||
|
||||
# 2. user or group values (unless disabled)
|
||||
[ -z "$FOAM_CONFIG_NOUSER" ] && _foamEtc -mode=ug prefs.sh
|
||||
# 2. (U)ser or (G)roup values (unless disabled).
|
||||
unset configMode
|
||||
if [ -z "$FOAM_CONFIG_MODE" ]
|
||||
then
|
||||
configMode="ug"
|
||||
else
|
||||
case "$FOAM_CONFIG_MODE" in (*[u]*) configMode="${configMode}u" ;; esac
|
||||
case "$FOAM_CONFIG_MODE" in (*[g]*) configMode="${configMode}g" ;; esac
|
||||
fi
|
||||
if [ -n "$configMode" ]
|
||||
then
|
||||
_foamEtc -mode="$configMode" prefs.sh
|
||||
fi
|
||||
|
||||
|
||||
# Capture and evaluate any command-line parameters
|
||||
@ -104,6 +115,21 @@ else
|
||||
_foamEval "$@"
|
||||
fi
|
||||
|
||||
# The prefs may have injected a FOAM_CONFIG_ETC value.
|
||||
# Verify that it makes sense before continuing.
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ ! -d "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC" 1>&2
|
||||
unset FOAM_CONFIG_ETC
|
||||
elif [ "$FOAM_CONFIG_ETC" = "$WM_PROJECT_DIR/etc" ]
|
||||
then
|
||||
# Redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -121,7 +147,6 @@ _foamEtc -config settings
|
||||
_foamEtc -config mpi
|
||||
_foamEtc -config paraview -- "$@" # Pass through for evaluation
|
||||
_foamEtc -config vtk
|
||||
_foamEtc -config gperftools
|
||||
_foamEtc -config adios2
|
||||
_foamEtc -config CGAL
|
||||
_foamEtc -config scotch
|
||||
@ -132,8 +157,8 @@ then
|
||||
_foamAddMan "$WM_PROJECT_DIR/doc"
|
||||
fi
|
||||
|
||||
# Interactive shell
|
||||
if /usr/bin/tty -s 2>/dev/null
|
||||
# Interactive shell (use PS1, not tty)
|
||||
if [ -n "$PS1" ]
|
||||
then
|
||||
_foamEtc -config aliases
|
||||
[ "${BASH_VERSINFO:-0}" -ge 4 ] && _foamEtc -config bash_completion
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/unset
|
||||
@ -35,19 +34,14 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
|
||||
|
||||
unset WM_ARCH
|
||||
unset WM_ARCH_OPTION
|
||||
unset WM_CC
|
||||
unset WM_CFLAGS
|
||||
unset WM_COMPILER
|
||||
unset WM_COMPILER_TYPE
|
||||
unset WM_COMPILER_LIB_ARCH
|
||||
unset WM_COMPILE_OPTION
|
||||
unset WM_CXX
|
||||
unset WM_CXXFLAGS
|
||||
unset WM_DIR
|
||||
unset WM_HOSTS
|
||||
unset WM_LABEL_OPTION
|
||||
unset WM_LABEL_SIZE
|
||||
unset WM_LDFLAGS
|
||||
unset WM_MPLIB
|
||||
unset WM_NCOMPPROCS
|
||||
unset WM_OPTIONS
|
||||
@ -63,6 +57,10 @@ unset WM_PROJECT_VERSION
|
||||
unset WM_SCHEDULER
|
||||
unset WM_THIRD_PARTY_DIR
|
||||
|
||||
# Older variables
|
||||
|
||||
# Before 1906
|
||||
unset WM_CC WM_CXX WM_CFLAGS WM_CXXFLAGS WM_LDFLAGS
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Unset FOAM_* environment variables
|
||||
@ -71,9 +69,12 @@ unset FOAM_API
|
||||
unset FOAM_APPBIN
|
||||
unset FOAM_APP
|
||||
unset FOAM_CODE_TEMPLATES
|
||||
unset FOAM_CONFIG_ETC
|
||||
unset FOAM_CONFIG_MODE
|
||||
unset FOAM_ETC
|
||||
unset FOAM_EXTRA_CXXFLAGS
|
||||
unset FOAM_EXTRA_LDFLAGS
|
||||
unset FOAM_EXT_LIBBIN
|
||||
unset FOAM_INST_DIR
|
||||
unset FOAM_JOB_DIR
|
||||
unset FOAM_LIBBIN
|
||||
unset FOAM_MPI
|
||||
@ -90,6 +91,10 @@ unset FOAM_USER_APPBIN
|
||||
unset FOAM_USER_LIBBIN
|
||||
unset FOAM_UTILITIES
|
||||
|
||||
# Old variables
|
||||
|
||||
# Before 1812
|
||||
unset FOAM_INST_DIR
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Unset MPI-related environment variables
|
||||
|
||||
27
etc/cshrc
27
etc/cshrc
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/cshrc
|
||||
@ -30,11 +29,22 @@
|
||||
# - $WM_PROJECT_SITE/$FOAM_API/etc/prefs.csh
|
||||
# - $WM_PROJECT_SITE/prefs.csh
|
||||
#
|
||||
# Some settings can also be overridden on the command-line when
|
||||
# sourcing this file. For example,
|
||||
#
|
||||
# source /path/etc/cshrc WM_COMPILER=Clang WM_LABEL_SIZE=64
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_ETC
|
||||
# - alternative/additional location for OpenFOAM etc/ directory
|
||||
#
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
# - no influence on OpenFOAM applications, just the config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
# WM_PROJECT_SITE (optional directory)
|
||||
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
|
||||
#
|
||||
@ -134,6 +144,11 @@ set projectDir=`lsof +p $$ |& \
|
||||
# * on a 32-bit OS this option is ignored (always 32-bit)
|
||||
#setenv WM_ARCH_OPTION 64
|
||||
|
||||
# [FOAM_EXTRA_CXXFLAGS]
|
||||
# Additional compilation flags - do not inherit from the environment.
|
||||
# Set after sourcing or via <prefs.csh> to avoid surprises.
|
||||
unsetenv FOAM_EXTRA_CXXFLAGS
|
||||
|
||||
################################################################################
|
||||
# NO (NORMAL) USER EDITING BELOW HERE
|
||||
|
||||
@ -176,7 +191,7 @@ endif
|
||||
# Finalize setup of OpenFOAM environment
|
||||
if ( -d "$WM_PROJECT_DIR" ) then
|
||||
if ($?FOAM_VERBOSE && $?prompt) echo "source $WM_PROJECT_DIR/etc/config.csh/setup"
|
||||
source "$WM_PROJECT_DIR/etc/config.csh/setup" "${*}"
|
||||
source "$WM_PROJECT_DIR/etc/config.csh/setup" $argv[*]
|
||||
else
|
||||
echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION"
|
||||
echo "No directory: $WM_PROJECT_DIR"
|
||||
|
||||
301
etc/openfoam
Executable file
301
etc/openfoam
Executable file
@ -0,0 +1,301 @@
|
||||
#!/bin/bash
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# openfoam [options] [args]
|
||||
#
|
||||
# Description
|
||||
# Open an interactive bash session with an OpenFOAM environment,
|
||||
# or run an OpenFOAM application (with arguments) after first sourcing
|
||||
# the OpenFOAM etc/bashrc file from the project directory.
|
||||
#
|
||||
# Note
|
||||
# This script normally exists in the $WM_PROJECT_DIR/etc/ directory.
|
||||
# Do not copy/move/link to other locations. Use instead an edited copy of
|
||||
# `bin/tools/openfoam.in` with a hard-coded projectDir entry.
|
||||
#
|
||||
# See OpenFOAM etc/bashrc for (command-line) preferences.
|
||||
# Some equivalent settings:
|
||||
# -sp | -DWM_PRECISION_OPTION=SP
|
||||
# -dp | -DWM_PRECISION_OPTION=DP
|
||||
# -int32 | -DWM_LABEL_SIZE=32
|
||||
# -int64 | -DWM_LABEL_SIZE=64
|
||||
#
|
||||
# However, the '-D' options grant more flexibility. For example,
|
||||
# etc/openfoam -DWM_COMPILER=Clang
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# Auto-detect from location. Do not call from within the etc/directory itself!
|
||||
projectDir="$(\cd "$(dirname "${0%/*}")" && \pwd -L)"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION] [application ...]
|
||||
|
||||
options:
|
||||
-c command Execute shell commands with OpenFOAM environment
|
||||
-Dkey[=value] Define key/value to pass as a preference
|
||||
-sp Single precision
|
||||
-dp Double precision
|
||||
-spdp Mixed single/double precision
|
||||
-int32 | -int64 The label-size
|
||||
-etc=DIR Additional project etc/ directory
|
||||
-prefix=DIR Alternative OpenFOAM project directory
|
||||
-show-api | -version Print META-INFO api value and exit
|
||||
-show-patch Print META-INFO patch value and exit
|
||||
-show-prefix Print project directory and exit
|
||||
-test-tutorial Forward arguments to tutorials/AutoTest
|
||||
-verbose Set FOAM_VERBOSE=true (interactive only)
|
||||
-help Print the usage
|
||||
|
||||
Open an interactive bash session with an OpenFOAM environment,
|
||||
or run an OpenFOAM application (with arguments) after first sourcing
|
||||
the OpenFOAM etc/bashrc file from the project directory:
|
||||
($projectDir)
|
||||
|
||||
For more information: www.openfoam.com
|
||||
|
||||
USAGE
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Get a value from META-INFO/api-info
|
||||
# $1 : keyword
|
||||
getApiInfo()
|
||||
{
|
||||
value="$(sed -ne 's@^'"$1"' *= *\([0-9][0-9]*\).*@\1@p' "$projectDir"/META-INFO/api-info 2>/dev/null)"
|
||||
|
||||
if [ -n "$value" ]
|
||||
then
|
||||
echo "$value"
|
||||
else
|
||||
echo "Could not determine OPENFOAM '$1' value" 1>&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# No inheritance of FOAM_SETTINGS
|
||||
unset FOAM_SETTINGS
|
||||
unset _foamEtcDir _foamSettings _foamScriptCommand
|
||||
unset optTestTut
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help* | --help*)
|
||||
printHelp
|
||||
;;
|
||||
-show-api | -version | --version) # Show API and exit
|
||||
getApiInfo api
|
||||
exit $?
|
||||
;;
|
||||
-show-patch) # Show patch level and exit
|
||||
getApiInfo patch
|
||||
exit $?
|
||||
;;
|
||||
-show-prefix) # Show project directory and exit
|
||||
echo "$projectDir"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-test-tutorial) # Run tutorials/AutoTest
|
||||
optTestTut=true
|
||||
;;
|
||||
|
||||
-c) # Shell command
|
||||
_foamScriptCommand="$2"
|
||||
[ -n "$_foamScriptCommand" ] || {
|
||||
echo "$0: missing or bad command argument: $2" 1>&2
|
||||
exit 1
|
||||
}
|
||||
shift 2
|
||||
break
|
||||
;;
|
||||
|
||||
-D*) # Define key/value to pass as preference
|
||||
setting="${1#-D}"
|
||||
if [ -n "$setting" ]
|
||||
then
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }$setting"
|
||||
fi
|
||||
;;
|
||||
|
||||
-sp | -dp | -spdp )
|
||||
# WM_PRECISION_OPTION=(SP|DP|SPDP)
|
||||
setting=$(echo "${1#-}" | sed -e 's/-//g;y/sdp/SDP/')
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_PRECISION_OPTION=$setting"
|
||||
;;
|
||||
|
||||
-int32 | -int64)
|
||||
# WM_LABEL_SIZE=...
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_LABEL_SIZE=${1#-int}"
|
||||
;;
|
||||
|
||||
-etc=*)
|
||||
# Define FOAM_CONFIG_ETC for finding files
|
||||
_foamEtcDir="${1#*=}"
|
||||
;;
|
||||
|
||||
-prefix=*)
|
||||
projectDir="${1#*=}"
|
||||
;;
|
||||
|
||||
-verbose)
|
||||
export FOAM_VERBOSE=true
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "$0: unknown option: '$1'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Sanity check (installed under /bin, /usr/bin, /usr/local/bin)
|
||||
# This should not happen.
|
||||
# If copied to a system dir, should also be using hard-coded values!
|
||||
|
||||
if [ "${projectDir%/bin}" != "$projectDir" ]
|
||||
then
|
||||
echo "Warning: suspicious project dir: $projectDir" 1>&2
|
||||
fi
|
||||
|
||||
[ -d "$projectDir/META-INFO" ] || {
|
||||
echo "Warning: missing META-INFO in OpenFOAM directory:" 1>&2
|
||||
echo " $projectDir" 1>&2
|
||||
}
|
||||
|
||||
|
||||
# Remove current OpenFOAM environment
|
||||
if [ -d "$WM_PROJECT_DIR" ] && [ -f "$WM_PROJECT_DIR/etc/config.sh/unset" ]
|
||||
then
|
||||
. "$WM_PROJECT_DIR/etc/config.sh/unset" || true
|
||||
fi
|
||||
|
||||
unset interactive
|
||||
|
||||
if [ "$#" -eq 0 ] && [ -z "$_foamScriptCommand" ] && [ -z "$optTestTut" ]
|
||||
then
|
||||
# Interactive shell, chain off via a file
|
||||
interactive=true
|
||||
_foamSourceBashEnv="$projectDir/bin/tools/source-bashrc"
|
||||
else
|
||||
# Non-interactive shell, use the OPENFOAM etc/bashrc
|
||||
_foamSourceBashEnv="$projectDir/etc/bashrc"
|
||||
fi
|
||||
|
||||
[ -f "$_foamSourceBashEnv" ] || {
|
||||
echo "Error: file not found: $_foamSourceBashEnv" 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
if [ -n "$_foamEtcDir" ] && [ -d "$_foamEtcDir" ]
|
||||
then
|
||||
# Additional etc directory
|
||||
export FOAM_CONFIG_ETC="$_foamEtcDir"
|
||||
else
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
|
||||
if [ -n "$interactive" ]
|
||||
then
|
||||
# Interactive shell
|
||||
# -----------------
|
||||
|
||||
# Source ~/.bashrc and OpenFOAM etc/bashrc in one of two ways:
|
||||
# 1) Generate and use a tmp file
|
||||
# 2) Chain off to a dedicated file [This is what we use]
|
||||
|
||||
if [ -n "$_foamSettings" ]
|
||||
then
|
||||
# Pass preferences via the FOAM_SETTINGS mechanism
|
||||
export FOAM_SETTINGS="$_foamSettings"
|
||||
fi
|
||||
|
||||
## echo "Source with $_foamSourceBashEnv with '$FOAM_SETTINGS'" 1>&2
|
||||
|
||||
# Newer bash can use --init-file instead of --rcfile
|
||||
exec bash --rcfile "$_foamSourceBashEnv" -i
|
||||
exit $? # Safety
|
||||
fi
|
||||
|
||||
|
||||
# Non-interactive shell
|
||||
# ---------------------
|
||||
|
||||
# Source bashrc within a function to preserve command-line arguments
|
||||
# Suppresses aliases as a side-effect, but non-interactive anyhow.
|
||||
sourceBashrc()
|
||||
{
|
||||
. "$_foamSourceBashEnv" $_foamSettings
|
||||
}
|
||||
|
||||
|
||||
if [ -n "$_foamScriptCommand" ]
|
||||
then
|
||||
# A shell command
|
||||
|
||||
sourceBashrc
|
||||
exec bash -c "$_foamScriptCommand" "$@"
|
||||
exit $? # Safety
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$optTestTut" ]
|
||||
then
|
||||
|
||||
sourceBashrc
|
||||
exec "$WM_PROJECT_DIR/tutorials/AutoTest" "$@"
|
||||
exit $? # Safety
|
||||
fi
|
||||
|
||||
|
||||
# An application or a shell script
|
||||
|
||||
# It may actually be a script with a '#!/project-path/bin/openfoam',
|
||||
# so we need to catch this to avoid infinite recursion.
|
||||
if [ -f "$1" ] \
|
||||
&& [ -n "$(sed -ne '1{/^#!.*\/openfoam$/p; q}' "$1" 2>/dev/null)" ]
|
||||
then
|
||||
# A shell script
|
||||
|
||||
sourceBashrc
|
||||
exec bash "$@"
|
||||
|
||||
else
|
||||
# An application
|
||||
|
||||
sourceBashrc
|
||||
exec "$@"
|
||||
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -11,7 +11,7 @@ Overview
|
||||
Meshing
|
||||
=======
|
||||
+ Meshing is setup as in the inflowOutflow template
|
||||
+ See $FOAM_ETC/templates/inflowOutflow/README for details
|
||||
+ See etc/templates/inflowOutflow/README for details
|
||||
+ The setup includes an example for one named patch to be generated in the mesh
|
||||
+ In snappyHexMeshDict, replace <CADregionName> with the name of region in the
|
||||
trisurface; replace <patchName> with the name of the resulting mesh patch
|
||||
@ -21,4 +21,4 @@ Initialisation
|
||||
+ In the field files in the 0 directory, set initial values
|
||||
+ The template includes a fixedValue boundary condition on <patchName> in 0/T
|
||||
+ The user can replace <patchName> with a real mesh patch name and apply a
|
||||
fixed temperature on that patch
|
||||
fixed temperature on that patch
|
||||
|
||||
Submodule modules/adios updated: c4f53dc5e7...8cdeac3896
@ -472,6 +472,12 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//- Copy construct
|
||||
reference(const reference&) = default;
|
||||
|
||||
//- Move construct
|
||||
reference(reference&&) = default;
|
||||
|
||||
//- Value assignment
|
||||
inline void operator=(const reference& other);
|
||||
|
||||
|
||||
@ -447,6 +447,12 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//- Copy construct
|
||||
reference(const reference&) = default;
|
||||
|
||||
//- Move construct
|
||||
reference(reference&&) = default;
|
||||
|
||||
//- Flip the bit at the position, no range-checking
|
||||
inline void flip();
|
||||
|
||||
|
||||
@ -741,8 +741,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null (end iterator)
|
||||
inline const_iterator() = default;
|
||||
//- Default construct (end iterator)
|
||||
const_iterator() = default;
|
||||
|
||||
//- Copy construct
|
||||
const_iterator(const const_iterator&) = default;
|
||||
|
||||
//- Copy construct from similar access type
|
||||
inline explicit const_iterator(const Iterator<true>& iter)
|
||||
|
||||
@ -233,6 +233,9 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//- Copy construct
|
||||
iterator(const iterator&) = default;
|
||||
|
||||
//- Construct for a node on a list
|
||||
inline iterator(DLListBase* list, link* item);
|
||||
|
||||
|
||||
@ -209,6 +209,9 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//- Copy construct
|
||||
iterator(const iterator&) = default;
|
||||
|
||||
//- Construct for a node on the list
|
||||
inline iterator(SLListBase* list, link* item);
|
||||
|
||||
|
||||
@ -76,6 +76,12 @@ public:
|
||||
inline static const SubList<T>& null();
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
SubList(const SubList&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from UList, the entire size
|
||||
|
||||
@ -208,6 +208,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
UList(const UList<T>&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
|
||||
@ -267,6 +267,15 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
IOobject(const IOobject&) = default;
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOobject() = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name, instance, registry, io options
|
||||
@ -336,10 +345,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOobject() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// General access
|
||||
|
||||
@ -77,12 +77,6 @@ Foam::baseIOdictionary::baseIOdictionary
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::baseIOdictionary::~baseIOdictionary()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& Foam::baseIOdictionary::name() const
|
||||
|
||||
@ -68,6 +68,18 @@ public:
|
||||
TypeName("dictionary");
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
baseIOdictionary(const baseIOdictionary&) = default;
|
||||
|
||||
//- Move construct
|
||||
baseIOdictionary(baseIOdictionary&&) = default;
|
||||
|
||||
//- Destructor
|
||||
virtual ~baseIOdictionary() = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given an IOobject
|
||||
@ -80,11 +92,7 @@ public:
|
||||
baseIOdictionary(const IOobject&, Istream&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~baseIOdictionary();
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Return complete path + object name if the file exists
|
||||
// either in the case/processor or case otherwise null
|
||||
|
||||
@ -147,6 +147,15 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
IOstream(const IOstream&) = default;
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOstream() = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with specified stream option
|
||||
@ -174,10 +183,6 @@ public:
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOstream() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
@ -74,6 +74,15 @@ class Istream
|
||||
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
Istream(const Istream&) = default;
|
||||
|
||||
//- Destructor
|
||||
virtual ~Istream() = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct and set stream status
|
||||
@ -89,10 +98,6 @@ public:
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Istream() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Read Functions
|
||||
|
||||
@ -74,6 +74,15 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
Ostream(const Ostream&) = default;
|
||||
|
||||
//- Destructor
|
||||
virtual ~Ostream() = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct and set stream status
|
||||
@ -88,10 +97,6 @@ public:
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Ostream() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Write Functions
|
||||
|
||||
@ -200,6 +200,50 @@ void reduce
|
||||
);
|
||||
|
||||
|
||||
#if defined(WM_SPDP)
|
||||
void reduce
|
||||
(
|
||||
solveScalar& Value,
|
||||
const sumOp<solveScalar>& bop,
|
||||
const int tag = Pstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
void reduce
|
||||
(
|
||||
solveScalar& Value,
|
||||
const minOp<solveScalar>& bop,
|
||||
const int tag = Pstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
void reduce
|
||||
(
|
||||
Vector2D<solveScalar>& Value,
|
||||
const sumOp<Vector2D<solveScalar>>& bop,
|
||||
const int tag = Pstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
void sumReduce
|
||||
(
|
||||
solveScalar& Value,
|
||||
label& Count,
|
||||
const int tag = Pstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
void reduce
|
||||
(
|
||||
solveScalar& Value,
|
||||
const sumOp<solveScalar>& bop,
|
||||
const int tag,
|
||||
const label comm,
|
||||
label& request
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -62,14 +62,17 @@ class OSstream
|
||||
std::ostream& os_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
OSstream(const OSstream&) = default;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const OSstream&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct as wrapper around std::ostream and set stream status
|
||||
|
||||
@ -453,4 +453,32 @@ void Foam::ITstream::append(tokenList&& newTokens, const bool lazy)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::ITstream::operator=(const ITstream& is)
|
||||
{
|
||||
Istream::operator=(is);
|
||||
tokenList::operator=(is);
|
||||
name_ = is.name_;
|
||||
|
||||
rewind();
|
||||
}
|
||||
|
||||
|
||||
void Foam::ITstream::operator=(const tokenList& toks)
|
||||
{
|
||||
tokenList::operator=(toks);
|
||||
|
||||
rewind();
|
||||
}
|
||||
|
||||
|
||||
void Foam::ITstream::operator=(tokenList&& toks)
|
||||
{
|
||||
tokenList::operator=(std::move(toks));
|
||||
|
||||
rewind();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -328,14 +328,26 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Output
|
||||
// Output
|
||||
|
||||
//- Print description of stream to Ostream
|
||||
void print(Ostream& os) const;
|
||||
//- Print stream description to Ostream
|
||||
void print(Ostream& os) const;
|
||||
|
||||
//- Concatenate tokens into a space-separated std::string.
|
||||
//- The resulting string may contain quote characters.
|
||||
std::string toString() const;
|
||||
//- Concatenate tokens into a space-separated std::string.
|
||||
//- The resulting string may contain quote characters.
|
||||
std::string toString() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Copy assignment, with rewind()
|
||||
void operator=(const ITstream& is);
|
||||
|
||||
//- Copy assignment of tokens, with rewind()
|
||||
void operator=(const tokenList& toks);
|
||||
|
||||
//- Move assignment of tokens, with rewind()
|
||||
void operator=(tokenList&& toks);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -143,7 +143,8 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
{
|
||||
if (Foam::functionEntries::includeEntry::log)
|
||||
{
|
||||
DetailInfo << fName << endl;
|
||||
// Report to stdout which file is included
|
||||
Info<< fName << nl;
|
||||
}
|
||||
|
||||
// Add watch on included file
|
||||
@ -194,7 +195,8 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
{
|
||||
if (Foam::functionEntries::includeEntry::log)
|
||||
{
|
||||
DetailInfo << fName << endl;
|
||||
// Report to stdout which file is included
|
||||
Info<< fName << nl;
|
||||
}
|
||||
|
||||
// Add watch on included file
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -123,7 +123,8 @@ bool Foam::functionEntries::includeEtcEntry::execute
|
||||
{
|
||||
if (Foam::functionEntries::includeEtcEntry::log)
|
||||
{
|
||||
DetailInfo << fName << endl;
|
||||
// Report to stdout which file is included
|
||||
Info<< fName << nl;
|
||||
}
|
||||
parentDict.read(ifs);
|
||||
return true;
|
||||
@ -162,7 +163,8 @@ bool Foam::functionEntries::includeEtcEntry::execute
|
||||
{
|
||||
if (Foam::functionEntries::includeEtcEntry::log)
|
||||
{
|
||||
DetailInfo << fName << endl;
|
||||
// Report to stdout which file is included
|
||||
Info<< fName << nl;
|
||||
}
|
||||
entry.read(parentDict, ifs);
|
||||
return true;
|
||||
|
||||
@ -55,7 +55,7 @@ Foam::IOerror::IOerror(const dictionary& errDict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IOerror::~IOerror() throw()
|
||||
Foam::IOerror::~IOerror() noexcept
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ Foam::error::error(const error& err)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::error::~error() throw()
|
||||
Foam::error::~error() noexcept
|
||||
{
|
||||
delete messageStreamPtr_;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~error() throw();
|
||||
virtual ~error() noexcept;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
@ -239,7 +239,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IOerror() throw();
|
||||
virtual ~IOerror() noexcept;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -203,7 +203,7 @@ Foam::expressions::exprResultGlobals::get
|
||||
{
|
||||
WarningInFunction
|
||||
<< "No scope " << scopeName << " for " << name << nl
|
||||
<< "Known global scopes: " << variables_.sortToc() << nl;
|
||||
<< "Known global scopes: " << variables_.sortedToc() << nl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -60,6 +60,12 @@ public:
|
||||
TypeName("value");
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
valuePointPatchField(const valuePointPatchField&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
|
||||
@ -286,7 +286,7 @@ Foam::fileOperations::collatedFileOperation::collatedFileOperation
|
||||
"enabled, deactivate" << nl
|
||||
<< " threading by setting maxThreadFileBufferSize "
|
||||
"to 0 in" << nl
|
||||
<< " $FOAM_ETC/controlDict"
|
||||
<< " OpenFOAM etc/controlDict"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -723,17 +723,15 @@ Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
Pout<< "masterUncollatedFileOperation::readStream :"
|
||||
<< " Done reading " << buf.size() << " bytes" << endl;
|
||||
}
|
||||
const fileName& fName = filePaths[Pstream::myProcNo(comm)];
|
||||
isPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(buf),
|
||||
IOstream::BINARY,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
|
||||
// A local character buffer copy of the Pstream contents.
|
||||
// Construct with same parameters (ASCII, current version)
|
||||
// as the IFstream so that it has the same characteristics.
|
||||
|
||||
isPtr.reset(new IListStream(std::move(buf)));
|
||||
|
||||
// With the proper file name
|
||||
isPtr->name() = filePaths[Pstream::myProcNo(comm)];
|
||||
|
||||
if (!io.readHeader(isPtr()))
|
||||
{
|
||||
@ -2415,6 +2413,8 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
const fileName& filePath
|
||||
) const
|
||||
{
|
||||
autoPtr<ISstream> isPtr;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Insert logic of filePath. We assume that if a file is absolute
|
||||
@ -2497,10 +2497,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
if (Pstream::master(Pstream::worldComm))
|
||||
{
|
||||
// Read myself
|
||||
return autoPtr<ISstream>
|
||||
(
|
||||
new IFstream(filePaths[Pstream::masterNo()])
|
||||
);
|
||||
isPtr.reset(new IFstream(filePaths[Pstream::masterNo()]));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2522,26 +2519,23 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
<< " Done reading " << buf.size() << " bytes" << endl;
|
||||
}
|
||||
|
||||
// Note: IPstream is not an IStream so use a IStringStream to
|
||||
// convert the buffer. Note that we construct with a string
|
||||
// so it holds a copy of the buffer.
|
||||
return autoPtr<ISstream>
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(buf),
|
||||
IOstream::BINARY,
|
||||
IOstream::currentVersion,
|
||||
filePath
|
||||
)
|
||||
);
|
||||
// A local character buffer copy of the Pstream contents.
|
||||
// Construct with same parameters (ASCII, current version)
|
||||
// as the IFstream so that it has the same characteristics.
|
||||
|
||||
isPtr.reset(new IListStream(std::move(buf)));
|
||||
|
||||
// With the proper file name
|
||||
isPtr->name() = filePath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read myself
|
||||
return autoPtr<ISstream>(new IFstream(filePath));
|
||||
isPtr.reset(new IFstream(filePath));
|
||||
}
|
||||
|
||||
return isPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,13 +114,13 @@ Foam::interpolation2DTable<Type>::interpolation2DTable(const dictionary& dict)
|
||||
template<class Type>
|
||||
Foam::interpolation2DTable<Type>::interpolation2DTable
|
||||
(
|
||||
const interpolation2DTable& interpTable
|
||||
const interpolation2DTable& tbl
|
||||
)
|
||||
:
|
||||
List<value_type>(interpTable),
|
||||
bounding_(interpTable.bounding_),
|
||||
fileName_(interpTable.fileName_),
|
||||
reader_(interpTable.reader_) // note: steals reader. Used in write().
|
||||
List<value_type>(tbl),
|
||||
bounding_(tbl.bounding_),
|
||||
fileName_(tbl.fileName_),
|
||||
reader_(tbl.reader_.clone())
|
||||
{}
|
||||
|
||||
|
||||
@ -218,6 +218,24 @@ Foam::label Foam::interpolation2DTable<Type>::Xi
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::interpolation2DTable<Type>::operator=
|
||||
(
|
||||
const interpolation2DTable<Type>& rhs
|
||||
)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static_cast<List<value_type>&>(*this) = rhs;
|
||||
bounding_ = rhs.bounding_;
|
||||
fileName_ = rhs.fileName_;
|
||||
reader_.reset(rhs.reader_.clone());
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::interpolation2DTable<Type>::operator()
|
||||
(
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
explicit interpolation2DTable(const dictionary& dict);
|
||||
|
||||
//- Copy construct
|
||||
interpolation2DTable(const interpolation2DTable& interpTable);
|
||||
interpolation2DTable(const interpolation2DTable& tbl);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -135,6 +135,9 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Copy assignment
|
||||
void operator=(const interpolation2DTable<Type>& rhs);
|
||||
|
||||
//- Return an interpolated value
|
||||
Type operator()(const scalar valueX, const scalar valueY) const;
|
||||
|
||||
|
||||
@ -118,17 +118,16 @@ Foam::interpolationTable<Type>::interpolationTable(const dictionary& dict)
|
||||
template<class Type>
|
||||
Foam::interpolationTable<Type>::interpolationTable
|
||||
(
|
||||
const interpolationTable& interpTable
|
||||
const interpolationTable& tbl
|
||||
)
|
||||
:
|
||||
List<value_type>(interpTable),
|
||||
bounding_(interpTable.bounding_),
|
||||
fileName_(interpTable.fileName_),
|
||||
reader_(interpTable.reader_) // note: steals reader. Used in write().
|
||||
List<value_type>(tbl),
|
||||
bounding_(tbl.bounding_),
|
||||
fileName_(tbl.fileName_),
|
||||
reader_(tbl.reader_.clone())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -491,6 +490,24 @@ Foam::interpolationTable<Type>::interpolateValues
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::interpolationTable<Type>::operator=
|
||||
(
|
||||
const interpolationTable<Type>& rhs
|
||||
)
|
||||
{
|
||||
if (this == &rhs)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static_cast<List<value_type>&>(*this) = rhs;
|
||||
bounding_ = rhs.bounding_;
|
||||
fileName_ = rhs.fileName_;
|
||||
reader_.reset(rhs.reader_.clone());
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::Tuple2<Foam::scalar, Type>&
|
||||
Foam::interpolationTable<Type>::operator[](label idx) const
|
||||
|
||||
@ -135,7 +135,7 @@ public:
|
||||
explicit interpolationTable(const dictionary& dict);
|
||||
|
||||
//- Copy construct
|
||||
interpolationTable(const interpolationTable& interpTable);
|
||||
interpolationTable(const interpolationTable& tbl);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -172,6 +172,9 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Copy assignment
|
||||
void operator=(const interpolationTable<Type>& rhs);
|
||||
|
||||
//- Return an element of constant Tuple2<scalar, Type>
|
||||
const Tuple2<scalar, Type>& operator[](label idx) const;
|
||||
|
||||
|
||||
@ -73,6 +73,18 @@ class patchIdentifier
|
||||
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
patchIdentifier(const patchIdentifier&) = default;
|
||||
|
||||
//- Copy assignment
|
||||
patchIdentifier& operator=(const patchIdentifier&) = default;
|
||||
|
||||
//- Destructor
|
||||
virtual ~patchIdentifier() = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
@ -100,10 +112,6 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~patchIdentifier() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the patch name
|
||||
|
||||
@ -78,6 +78,15 @@ public:
|
||||
static const word emptyType;
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Copy construct
|
||||
surfZoneIdentifier(const surfZoneIdentifier&) = default;
|
||||
|
||||
//- Copy assignment
|
||||
surfZoneIdentifier& operator=(const surfZoneIdentifier&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null, with index zero
|
||||
|
||||
@ -82,15 +82,18 @@ void Foam::primitiveMesh::makeCellCentresAndVols
|
||||
{
|
||||
typedef Vector<solveScalar> solveVector;
|
||||
|
||||
// Clear the fields for accumulation. Note1: we're doing this before
|
||||
// any precision conversion since this might complain about illegal numbers.
|
||||
// Note2: zero is a special value which is perfectly converted into zero
|
||||
// in the new precision
|
||||
cellCtrs_s = Zero;
|
||||
cellVols_s = 0.0;
|
||||
|
||||
PrecisionAdaptor<solveVector, vector> tcellCtrs(cellCtrs_s);
|
||||
Field<solveVector>& cellCtrs = tcellCtrs.ref();
|
||||
PrecisionAdaptor<solveScalar, scalar> tcellVols(cellVols_s);
|
||||
Field<solveScalar>& cellVols = tcellVols.ref();
|
||||
|
||||
// Clear the fields for accumulation
|
||||
cellCtrs = Zero;
|
||||
cellVols = 0.0;
|
||||
|
||||
const labelList& own = faceOwner();
|
||||
const labelList& nei = faceNeighbour();
|
||||
|
||||
|
||||
@ -81,10 +81,19 @@ public:
|
||||
enum components { XX, XY, XZ, YY, YZ, ZZ };
|
||||
|
||||
|
||||
// Constructors
|
||||
// Generated Methods
|
||||
|
||||
//- Construct null
|
||||
inline SymmTensor();
|
||||
//- Default construct
|
||||
SymmTensor() = default;
|
||||
|
||||
//- Copy construct
|
||||
SymmTensor(const SymmTensor&) = default;
|
||||
|
||||
//- Copy assignment
|
||||
SymmTensor& operator=(const SymmTensor&) = default;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct initialized to zero
|
||||
inline SymmTensor(const Foam::zero);
|
||||
|
||||
@ -30,11 +30,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::SymmTensor<Cmpt>::SymmTensor()
|
||||
{}
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
inline Foam::SymmTensor<Cmpt>::SymmTensor(const Foam::zero)
|
||||
:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user