Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

Conflicts:
	src/turbulenceModels/Allwmake

Conflicts:
	src/turbulenceModels/Allwmake

Conflicts:
	src/turbulenceModels/Allwmake

Conflicts:
	src/turbulenceModels/Allwmake
This commit is contained in:
henry
2008-11-20 21:08:34 +00:00
283 changed files with 12956 additions and 8346 deletions

View File

@ -5,15 +5,15 @@ set -x
# wmake is required for subsequent targets
( cd wmake/src && make )
# build ThirdParty sources
( cd $WM_THIRD_PARTY_DIR && ./Allwmake )
( cd src && ./Allwmake )
( cd applications && ./Allwmake )
src/Allwmake
applications/Allwmake
if [ "$1" = doc ]
then
( cd doc && ./Allwmake )
doc/Allwmake
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -1,197 +0,0 @@
OpenFOAM README for version 1.5
1 Copyright
OpenFOAM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
See the file COPYING in this directory, for a description of the GNU General Public License terms under which you can
copy the files.
2 System requirements
OpenFOAM is developed and tested on Linux, but should work with other Unix style systems. To check your system setup,
execute the foamSystemCheck script in the bin/ directory of the OpenFOAM installation. If no problems are reported,
proceed to "3. Installation"; otherwise contact your system administrator.
If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the section "Running OpenFOAM in 32-bit mode".
2.1 Qt (from http://trolltech.com/products/qt)
The ParaView 3.3 visualisation package requires that Qt version 4.3.x MUST be installed on the system. Earlier or more
recent versions (4.2.x or 4.4.x) will NOT work. To check whether Qt4 is installed, and the version, type:
* qmake <div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Copyright</a></li>
<li><a href="#sec-2">2 System requirements</a>
<ul>
<li><a href="#sec-2.1">2.1 Qt (from http://trolltech.com/products/qt)</a></li>
</ul>
</li>
<li><a href="#sec-3">3 Installation</a>
<ul>
<li><a href="#sec-3.1">3.1 Installation in alternative locations</a></li>
</ul>
</li>
<li><a href="#sec-4">4 Building from Sources (Optional)</a></li>
<li><a href="#sec-5">5 Testing the installation</a></li>
<li><a href="#sec-6">6 Getting Started</a></li>
<li><a href="#sec-7">7 Compiling Paraview 3.3 and the PV3FoamReader module</a></li>
<li><a href="#sec-8">8 Documentation</a></li>
<li><a href="#sec-9">9 Help</a></li>
<li><a href="#sec-10">10 Reporting Bugs in OpenFOAM</a></li>
<li><a href="#sec-11">11 Running OpenFOAM in 32-bit mode on 64-bit machines</a></li>
</ul>
</div>
</div>
version
The ParaView binary executables in the ThirdParty distribution will only work with PRECISELY the same version of Qt
with which it was compiled. The 64-bit version of ParaView was compiled with Qt-4.3.1 (with openSuSE-10.3) and the
32-bit version of ParaView was compiled with Qt-4.3.2 (with ubuntu-7.10). If the user finds that a ParaView binary
fails to run, then it is almost certainly due to a conflict in compiled and installed Qt versions and they will need to
consult the section below on "Compiling ParaView and the PV3FoamReader module."
The default versions of Qt used by some GNU/Linux releases are as follows.
* ubuntu-7.10: Version 4.3.2
* ubuntu-8.04: Version 4.3.4
* openSuSE-10.2: Version 4.2.1 - too old
* openSuSE-10.3: Version 4.3.1
* openSuSE-11.0: Version 4.4.0 - too new
Compilation and running of ParaView has been successful using the libraries downloaded in the "libqt4-dev" package on
ubuntu.
If you don't have an appropriate version of Qt installed you can download the sources from TrollTech e.g.: ftp://
ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.bz2 and compile and install in /usr/local or some other
location that does to conflict with the pre-installed version.
3 Installation
Download and unpack the files in the $HOME/OpenFOAM directory as described in: http://www.OpenFOAM.org/download.html
The environment variable settings are contained in files in an etc/ directory in the OpenFOAM release. e.g. in
* $HOME/OpenFOAM/OpenFOAM-<VERSION>/etc/
* where <VERSION> corresponds to the version 1.4, 1.5, …
* EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'), source the etc/bashrc file by adding the following
line to the end of your $HOME/.bashrc file:
+ . $HOME/OpenFOAM/OpenFOAM-<VERSION>/etc/bashrc
Then update the environment variables by sourcing the $HOME/.bashrc file by typing in the terminal:
+ . $HOME/.bashrc
* OR, if running tcsh or csh, source the etc/cshrc file by adding the following line to the end of your $HOME/.cshrc
file:
+ source $HOME/OpenFOAM/OpenFOAM-<VERSION>/etc/cshrc
Then update the environment variables by sourcing the $HOME/.cshrc file by typing in the terminal:
+ source $HOME/.cshrc
3.1 Installation in alternative locations
OpenFOAM may also be installed in alternative locations. However, the installation directory should be network
available (e.g., NFS) if parallel calculations are planned.
The environment variable 'FOAM_INST_DIR' can be used to find and source the appropriate resource file. Here is a bash/
ksh/sh example:
* export FOAM_INST_DIR=/data/app/OpenFOAM
* foamDotFile=$FOAM_INST_DIR/OpenFOAM-<VERSION>/etc/bashrc
* [ -f $foamDotFile ] && . $foamDotFile
and a csh/tcsh example:
* setenv FOAM_INST_DIR /data/app/OpenFOAM
* foamDotFile=$FOAM_INST_DIR/OpenFOAM-<VERSION>/etc/bashrc
* if ( -f $foamDotFile ) source $foamDotFile
The value set in '$FOAM_INST_DIR' will be used to locate the remaining parts of the OpenFOAM installation.
4 Building from Sources (Optional)
If you cannot find an appropriate binary pack for your platform, you can build the complete OpenFOAM from the
source-pack. You will first need to compile or obtain a recent version of gcc (we recomend gcc-4.3.?) for your
platform, which may be obtained from http://gcc.gnu.org/.
Install the compiler in $WM_PROJECT_INST_DIR/ThirdParty/gcc-<GCC_VERSION>/platforms/$WM_ARCH$WM_COMPILER_ARCH/ and
change the gcc version number in $WM_PROJECT_DIR/etc/settings.sh and $WM_PROJECT_DIR/etc/settings.csh appropriately and
finally update the environment variables as in section 3.
Now go to the top-level source directory $WM_PROJECT_DIR and execute the top-level build script './Allwmake'. In
principle this will build everything, but if problems occur with the build order it may be necessary to update the
environment variables and re-execute 'Allwmake'. If you experience difficulties with building the source-pack, or your
platform is not currently supported, please contact <enquiries@OpenCFD.co.uk> to negotiate a support contract and we
will do the port and maintain it for future releases.
5 Testing the installation
To check your installation setup, execute the 'foamInstallationTest' script (in the bin/ directory of the OpenFOAM
installation). If no problems are reported, proceed to getting started with OpenFOAM; otherwise, go back and check you
have installed the software correctly and/or contact your system administrator.
6 Getting Started
Create a project directory within the $HOME/OpenFOAM directory named <USER>-<VERSION> (e.g. 'chris-1.5' for user chris
and OpenFOAM version 1.5) and create a directory named 'run' within it, e.g. by typing:
* mkdir -p $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run
Copy the 'tutorial' examples directory in the OpenFOAM distribution to the 'run' directory. If the OpenFOAM environment
variables are set correctly, then the following command will be correct:
* cp -r $WM_PROJECT_DIR/tutorials $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run
Run the first example case of incompressible laminar flow in a cavity:
* cd $HOME/OpenFOAM/${USER}-${WM_PROJECT_VERSION}/run/tutorials/icoFoam/cavity
* blockMesh
* icoFoam
* paraFoam
7 Compiling Paraview 3.3 and the PV3FoamReader module
A version of Qt 4.3.x must be installed to compile ParaView. The compilation is a fairly simple process using the
supplied buildParaView3.3-cvs script that has worked is our tests with other packages supplied in the ThirdParty
directory, namely cmake-2.4.6 and gcc-4.3.1. Execute the following:
* cd $FOAM_INST_DIR/ThirdParty
* rm -rf ParaView3.3-cvs/platforms
* buildParaView3.3-cvs
The PV3FoamReader module is an OpenFOAM utility that can be compiled in the usual manner as follows:
* cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader
* ./Allwclean
* ./Allwmake
8 Documentation
http://www.OpenFOAM.org/doc
9 Help
http://www.OpenFOAM.org http://www.OpenFOAM.org/discussion.html
10 Reporting Bugs in OpenFOAM
http://www.OpenFOAM.org/bugs.html
11 Running OpenFOAM in 32-bit mode on 64-bit machines
Linux users with a 64-bit machine may install either the OpenFOAM 32-bit version (linux) or the OpenFOAM 64-bit version
(linux64), or both. The 64-bit is the default mode on a 64-bit machine. To use an installed 32-bit version, the user
must set the environment variable WM_ARCH_OPTION to 32 before sourcing the etc/bashrc (or etc/cshrc) file.
Date: 26 August 2008
HTML generated by org-mode 6.06b in emacs 23

View File

@ -10,7 +10,7 @@
OpenFOAM-1.5 is is a significant upgrade to version 1.4 in ways which are
outlined below. This release passes all our standard tests and the tutorials
have been broadly checked. If there are any bugs, please report them using
the instructions set out in: http://www.openfoam.org/bugs.html.
the instructions set out in: http://www.OpenFOAM.org/bugs.html.
Most of the developments for this release are in: new applications, e.g. for
multiphase flow and cavitation, buoyancy-flow and heat transfer, high speed

View File

@ -1,208 +0,0 @@
OpenFOAM release notes for version 1.5
1 Overview
OpenFOAM-1.5 is is a significant upgrade to version 1.4 in ways which are
outlined below. This release passes all our standard tests and the tutorials
have been broadly checked. If there are any bugs, please report them using the
instructions set out in: http://www.openfoam.org/bugs.html.
Most of the developments for this release are in: new applications, e.g. for
multiphase flow and cavitation, buoyancy-flow and heat transfer, high speed
flows and even molecular dynamics; new utilities, e.g. for meshing and case
monitoring; and, new modelling, e.g. in Lagrangian particle tracking,
radiation and rotating frames of reference. With these new applications come
numerous new example cases.
2 GNU/Linux version
The 64bit binary packs of the OpenFOAM release were compiled on a machine
running SuSE GNU/Linux version 10.3 and the 32bit on a machine running Ubuntu
GNU/Linux version 7.1 and also tested on Ubuntu 8.04. We recommend that users
run OpenFOAM on one of these or a similar recent version of GNU/Linux. This
release has also been successfully compiled and tested on older GNU/Linux
releases but this re<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Overview</a></li>
<li><a href="#sec-2">2 GNU/Linux version</a></li>
<li><a href="#sec-3">3 C++ Compiler version</a></li>
<li><a href="#sec-4">4 Developments to solvers (applications)</a></li>
<li><a href="#sec-5">5 Automatic mesher</a></li>
<li><a href="#sec-6">6 Developments to utilities</a></li>
<li><a href="#sec-7">7 Migration from ParaView 2.4 to ParaView 3.x</a></li>
<li><a href="#sec-8">8 Model development</a></li>
<li><a href="#sec-9">9 New functionObjects</a></li>
<li><a href="#sec-10">10 Improvements to boundary conditions</a></li>
<li><a href="#sec-11">11 Other</a></li>
</ul>
</div>
</div>
quires the installation of Qt 4.3.? for ParaView-3 to run.
3 C++ Compiler version
* Released compiled with GCC 4.3.1, the latest version.
* Built in support for the Intel C++ 10.? compiler (untested).
* The choice of the compiler is controlled by the setting of the
$WM_COMPILER and $WM_COMPILER_ARCH environment variables in the
OpenFOAM-1.5/etc/bashrc (or cshrc) file.
* The location of the installation of the compiler is controlled by the
$compilerInstall environment variable in the OpenFOAM-1.5/etc/settings.sh
(or settings.csh) file.
4 Developments to solvers (applications)
* New rhoCentralFoam solver for high-speed, viscous, compressible flows
using non-oscillatory, central-upwind schemes.
* New interDyMFoam solver for 2 incompressible, isothermal, immiscible
fluids using a VoF phase-fraction based interface capturing approach, with
optional mesh motion and mesh topology changes including adaptive mesh
(un)refinement. Useful for simulations such as tank filling, sloshing ---
using solid body motion e.g. SDA or SKA (6DoF) — and slamming (using the
mesh motion solver) and other large-scale applications that benefit from
the efficiency gain of adaptive mesh (un)refinement of the interface.
* New compressibleInterFoam solver for 2 compressible, isothermal,
immiscible fluids using a volume of fluid (VoF) phase-fraction approach
for interface-capturing. The momentum and other fluid properties are of
the "mixture" and a single momentum equation is solved. Turbulence is
modelled using a run-time selectable incompressible LES model.
* New interPhaseChangeFoam solver for 2 incompressible, isothermal,
immiscible fluids with phase-change, e.g. cavitation. Uses VoF interface
capturing, with momentum and other fluid properties described for the
``mixture'' and a single momentum equation is solved. The set of
phase-change models provided are designed to simulate cavitation but other
mechanisms of phase-change are supported within this solver framework.
* New rasCavitatingFoam solver for transient cavitation using a barotropic
compressibility model, with RAS turbulence.
* New lesCavitatingFoam solver for transient cavitation using a barotropic
compressibility model, with LES turbulence.
* New chtMultiRegionFoam solver that couples conjugate heat transfer in a
solid to a buoyancy-driven flow simulation.
* New PDRFoam solver for compressible premixed/partially-premixed turbulent
combustion that includes porosity/distributed resistance (PDR) modelling
to handle regions containing solid blockages which cannot be resolved by
the mesh. Requires the PDR fields.
* New lesBuoyantFoam solver for transient, buoyant, turbulent flow of
compressible fluids for ventilation and heat-transfer. Turbulence is
modelled using a run-time selectable compressible LES model.
* New rhoPimpleFoam solver for transient, turbulent flow of compressible
fluids for ventilation and heat-transfer. Uses the flexible PIMPLE
(PISO-SIMPLE) solution for time-resolved and pseudo-transient simulations.
* New buoyantSimpleRadiationFoam solver for steady-state, buoyant, turbulent
flow of compressible fluids with radiation, for ventilation and
heat-transfer.
* New rhoTurbTwinParcelFoam solver for transient for compressible, turbulent
flow with two thermo-clouds.
* New gnemdFOAM solver for general purpose molecular dynamics that simulates
atoms in arbitrary shaped domains and average atomic/molecular quantities
to the mesh to create field data.
* New mdEqulibrationFoam solver to equilibrates and/or preconditions
molecular dynamics systems.
* Demonstration SRFSimpleFoam solver based on simpleFoam that incorporates
the SRF extensions (see below) for rotating flows.
5 Automatic mesher
New snappyHexMesh utility that generates split-hex meshes automatically from
triangulated (STL) surface geometries. The mesh approximately conforms to the
surface by iteratively refining a starting mesh and morphing the resulting
split-hex mesh to the surface. An optional phase will shrink back the
resulting mesh and insert cell layers. It has a flexible specification of mesh
refinement level and robust surface handling with a pre-specified final mesh
quality. It runs in parallel with a load balancing step every iteration.
6 Developments to utilities
* New extrude2DMesh utility that extrudes 2D meshes into a 3D mesh. 2D
meshes are described by faces with 2 points, so can be used in combination
with 2D meshes converted with ccm26ToFoam.
* New couplePatches functionality integrated into createPatch, which
optionally synchronises ("couples") points and faces of coupled (cyclic,
processor) patches.
* New applyBoundaryLayer pre-processing utility to apply 1/7th power-law
boundary layers at walls, starting from uniform or potential flow
solutions.
* New execFlowFunctionObjects utility executes functionObjects as a
post-processing activity, e.g. probes, sampling, force calculation.
* New changeDictionary utility makes batch changes to OpenFOAM input files,
e.g. to change boundary conditions of field files.
* New foamCalc utility, a generic post-processing field calculator tool
* New molConfig pre-processing utility for molecular dynamics cases. Fills
zones of a mesh with single crystal lattices of specified structure,
density, orientation, alignment and temperature.
* Extended splitMeshRegions utility to split multi-zone meshes, e.g. defined
through cellZones, into separate meshes.
* Extended the foamToVTK, decomposePar, reconstructPar and mapFields
utilities to include support for multiple particle clouds in parallel
processing.
7 Migration from ParaView 2.4 to ParaView 3.x
* Rewritten OpenFOAM Reader Module for version 3, a major redesign of
ParaView.
* New features include viewing patch names, reading of Lagrangian data,
handling of cell, face and point sets, multiple views.
8 Model development
* Overhauled the lagrangian library to support multiple clouds.
* New lagrangianIntermediate library incorporating a hierarchy of parcel and
cloud types, accommodating kinematic, thermodynamic and reacting
applications, including coupling to the new radiation library. Sub-models
are added at the relevant level of physics, e.g.:
+ kinematic: injection, wall interaction, drag, dispersion;
+ thermo: heat transfer;
+ reacting: reacting composition, mass transfer, surface reactions.
* New single rotating frame of reference (SRF) library for rotating flow
applications, e.g. turbo-machinery.
* New radiation library including the P1 model and associated Marshak
boundary conditions for incident radiation.
* New displacementInterpolation motion solver for flexible mesh scaling.
* New molecularDynamics Lagrangian library to calculate intermolecular
forces between spherically symmetrical monatomic species in arbitrary
geometries.
9 New functionObjects
To aid common monitoring and post-processing activities.
* forces: calculate the force and moment on a patch or set of patches, e.g.
to calculate the lift, drag and moment of an object in the flow.
* forceCoeffs: calculate the normalised force and moment on a patch or set
of patches, e.g. to calculate the lift, drag and moment coefficients of an
object in the flow.
* fieldAverage: calculate field arithmetic mean and prime-squared averages
for a list of fields.
* foamCalcFunctions: calculate field components, div, mag, magGrad or
magSqr.
10 Improvements to boundary conditions
* Generalised jumpCyclic type: cyclic condition with an additional
prescribed jump in value.
* fan type: specialisation of jumpCyclic, applying a prescribed jump in
pressure to simulate a fan within a mesh.
* Generalised advective outflow boundary condition based on solving D/Dt
(psi, U) = 0 at the boundary.
* Additional turbulent flow inlet to specify mixing length and frequency.
* Generalisation of time varying set of boundary conditions.
11 Other
* New argument-free command execution, e.g typing "icoFoam" without root and
case directory arguments.
* Extended time command line options.
* Many enhancements to dictionary including macro substitution, optional
merging and default/overwrite behaviour, enhanced "#include" file handling
and the framework to support function evaluation.
* Cross-links between applications and Doxygen documentation with the "-doc"
argument.
* Non-blocking, non-buffered, parallel transfers with potential scaling
benefits for larger number of processors.
Date: 07 October 2008
HTML generated by org-mode 6.06b in emacs 23

View File

@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
( cd solvers && wmake all )
( cd utilities && wmake all )
wmake all solvers
wmake all utilities
# ----------------------------------------------------------------- end-of-file

View File

@ -26,7 +26,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "labelHashSet.H"
#include "HashSet.H"
#include "Map.H"
using namespace Foam;
@ -35,19 +36,80 @@ using namespace Foam;
int main(int argc, char *argv[])
{
HashSet<Foam::string> testSet(0);
wordHashSet setA(0);
HashTable<label, word> tableA;
testSet.insert("kjhk");
testSet.insert("kjhk2");
HashTable<empty> tableB;
Map<label> mapA;
Info<< testSet << endl;
setA.insert("kjhk");
setA.insert("kjhk2");
labelHashSet testLabelHashSet(1);
tableA.insert("value1", 1);
tableA.insert("value2", 2);
tableA.insert("value3", 3);
testLabelHashSet.insert(11);
testLabelHashSet.insert(42);
tableB.insert("value4", empty());
tableB.insert("value5", empty());
tableB.insert("value6", empty());
Info<< testLabelHashSet << endl;
mapA.set(1, 1);
mapA.set(2, 2);
mapA.set(3, 3);
mapA.set(4, 4);
Info<< setA << endl;
Info<< tableA << endl;
Info<< mapA << endl;
Info<< "create from HashSet: ";
Info<< wordHashSet(setA) << endl;
Info<< "create from HashTable<T>: ";
Info<< wordHashSet(tableA) << endl;
Info<< "create from HashTable<empty>: ";
Info<< wordHashSet(tableB) << endl;
Info<< "create from Map<label>: ";
Info<< labelHashSet(mapA) << endl;
Info<<"combined toc: "
<< (wordHashSet(setA) | wordHashSet(tableA) | wordHashSet(tableB))
<< nl;
labelHashSet setB(1);
setB.insert(11);
setB.insert(42);
Info<< "setB : " << setB << endl;
labelHashSet setC(1);
setC.insert(2008);
setC.insert(1984);
Info<< "setC : " << setC << endl;
labelHashSet setD(1);
setD.insert(11);
setD.insert(100);
setD.insert(2008);
Info<< "setD : " << setD << endl;
Info<< "setB == setC: " << (setB == setC) << endl;
Info<< "setC != setD: " << (setC != setD) << endl;
// test operations
setB += setC;
Info<< "setB += setC : " << setB << endl;
setB &= setD;
Info<< "setB &= setD : " << setB << endl;
Info<< "setB : " << setB << endl;
Info<< "setC : " << setC << endl;
Info<< "setD : " << setD << endl;
Info<< "setB ^ setC ^ setD : " << (setB ^ setC ^ setD) << endl;
return 0;
}

View File

@ -26,7 +26,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "labelList.H"
#include "SortableList.H"
using namespace Foam;
@ -35,16 +35,40 @@ using namespace Foam;
int main(int argc, char *argv[])
{
labelList a(5);
a[0] = 7;
a[1] = 4;
a[2] = 1;
a[3] = 2;
a[4] = 9;
labelList orig(5);
orig[0] = 7;
orig[1] = 4;
orig[2] = 1;
orig[3] = 2;
orig[4] = 9;
labelList a(orig);
Info << "before: " << a << endl;
sort(a);
Info << "after: " << a << endl;
Info << "after: " << a << endl;
SortableList<label> b(orig);
Info << "sorted: " << b << endl;
Info << "indices: " << b.indices() << endl;
Info << "shrunk: " << b.shrink() << endl;
Info << "indices: " << b.indices() << endl;
// repeat by assignment
b = orig;
Info << "unsorted: " << b << endl;
b.sort();
Info << "sorted: " << b << endl;
Info << "indices: " << b.indices() << endl;
// transfer assignment
b.transfer(orig);
Info << "unsorted: " << b << endl;
b.sort();
Info << "sorted: " << b << endl;
Info << "indices: " << b.indices() << endl;
Info << "End\n" << endl;

View File

@ -206,9 +206,9 @@ int main(int argc, char *argv[])
runTime.timeName(),
runTime
),
mesh.points(),
mesh.faces(),
mesh.cells()
xferCopy(mesh.points()), // could we safely re-use the data?
xferCopy(mesh.faces()),
xferCopy(mesh.cells())
);
// Add the boundary patches

View File

@ -7,14 +7,12 @@ set -x
# build libccmio and create lnInclude directory
(
cd $WM_THIRD_PARTY_DIR && ./AllwmakeLibccmio
)
( cd $WM_THIRD_PARTY_DIR && ./AllwmakeLibccmio )
# if the library built okay, the headers should exist too
# if the library built properly, the headers should exist too
if [ -e $FOAM_LIBBIN/libccmio.so ]
then
wmake ccm26ToFoam
wmake ccm26ToFoam
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -281,7 +281,7 @@ int main(int argc, char *argv[])
)
{
// Scale points for the given scale factor
points[i++] = scaleFactor*pointIter();
points[i++] = scaleFactor * pointIter();
}
@ -479,7 +479,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cellShapes,
boundary,
patchNames,

View File

@ -727,7 +727,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cellShapes,
boundary,
patchNames,

View File

@ -883,10 +883,10 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
pointField(0),
faceList(0),
labelList(0),
labelList(0)
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList())
);

View File

@ -1158,7 +1158,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cellShapes,
patches,
patchNames,

View File

@ -851,7 +851,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cells,
boundary,
patchNames,

View File

@ -38,7 +38,7 @@ Description
fluentMeshWithInternalFaces).
A use of the cell zone information, is for field initialization with the
"setFields" utility. see the classes: topoSetSource, zoneToCell.
"setFields" utility. see the classes: topoSetSource, zoneToCell.
\*---------------------------------------------------------------------------*/
#include "argList.H"
@ -166,7 +166,7 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
if (nMatched == meshF.size())
{
return faceI;
}
}
}
return -1;
}
@ -835,7 +835,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cells,
boundaryFaces,
boundaryPatchNames,
@ -951,7 +951,7 @@ int main(int argc, char *argv[])
{
zoneName = iter();
}
Info<< "Writing zone " << zoneI << " to cellZone "
<< zoneName << " and cellSet"
<< endl;

View File

@ -572,6 +572,7 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append(".unv file");
argList::validOptions.insert("dump", "");
# include "setRootCase.H"
# include "createTime.H"
@ -806,7 +807,7 @@ int main(int argc, char *argv[])
forAll(dynPatchFaces, patchI)
{
patchFaceVerts[patchI].transfer(dynPatchFaces[patchI].shrink());
patchFaceVerts[patchI].transfer(dynPatchFaces[patchI]);
}
}
else
@ -845,13 +846,13 @@ int main(int argc, char *argv[])
pointField polyPoints;
polyPoints.transfer(points);
points.clear();
// Length scaling factor
polyPoints /= lengthScale;
// For debugging: dump boundary faces as triSurface
if (args.options().found("dump"))
{
DynamicList<labelledTri> triangles(boundaryFaces.size());
@ -887,7 +888,6 @@ int main(int argc, char *argv[])
}
Info<< "Constructing mesh with non-default patches of size:" << nl;
forAll(patchNames, patchI)
{
@ -907,14 +907,14 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
polyPoints,
xferMove(polyPoints),
cellVerts,
patchFaceVerts, //boundaryFaces,
patchNames, //boundaryPatchNames,
wordList(patchNames.size(), polyPatch::typeName), //boundaryPatchTypes,
"defaultFaces", //defaultFacesName
polyPatch::typeName, //defaultFacesType,
wordList(0) //boundaryPatchPhysicalTypes
patchFaceVerts, // boundaryFaces,
patchNames, // boundaryPatchNames,
wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes,
"defaultFaces", // defaultFacesName
polyPatch::typeName, // defaultFacesType,
wordList(0) // boundaryPatchPhysicalTypes
);
mesh.write();

View File

@ -576,7 +576,7 @@ polyMesh pShapeMesh
runTime.constant(),
runTime
),
points,
xferMove(points),
cellShapes,
boundary,
patchNames,

View File

@ -140,7 +140,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cells,
faceListList(0),
wordList(0),
@ -153,7 +153,7 @@ int main(int argc, char *argv[])
Info<< "Writing mesh ..." << endl;
mesh.write();
Info<< "End\n" << endl;

View File

@ -306,7 +306,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cells,
patchFaces,
patchNames,

View File

@ -232,7 +232,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
newPoints,
xferMove(newPoints),
cellShapes,
boundary,
patchNames,

View File

@ -47,7 +47,7 @@ void sammMesh::writeMesh()
runTime_.constant(),
runTime_
),
points_,
xferCopy(points_), // we could probably re-use the data
cellShapes_,
boundary_,
patchNames_,
@ -76,9 +76,9 @@ void sammMesh::writeMesh()
runTime_.constant(),
runTime_
),
points_,
meshFaces_,
cellPolys_
xferCopy(points_), // we could probably re-use the data
xferCopy(meshFaces_),
xferCopy(cellPolys_)
);
pMesh.addPatches(polyBoundaryPatches(pMesh));

View File

@ -51,7 +51,7 @@ void starMesh::writeMesh()
runTime_.constant(),
runTime_
),
points_,
xferCopy(points_), // we could probably re-use the data
cellShapes_,
boundary_,
patchNames_,
@ -82,9 +82,9 @@ void starMesh::writeMesh()
runTime_.constant(),
runTime_
),
points_,
meshFaces_,
cellPolys_
xferCopy(points_), // we could probably re-use the data
xferCopy(meshFaces_),
xferCopy(cellPolys_)
);
// adding patches also checks the mesh

View File

@ -322,11 +322,11 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferCopy(points),
cells,
faceListList(0),
wordList(0), //boundaryPatchNames
wordList(0), //boundaryPatchTypes
wordList(0), // boundaryPatchNames
wordList(0), // boundaryPatchTypes
"defaultFaces",
polyPatch::typeName,
wordList(0)
@ -531,7 +531,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
points,
xferMove(points),
cells,
patchFaces,
patchNames,

View File

@ -1,4 +0,0 @@
argList::noParallel();
argList::validOptions.insert("blockTopology", "");
argList::validOptions.insert("dict", "dictionary");
# include "addRegionOption.H"

View File

@ -27,7 +27,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,18 +28,12 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void block::blockBoundary()
void Foam::block::blockBoundary()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
@ -212,9 +206,4 @@ void block::blockBoundary()
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,18 +28,11 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void block::blockCells()
void Foam::block::blockCells()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
@ -69,9 +62,4 @@ void block::blockCells()
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -32,21 +32,16 @@ Description
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from IOdictionary
blockMesh::blockMesh(IOdictionary& meshDescription)
Foam::blockMesh::blockMesh(IOdictionary& meshDescription)
:
topologyPtr_(createTopology(meshDescription)),
scale_(readScalar(meshDescription.lookup("convertToMeters"))),
blockOffsets_(createBlockOffsets()),
mergeList_(createMergeList()),
points_(createPoints()),
points_(createPoints(meshDescription)),
cells_(createCells()),
patches_(createPatches())
{}
@ -54,7 +49,7 @@ blockMesh::blockMesh(IOdictionary& meshDescription)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
blockMesh::~blockMesh()
Foam::blockMesh::~blockMesh()
{
delete topologyPtr_;
}
@ -62,7 +57,7 @@ blockMesh::~blockMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const polyMesh& blockMesh::topology() const
const Foam::polyMesh& Foam::blockMesh::topology() const
{
if (!topologyPtr_)
{
@ -75,13 +70,7 @@ const polyMesh& blockMesh::topology() const
}
const curvedEdgeList& blockMesh::edges() const
{
return edges_;
}
wordList blockMesh::patchNames() const
Foam::wordList Foam::blockMesh::patchNames() const
{
const polyPatchList& patchTopologies = topology().boundaryMesh();
wordList names(patchTopologies.size());
@ -95,7 +84,7 @@ wordList blockMesh::patchNames() const
}
wordList blockMesh::patchTypes() const
Foam::wordList Foam::blockMesh::patchTypes() const
{
const polyPatchList& patchTopologies = topology().boundaryMesh();
wordList types(patchTopologies.size());
@ -109,7 +98,7 @@ wordList blockMesh::patchTypes() const
}
wordList blockMesh::patchPhysicalTypes() const
Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
{
const polyPatchList& patchTopologies = topology().boundaryMesh();
wordList physicalTypes(patchTopologies.size());
@ -123,7 +112,7 @@ wordList blockMesh::patchPhysicalTypes() const
}
label blockMesh::numZonedBlocks() const
Foam::label Foam::blockMesh::numZonedBlocks() const
{
label num = 0;
@ -139,7 +128,7 @@ label blockMesh::numZonedBlocks() const
}
void blockMesh::writeTopology(Ostream& os) const
void Foam::blockMesh::writeTopology(Ostream& os) const
{
const pointField& pts = topology().points();
@ -160,9 +149,4 @@ void blockMesh::writeTopology(Ostream& os) const
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -62,8 +62,6 @@ class blockMesh
polyMesh* topologyPtr_;
scalar scale_;
labelList blockOffsets_;
labelList mergeList_;
@ -94,7 +92,7 @@ class blockMesh
labelList createBlockOffsets();
labelList createMergeList();
pointField createPoints();
pointField createPoints(const dictionary&);
cellShapeList createCells();
faceList createPatchFaces(const polyPatch& patchTopologyFaces);
@ -123,7 +121,10 @@ public:
const polyMesh& topology() const;
const curvedEdgeList& edges() const;
const curvedEdgeList& edges() const
{
return edges_;
}
const pointField& points() const
{

View File

@ -72,11 +72,11 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addOptions.H"
argList::validOptions.insert("blockTopology", "");
argList::validOptions.insert("dict", "dictionary");
# include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
# include "checkOptions.H"
word regionName;
fileName polyMeshDir;
@ -117,6 +117,7 @@ int main(int argc, char *argv[])
}
}
bool writeTopo = args.options().found("blockTopology");
IOobject meshDictIo
(
@ -139,7 +140,7 @@ int main(int argc, char *argv[])
}
Info<< nl << "Creating block mesh from\n "
<< meshDictIo.objectPath() << endl;
<< meshDictIo.objectPath() << nl << endl;
IOdictionary meshDict(meshDictIo);
@ -216,7 +217,7 @@ int main(int argc, char *argv[])
runTime.constant(),
runTime
),
blocks.points(),
xferCopy(blocks.points()), // could we re-use space?
blocks.cells(),
blocks.patches(),
patchNames,
@ -242,7 +243,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
//#include "mergePatchPairs.H"
//// #include "mergePatchPairs.H"
}
else
{
@ -316,7 +317,7 @@ int main(int argc, char *argv[])
{
label zoneI = iter();
cz[zoneI]= new cellZone
cz[zoneI] = new cellZone
(
iter.key(),
zoneCells[zoneI].shrink(),
@ -339,7 +340,7 @@ int main(int argc, char *argv[])
IOstream::defaultPrecision(10);
Info << nl << "Writing polyMesh" << endl;
mesh.removeFiles(mesh.instance());
mesh.removeFiles();
if (!mesh.write())
{
FatalErrorIn(args.executable())

View File

@ -28,17 +28,11 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void block::blockPoints()
void Foam::block::blockPoints()
{
// set local variables for mesh specification
const label ni = blockDef_.n().x();
@ -235,9 +229,4 @@ void block::blockPoints()
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,16 +28,10 @@ Description
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Check the blockMesh topology
void blockMesh::checkBlockMesh(const polyMesh& bm)
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
{
Info<< nl << "Check block mesh topology" << endl;
@ -148,9 +142,4 @@ void blockMesh::checkBlockMesh(const polyMesh& bm)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1 +0,0 @@
bool writeTopo = args.options().found("blockTopology");

View File

@ -27,17 +27,11 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
labelList blockMesh::createBlockOffsets()
Foam::labelList Foam::blockMesh::createBlockOffsets()
{
Info<< nl << "Creating block offsets" << endl;
@ -63,10 +57,4 @@ labelList blockMesh::createBlockOffsets()
return BlockOffsets;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -29,14 +29,9 @@ License
#include "blockMesh.H"
#include "cellModeller.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
cellShapeList blockMesh::createCells()
Foam::cellShapeList Foam::blockMesh::createCells()
{
Info<< nl << "Creating cells" << endl;
@ -76,10 +71,4 @@ cellShapeList blockMesh::createCells()
return cells;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,9 @@ License
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
labelList blockMesh::createMergeList()
Foam::labelList Foam::blockMesh::createMergeList()
{
Info<< nl << "Creating merge list " << flush;
@ -277,7 +272,7 @@ labelList blockMesh::createMergeList()
if (cp[blockPfaceFacePointLabel] == -1)
{
FatalErrorIn("blockMesh::createMergeList()")
<< "Inconsistent point locations between block pair "
<< "Inconsistent point locations between block pair "
<< blockPlabel << " and " << blockNlabel << nl
<< " probably due to inconsistent grading."
<< exit(FatalError);
@ -561,9 +556,4 @@ labelList blockMesh::createMergeList()
return MergeList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -29,14 +29,9 @@ Description
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
faceList blockMesh::createPatchFaces
Foam::faceList Foam::blockMesh::createPatchFaces
(
const polyPatch& patchTopologyFaces
)
@ -157,7 +152,7 @@ faceList blockMesh::createPatchFaces
}
faceListList blockMesh::createPatches()
Foam::faceListList Foam::blockMesh::createPatches()
{
Info<< "\nCreating patches\n";
@ -173,9 +168,4 @@ faceListList blockMesh::createPatches()
return patches;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,24 +28,26 @@ Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
pointField blockMesh::createPoints()
Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
{
Info<< nl << "Creating points" << endl;
blockMesh& blocks = *this;
scalar scaleFactor = 1.0;
// optional 'convertToMeters' (or 'scale'?)
if (!dict.readIfPresent("convertToMeters", scaleFactor))
{
dict.readIfPresent("scale", scaleFactor);
}
Info<< nl << "Creating points with scale " << scaleFactor << endl;
pointField points(nPoints_);
blockMesh& blocks = *this;
forAll(blocks, blockLabel)
{
const pointField& blockPoints = blocks[blockLabel].points();
@ -59,17 +61,11 @@ pointField blockMesh::createPoints()
blockPointLabel
+ blockOffsets_[blockLabel]
]
] = scale_*blockPoints[blockPointLabel];
] = scaleFactor * blockPoints[blockPointLabel];
}
}
return points;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -40,9 +40,9 @@ bool Foam::blockMesh::blockLabelsOK
{
bool ok = true;
for (int i=0; i<blockShape.size(); i++)
forAll(blockShape, blockI)
{
if (blockShape[i] < 0)
if (blockShape[blockI] < 0)
{
ok = false;
@ -52,10 +52,10 @@ bool Foam::blockMesh::blockLabelsOK
"(const label blockLabel, const pointField& points, "
"const cellShape& blockShape)"
) << "block " << blockLabel
<< " point label " << blockShape[i]
<< " point label " << blockShape[blockI]
<< " less than zero" << endl;
}
else if (blockShape[i] >= points.size())
else if (blockShape[blockI] >= points.size())
{
ok = false;
@ -65,7 +65,7 @@ bool Foam::blockMesh::blockLabelsOK
"(const label blockLabel, const pointField& points, "
"const cellShape& blockShape)"
) << "block " << blockLabel
<< " point label " << blockShape[i]
<< " point label " << blockShape[blockI]
<< " larger than " << points.size() - 1
<< " the largest defined point label" << endl;
}
@ -84,38 +84,34 @@ bool Foam::blockMesh::patchLabelsOK
{
bool ok = true;
for (label facei=0; facei<patchFaces.size(); facei++)
forAll(patchFaces, faceI)
{
const labelList& labels = patchFaces[facei];
const labelList& f = patchFaces[faceI];
for (int i=0; i<labels.size(); i++)
forAll(f, fp)
{
if (labels[i] < 0)
if (f[fp] < 0)
{
ok = false;
WarningIn
(
"bool Foam::blockMesh::patchLabelsOK"
"(const label patchLabel, const pointField& points, "
"const faceList& patchFaces)"
"bool Foam::blockMesh::patchLabelsOK(...)"
) << "patch " << patchLabel
<< " face " << facei
<< " point label " << labels[i]
<< " face " << faceI
<< " point label " << f[fp]
<< " less than zero" << endl;
}
else if (labels[i] >= points.size())
else if (f[fp] >= points.size())
{
ok = false;
WarningIn
(
"bool Foam::blockMesh::patchLabelsOK"
"(const label patchLabel, const pointField& points, "
"const faceList& patchFaces)"
"bool Foam::blockMesh::patchLabelsOK(...)"
) << "patch " << patchLabel
<< " face " << facei
<< " point label " << labels[i]
<< " face " << faceI
<< " point label " << f[fp]
<< " larger than " << points.size() - 1
<< " the largest defined point label" << endl;
}
@ -137,23 +133,13 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
word defaultPatchName = "defaultFaces";
word defaultPatchType = emptyPolyPatch::typeName;
// get names and types for the unassigned patch faces
if (meshDescription.found("defaultPatch"))
// get names/types for the unassigned patch faces
// this is a bit heavy handed (and ugly), but there is currently
// no easy way to rename polyMesh patches subsequently
if (const dictionary* dictPtr = meshDescription.subDictPtr("defaultPatch"))
{
const dictionary& defaultPatch =
meshDescription.subDict("defaultPatch");
// this is a bit heavy handed (and ugly), but there is currently
// no easy way to rename polyMesh patches subsequently
if (defaultPatch.found("name"))
{
defaultPatch.lookup("name") >> defaultPatchName;
}
if (defaultPatch.found("type"))
{
defaultPatch.lookup("type") >> defaultPatchType;
}
dictPtr->readIfPresent("name", defaultPatchName);
dictPtr->readIfPresent("type", defaultPatchType);
}
Info<< nl << "Creating blockCorners" << endl;
@ -439,7 +425,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
IOobject::NO_WRITE,
false
),
tmpBlockPoints,
xferMove(tmpBlockPoints),
tmpBlockCells,
tmpBlocksPatches,
patchNames,
@ -456,4 +442,3 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
// ************************************************************************* //

View File

@ -1,4 +1,4 @@
Info<< nl << "Creating merge patch pairs" << nl << endl;
Info<< "Creating merge patch pairs" << nl << endl;
if (mergePatchPairs.size() > 0)
{

View File

@ -48,7 +48,7 @@ template
template<class> class FaceList,
class PointField
>
Foam::pointField Foam::extrudedMesh::extrudedPoints
Foam::xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
(
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
@ -76,12 +76,13 @@ Foam::pointField Foam::extrudedMesh::extrudedPoints
}
}
return ePoints;
// return points for transferring
return xferMove(ePoints);
}
template<class Face, template<class> class FaceList, class PointField>
Foam::faceList Foam::extrudedMesh::extrudedFaces
Foam::xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
(
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
@ -177,12 +178,13 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces
);
}
return eFaces;
// return points for transferring
return xferMove(eFaces);
}
template<class Face, template<class> class FaceList, class PointField>
Foam::cellList Foam::extrudedMesh::extrudedCells
Foam::xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
(
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
@ -283,7 +285,8 @@ Foam::cellList Foam::extrudedMesh::extrudedCells
facei++;
}
return eCells;
// return points for transferring
return xferMove(eCells);
}

View File

@ -63,26 +63,26 @@ class extrudedMesh
//- Construct and return the extruded mesh points
template<class Face, template<class> class FaceList, class PointField>
pointField extrudedPoints
xfer<pointField> extrudedPoints
(
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
const extrudeModel&
);
//- Construct and return the extruded mesh faces
template<class Face, template<class> class FaceList, class PointField>
faceList extrudedFaces
xfer<faceList> extrudedFaces
(
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
const extrudeModel&
);
//- Construct and return the extruded mesh cells
template<class Face, template<class> class FaceList, class PointField>
cellList extrudedCells
xfer<cellList> extrudedCells
(
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
const extrudeModel&
);
@ -101,9 +101,9 @@ public:
template<class Face, template<class> class FaceList, class PointField>
extrudedMesh
(
const IOobject& io,
const IOobject&,
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model
const extrudeModel&
);
};

View File

@ -374,9 +374,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
mirrorMeshPtr_ = new fvMesh
(
io,
newPoints,
newFaces,
newCells
xferMove(newPoints),
xferMove(newFaces),
xferMove(newCells)
);
fvMesh& pMesh = *mirrorMeshPtr_;

View File

@ -2,8 +2,9 @@
cd ${0%/*} || exit 1 # run from this directory
READLINE=0
if [ -f /usr/include/readline/readline.h ]; then
echo "Found readline/readline.h include file. Enabling readline support."
if [ -f /usr/include/readline/readline.h ]
then
echo "Found readline/readline.h -- enabling readline support."
READLINE=1
export READLINELINK="-lreadline -lncurses"
break

View File

@ -45,7 +45,7 @@ SourceFiles
#ifndef regionSide_H
#define regionSide_H
#include "labelHashSet.H"
#include "HashSet.H"
#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -272,9 +272,9 @@ bool domainDecomposition::writeDecomposition()
"constant",
processorDb
),
procPoints,
procFaces,
procCells
xferMove(procPoints),
xferMove(procFaces),
xferMove(procCells)
);
// Create processor boundary patches

View File

@ -506,9 +506,9 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ
),
pointField(0),
faceList(0),
cellList(0)
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(cellList())
);
for (label procI = 0; procI < nProcs; procI++)

View File

@ -70,10 +70,10 @@ autoPtr<fvMesh> createMesh
runTime,
IOobject::MUST_READ
),
pointField(0),
faceList(0),
labelList(0),
labelList(0)
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList())
);
if (!haveMesh)

View File

@ -2,7 +2,7 @@
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.openfoam.org |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -22,9 +22,26 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
surfaceConvert
Description
Converts to and from Foam surface format. Optionally orders triangles
by region.
Converts from one surface mesh format to another
Usage
- surfaceConvert inputFile outputFile [OPTION]
@param -clean \n
Perform some surface checking/cleanup on the input surface
@param -scale \<scale\> \n
Specify a scaling factor for writing the files
@param -group \n
Orders faces by region
Note
The filename extensions are used to determine the file format type.
\*---------------------------------------------------------------------------*/
@ -44,34 +61,41 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validOptions.insert("cleanup", "");
argList::validArgs.append("inputFile");
argList::validArgs.append("outputFile");
argList::validOptions.insert("clean", "");
argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("group", "");
argList::validArgs.append("input surface file");
argList::validArgs.append("output surface file");
argList args(argc, argv);
const stringList& params = args.additionalArgs();
fileName inFileName(args.additionalArgs()[0]);
fileName outFileName(args.additionalArgs()[1]);
scalar scaleFactor = 0;
if (args.options().found("scale"))
{
IStringStream(args.options()["scale"])() >> scaleFactor;
}
if (outFileName == inFileName)
fileName importName(params[0]);
fileName exportName(params[1]);
if (importName == exportName)
{
FatalErrorIn(args.executable())
<< "Output file " << outFileName
<< " would overwrite input file."
<< "Output file " << exportName << " would overwrite input file."
<< exit(FatalError);
}
Info << "Reading : " << inFileName << endl;
triSurface surf(inFileName);
Info<< "Reading : " << importName << endl;
triSurface surf(importName);
Info<< "Read surface:" << endl;
surf.writeStats(Info);
Info<< endl;
if (args.options().found("cleanup"))
if (args.options().found("clean"))
{
Info << "Cleaning up surface" << endl;
Info<< "Cleaning up surface" << endl;
surf.cleanup(true);
Info<< "After cleaning up surface:" << endl;
@ -83,20 +107,28 @@ int main(int argc, char *argv[])
if (sortByRegion)
{
Info << "Reordering faces into groups; one per region." << endl;
Info<< "Reordering faces into groups; one per region." << endl;
}
else
{
Info << "Maintaining face ordering" << endl;
Info<< "Maintaining face ordering" << endl;
}
Info << "Writing : " << outFileName << endl;
surf.write(outFileName, sortByRegion);
Info<< "writing " << exportName;
if (scaleFactor > 0)
{
Info<< " without scaling" << endl;
}
else
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
}
surf.write(exportName, sortByRegion);
Info << "End\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
surfaceCoordinateSystemTransform.C
EXE = $(FOAM_APPBIN)/surfaceCoordinateSystemTransform

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude
EXE_LIBS = -lmeshTools -lsurfMesh

View File

@ -0,0 +1,83 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class IOPtrList<coordinateSystem>;
object coordinateSystems;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
7
(
system_9
{
type cartesian;
origin (1.03291515 -0.114391257 -0.0826236662);
e3 (1 0 0);
e1 (0 1 0);
// STARCDRotation (0 90 90);
}
system_10
{
type cartesian;
origin (0.623151719 -0.286472935 -0.113933262);
e3 (0.99508851 0.09829095 0.01173645);
e1 (0.01179356 0 -0.99993045);
// STARCDRotation (5.6403745 -0.0664172952 89.3275351);
}
system_15
{
type cartesian;
origin (0.644772231 -0.240036493 0.155972187);
e3 (-0.01346388 -0.90616979 -0.42269969);
e1 (0.00627978 0.42265304 -0.90626981);
// STARCDRotation (-90.8512386 0 115.005148);
}
system_16
{
type cartesian;
origin (0.540824938 -0.240036415 0.15928296);
e3 (-0.01346388 -0.90616979 -0.42269969);
e1 (0.00627978 0.42265304 -0.90626981);
// STARCDRotation (-90.8512386 0 115.005148);
}
system_17
{
type cartesian;
origin (0.436877646 -0.240036339 0.162593737);
e3 (-0.01346388 -0.90616979 -0.42269969);
e1 (0.00627978 0.42265304 -0.90626981);
// STARCDRotation (-90.8512386 0 115.005148);
}
system_18
{
type cartesian;
origin (0.332930354 -0.240036261 0.16590451);
e3 (-0.01346388 -0.90616979 -0.42269969);
e1 (0.00627978 0.42265304 -0.90626981);
// STARCDRotation (-90.8512386 0 115.005148);
}
system_21
{
type cartesian;
origin (0.55863733 -0.300866705 0.00317260982);
e3 (0.42110287 0.02470132 -0.90667647);
e1 (0.90646036 0.02342535 0.42164069);
// STARCDRotation (-178.185897 -0.71772221 -155.059695);
}
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,235 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
surfaceMeshCoordinateSystemTransform
Description
Transform (scale/rotate/translate) a surface based on
a coordinateSystem.
Usage
- surfaceMeshCoordinateSystemTransform inputFile outputFile [OPTION]
@param -clean \n
Perform some surface checking/cleanup on the input surface
@param -scale \<scale\> \n
Specify a scaling factor for writing the files
@param -triSurface \n
Use triSurface library for input/output
@param -dict \<dictionary\> \n
Specify an alternative dictionary for coordinateSystems.
Note
The filename extensions are used to determine the file format type.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "MeshedSurfaces.H"
#include "UnsortedMeshedSurfaces.H"
#include "coordinateSystems.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.append("inputFile");
argList::validArgs.append("outputFile");
argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("unsorted", "");
argList::validOptions.insert("from", "sourceCoordinateSystem");
argList::validOptions.insert("to", "targetCoordinateSystem");
argList::validOptions.insert("dict", "dictionary");
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
const stringList& params = args.additionalArgs();
word dictName("coordinateSystems");
fileName dictPath(runTime.constant());
fileName dictLocal;
if (args.options().found("dict"))
{
wordList elems(fileName(args.options()["dict"]).components());
dictName = elems[elems.size()-1];
dictPath = elems[0];
dictLocal = "";
if (elems.size() == 1)
{
dictPath = ".";
}
else if (elems.size() > 2)
{
dictLocal = fileName(SubList<word>(elems, elems.size()-2, 1));
}
}
autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys;
if (args.options().found("from") || args.options().found("to"))
{
IOobject csDictIo
(
dictName,
dictPath,
dictLocal,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (!csDictIo.headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open coordinateSystems file\n "
<< csDictIo.objectPath() << nl
<< exit(FatalError);
}
coordinateSystems csLst(csDictIo);
if (args.options().found("from"))
{
word csName(args.options()["from"]);
label csId = csLst.find(csName);
if (csId < 0)
{
FatalErrorIn(args.executable())
<< "Cannot find -from " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
fromCsys.reset(new coordinateSystem(csLst[csId]));
}
if (args.options().found("to"))
{
word csName(args.options()["to"]);
label csId = csLst.find(csName);
if (csId < 0)
{
FatalErrorIn(args.executable())
<< "Cannot find -to " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
toCsys.reset(new coordinateSystem(csLst[csId]));
}
// maybe fix this later
if (fromCsys.valid() && toCsys.valid())
{
FatalErrorIn(args.executable())
<< "Only allowed -from or -to option at the moment."
<< exit(FatalError);
}
}
scalar scaleFactor = 0;
if (args.options().found("scale"))
{
IStringStream(args.options()["scale"])() >> scaleFactor;
}
fileName importName(params[0]);
fileName exportName(params[1]);
if (importName == exportName)
{
FatalErrorIn(args.executable())
<< "Output file " << exportName << " would overwrite input file."
<< exit(FatalError);
}
if
(
!meshedSurface::canRead(importName, true)
|| !meshedSurface::canWriteType(exportName.ext(), true)
)
{
return 1;
}
{
MeshedSurface<face> surf(importName);
if (args.options().found("clean"))
{
surf.cleanup(true);
surf.checkOrientation(true);
}
if (fromCsys.valid())
{
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
surf.movePoints(tpf());
}
if (toCsys.valid())
{
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
surf.movePoints(tpf());
}
Info<< "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
}
else
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
}
surf.write(exportName);
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -40,6 +40,9 @@ Usage
@param -triSurface \n
Use triSurface library for input/output
@param -keyed \n
Use keyedSurface for input/output
Note
The filename extensions are used to determine the file format type.
@ -49,9 +52,11 @@ Note
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "meshedSurface.H"
#include "triSurface.H"
#include "MeshedSurfaces.H"
#include "UnsortedMeshedSurfaces.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,9 +67,11 @@ int main(int argc, char *argv[])
argList::noParallel();
argList::validArgs.append("inputFile");
argList::validArgs.append("outputFile");
argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("clean", "");
argList::validOptions.insert("scale", "scale");
argList::validOptions.insert("triSurface", "");
argList::validOptions.insert("unsorted", "");
argList::validOptions.insert("triFace", "");
# include "setRootCase.H"
const stringList& params = args.additionalArgs();
@ -77,10 +84,17 @@ int main(int argc, char *argv[])
fileName importName(params[0]);
fileName exportName(params[1]);
if (importName == exportName)
{
FatalErrorIn(args.executable())
<< "Output file " << exportName << " would overwrite input file."
<< exit(FatalError);
}
if
(
!meshedSurface::canRead(importName.ext(), true)
|| !meshedSurface::canWrite(exportName.ext(), true)
!meshedSurface::canRead(importName, true)
|| !meshedSurface::canWriteType(exportName.ext(), true)
)
{
return 1;
@ -88,10 +102,6 @@ int main(int argc, char *argv[])
if (args.options().found("triSurface"))
{
// # include "createTime.H"
// instantList timeDirs = timeSelector::select0(runTime, args);
// # include "createPolyMesh.H"
triSurface surf(importName);
if (args.options().found("clean"))
@ -107,15 +117,16 @@ int main(int argc, char *argv[])
}
else
{
Info<< " triSurface does not yet support scaling "
<< scaleFactor << endl;
// surf.scalePoints(scaleFactor);
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
}
surf.write(exportName);
// write sorted by region
surf.write(exportName, true);
}
else
else if (args.options().found("unsorted"))
{
meshedSurface surf(importName);
UnsortedMeshedSurface<face> surf(importName);
if (args.options().found("clean"))
{
@ -123,7 +134,29 @@ int main(int argc, char *argv[])
surf.checkOrientation(true);
}
surf.scalePoints(scaleFactor);
Info << "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
}
else
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
}
surf.write(exportName);
}
#if 1
else if (args.options().found("triFace"))
{
MeshedSurface<triFace> surf(importName);
if (args.options().found("clean"))
{
surf.cleanup(true);
surf.checkOrientation(true);
}
Info<< "writing " << exportName;
if (scaleFactor <= 0)
@ -133,6 +166,30 @@ int main(int argc, char *argv[])
else
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
}
surf.write(exportName);
}
#endif
else
{
MeshedSurface<face> surf(importName);
if (args.options().found("clean"))
{
surf.cleanup(true);
surf.checkOrientation(true);
}
Info<< "writing " << exportName;
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
}
else
{
Info<< " with scaling " << scaleFactor << endl;
surf.scalePoints(scaleFactor);
}
surf.write(exportName);
}

View File

@ -31,7 +31,7 @@ License
const dataType Foam::className::staticData();
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -71,10 +71,16 @@ Foam::className::~className()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::className::operator=(const className& rhs)
{
@ -87,11 +93,10 @@ void Foam::className::operator=(const className& rhs)
}
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ template<TemplateClassArgument>
const dataType Foam::ClassName<TemplateArgument>::staticData();
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -84,10 +84,16 @@ Foam::ClassName<TemplateArgument>::~ClassName()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<TemplateClassArgument>
void Foam::ClassName<TemplateArgument>::operator=
@ -108,10 +114,10 @@ void Foam::ClassName<TemplateArgument>::operator=
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -6,6 +6,6 @@ chmod a+rX $WM_PROJECT_DIR
chmod a+rX $WM_PROJECT_DIR/doc
chmod -R a+rX Doxygen
( cd Doxygen && ./Allwmake )
Doxygen/Allwmake
# ----------------------------------------------------------------- end-of-file

View File

@ -31,9 +31,21 @@
#
#------------------------------------------------------------------------------
export CINTSYSDIR=~/pub/CINT/cint7
export PATH=$PATH:$CINTSYSDIR
export MANPATH=$MANPATH:$CINTSYSDIR/doc
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$CINTSYSDIR
for CINTSYSDIR in \
$HOME/pub/CINT/cint7 \
$WM_THIRD_PARTY_DIR/cint-svn/platforms/$WM_OPTIONS \
;
do
if [ -r $CINTSYSDIR ]
then
export CINTSYSDIR
export PATH=$PATH:$CINTSYSDIR/bin
export MANPATH=$MANPATH:$CINTSYSDIR/doc
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$CINTSYSDIR/lib
break
fi
done
[ -r "$CINTSYSDIR" ] || unset CINTSYSDIR
# -----------------------------------------------------------------------------

View File

@ -32,19 +32,23 @@
#------------------------------------------------------------------------------
# fallback value
if [ ! -d "$CEI_HOME" ]; then
if [ ! -d "$CEI_HOME" ]
then
export CEI_HOME=/usr/local/ensight/CEI
fi
if [ -r $CEI_HOME ]; then
if [ -r $CEI_HOME ]
then
# special treatment for 32bit FOAM and 64bit Ensight
if [ "$WM_ARCH" = linux -a `uname -m` = x86_64 ]; then
if [ "$WM_ARCH" = linux -a `uname -m` = x86_64 ]
then
export CEI_ARCH=linux_2.6_32
fi
# add to path if required
if [ "$CEI_HOME/bin/ensight" != "`which ensight 2>/dev/null`" ]; then
if [ "$CEI_HOME/bin/ensight" != "`which ensight 2>/dev/null`" ]
then
export PATH=$CEI_HOME/bin:$PATH
fi

View File

@ -33,7 +33,8 @@
export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
if [ -r $CMAKE_HOME ]; then
if [ -r $CMAKE_HOME ]
then
export PATH=$CMAKE_HOME/bin:$PATH
fi
@ -42,14 +43,16 @@ export ParaView_VERSION=2.4.4
export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
export ParaView_DIR=$ParaView_INST_DIR/lib/paraview-2.4
if [ -r $ParaView_INST_DIR ]; then
if [ -r $ParaView_INST_DIR ]
then
export PV_INTERFACE_PATH=$FOAM_UTILITIES/postProcessing/graphics/PVFoamReader/PVFoamReader/Make
export PATH=$ParaView_INST_DIR/bin:$PATH
export LD_LIBRARY_PATH=${ParaView_INST_DIR}/lib:${ParaView_INST_DIR}/lib/vtk:${LD_LIBRARY_PATH}
fi
if [ -r $ParaView_DIR ]; then
if [ -r $ParaView_DIR ]
then
export VTK_DIR=$ParaView_DIR/VTK
fi

View File

@ -33,7 +33,8 @@
export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
if [ -r $CMAKE_HOME ]; then
if [ -r $CMAKE_HOME ]
then
export PATH=$CMAKE_HOME/bin:$PATH
else
unset CMAKE_HOME
@ -44,14 +45,16 @@ export ParaView_VERSION="3.3-cvs"
export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
if [ "$PYTHONPATH" ]; then
if [ "$PYTHONPATH" ]
then
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
else
export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
fi
if [ -r $ParaView_DIR ]; then
if [ -r $ParaView_DIR ]
then
export PATH=$ParaView_DIR/bin:$PATH
export LD_LIBRARY_PATH=$ParaView_DIR/bin:$LD_LIBRARY_PATH
export PV_PLUGIN_PATH=$FOAM_LIBBIN

View File

@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM
#export WM_PROJECT_VERSION=1.5.x
# export WM_PROJECT_VERSION=1.5.x
: ${WM_PROJECT_VERSION:=dev}; export WM_PROJECT_VERSION
@ -152,7 +152,7 @@ Linux)
cat <<USAGE
Your "$WM_ARCH" operating system is not supported by this release
of OpenFOAM. For further assistance, please contact www.openfoam.org
of OpenFOAM. For further assistance, please contact www.OpenFOAM.org
USAGE
;;
@ -198,7 +198,7 @@ _foamSource $WM_PROJECT_DIR/etc/aliases.sh
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
# _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
_foamSource $WM_PROJECT_DIR/etc/apps/ensight/bashrc
_foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc

View File

@ -2,7 +2,7 @@
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View File

@ -32,7 +32,7 @@
#------------------------------------------------------------------------------
setenv WM_PROJECT OpenFOAM
#setenv WM_PROJECT_VERSION 1.5.x
# setenv WM_PROJECT_VERSION 1.5.x
if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION dev
#!!User:
@ -148,7 +148,7 @@ case Linux:
default:
echo
echo "Your '$WM_ARCH' operating system is not supported by this release"
echo "of OpenFOAM. For further assistance, please contact www.openfoam.org"
echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org"
echo
breaksw
@ -194,7 +194,7 @@ _foamSource $WM_PROJECT_DIR/etc/aliases.csh
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc
_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/cshrc
# _foamSource $WM_PROJECT_DIR/etc/apps/ensight/cshrc
# Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH)

View File

@ -130,6 +130,9 @@ case OPENMPI:
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin
_foamMkDir $MPI_ARCH_PATH/lib
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
@ -144,6 +147,9 @@ case LAM:
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin
_foamMkDir $MPI_ARCH_PATH/lib
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
@ -157,6 +163,9 @@ case MPICH:
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin
_foamMkDir $MPI_ARCH_PATH/lib
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
@ -171,6 +180,9 @@ case MPICH-GM:
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin
_foamMkDir $MPI_ARCH_PATH/lib
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
breaksw
@ -216,6 +228,8 @@ default:
endsw
_foamAddLib $FOAM_MPI_LIBBIN
# before compiling, this directory may not exist:
_foamMkDir $FOAM_MPI_LIBBIN
# Set the minimum MPI buffer size (used by all platforms except SGI MPI)

View File

@ -160,6 +160,8 @@ OPENMPI)
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin $MPI_ARCH_PATH/lib
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
@ -174,6 +176,8 @@ LAM)
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin $MPI_ARCH_PATH/lib
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
@ -187,6 +191,8 @@ MPICH)
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin $MPI_ARCH_PATH/lib
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
@ -201,6 +207,8 @@ MPICH-GM)
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
# before compiling, these directories may not exist:
_foamMkDir $MPI_ARCH_PATH/bin $MPI_ARCH_PATH/lib
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
;;
@ -247,6 +255,8 @@ MPI)
esac
_foamAddLib $FOAM_MPI_LIBBIN
# before compiling, this directory may not exist:
_foamMkDir $FOAM_MPI_LIBBIN
# Set the minimum MPI buffer size (used by all platforms except SGI MPI)
@ -267,7 +277,8 @@ export MPI_BUFFER_SIZE
# Switch on the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if [ -f $FOAM_LIBBIN/libhoard.so ]; then
#if [ -f $FOAM_LIBBIN/libhoard.so ]
#then
# export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
#fi

View File

@ -4,7 +4,7 @@ set -x
wmakeLnInclude -f OpenFOAM
wmakeLnInclude -f OSspecific/$WM_OS
( cd Pstream && ./Allwmake )
Pstream/Allwmake
wmake libo OSspecific/$WM_OS
wmake libso OpenFOAM
@ -17,7 +17,7 @@ wmake libso surfMesh
wmake libso meshTools
wmake libso finiteVolume
( cd decompositionAgglomeration && ./Allwmake )
decompositionAgglomeration/Allwmake
wmake libso sampling
@ -30,12 +30,12 @@ wmake libso engine
wmake libso ODE
wmake libso randomProcesses
( cd thermophysicalModels && ./Allwmake )
( cd transportModels && ./Allwmake )
( cd turbulenceModels && ./Allwmake )
( cd lagrangian && ./Allwmake )
( cd postProcessing && ./Allwmake )
( cd conversion && ./Allwmake )
thermophysicalModels/Allwmake
transportModels/Allwmake
turbulenceModels/Allwmake
lagrangian/Allwmake
postProcessing/Allwmake
conversion/Allwmake
wmake libso autoMesh
wmake libso errorEstimation

View File

@ -29,62 +29,161 @@ License
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
namespace Foam
template<class Key, class Hash>
template<class T>
Foam::HashSet<Key, Hash>::HashSet(const HashTable<T, Key, Hash>& ht)
:
HashTable<empty, Key, Hash>(ht.size())
{
for
(
typename HashTable<T, Key, Hash>::const_iterator iter = ht.begin();
iter != ht.end();
++iter
)
{
insert(iter.key());
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Key, class Hash>
bool HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& ht) const
bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const
{
const HashTable<empty, Key, Hash>& a = *this;
// Are all my elements in ht?
for
(
typename HashTable<empty, Key, Hash>::const_iterator iter = a.begin();
iter != a.end();
++iter
)
// Are all lhs elements in rhs?
for (const_iterator iter = this->begin(); iter != this->end(); ++iter)
{
if (!ht.found(iter.key()))
if (!rhs.found(iter.key()))
{
return false;
}
}
// Are all ht elements in me?
for
(
typename HashTable<empty, Key, Hash>::const_iterator iter = ht.begin();
iter != ht.end();
++iter
)
// Are all rhs elements in lhs?
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
if (!found(iter.key()))
{
return false;
}
}
return true;
}
template<class Key, class Hash>
bool HashSet<Key, Hash>::operator!=(const HashSet<Key, Hash>& ht) const
bool Foam::HashSet<Key, Hash>::operator!=(const HashSet<Key, Hash>& rhs) const
{
return !(operator==(ht));
return !(operator==(rhs));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator|=(const HashSet<Key, Hash>& rhs)
{
// Add rhs elements into lhs
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
insert(iter.key());
}
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator&=(const HashSet<Key, Hash>& rhs)
{
// Remove elements not also found in rhs
for (iterator iter = this->begin(); iter != this->end(); ++iter)
{
if (!rhs.found(iter.key()))
{
erase(iter);
}
}
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator^=(const HashSet<Key, Hash>& rhs)
{
// Add missed rhs elements, remove duplicate elements
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
if (found(iter.key()))
{
erase(iter.key());
}
else
{
insert(iter.key());
}
}
}
template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
{
// Remove rhs elements from lhs
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
{
erase(iter.key());
}
}
} // End namespace Foam
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
/* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
template<class Key, class Hash>
Foam::HashSet<Key, Hash>
Foam::operator|
(
const HashSet<Key, Hash>& hash1,
const HashSet<Key, Hash>& hash2
)
{
HashSet<Key, Hash> out(hash1);
out |= hash2;
return out;
}
template<class Key, class Hash>
Foam::HashSet<Key, Hash>
Foam::operator&
(
const HashSet<Key, Hash>& hash1,
const HashSet<Key, Hash>& hash2
)
{
HashSet<Key, Hash> out(hash1);
out &= hash2;
return out;
}
template<class Key, class Hash>
Foam::HashSet<Key, Hash>
Foam::operator^
(
const HashSet<Key, Hash>& hash1,
const HashSet<Key, Hash>& hash2
)
{
HashSet<Key, Hash> out(hash1);
out ^= hash2;
return out;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ Class
Foam::HashSet
Description
A HashTable with word keys but without contents.
A HashTable with keys but without contents.
Typedef
Foam::wordHashSet
@ -34,6 +34,12 @@ Typedef
Description
A HashSet with (the default) word keys.
Typedef
Foam::labelHashSet
Description
A HashSet with label keys.
\*---------------------------------------------------------------------------*/
#ifndef HashSet_H
@ -48,7 +54,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class HashSet Declaration
Class HashSet Declaration
\*---------------------------------------------------------------------------*/
template<class Key=word, class Hash=string::hash>
@ -59,9 +65,13 @@ class HashSet
public:
typedef typename HashTable<empty, Key, Hash>::iterator iterator;
typedef typename HashTable<empty, Key, Hash>::const_iterator const_iterator;
// Constructors
//- Construct given initial map size
//- Construct given initial size
HashSet(label size = 100)
:
HashTable<empty, Key, Hash>(size)
@ -74,13 +84,13 @@ public:
{}
//- Construct from UList of Key
HashSet(const UList<Key>& ul)
HashSet(const UList<Key>& lst)
:
HashTable<empty, Key, Hash>(2*ul.size())
HashTable<empty, Key, Hash>(2*lst.size())
{
forAll (ul, i)
forAll(lst, i)
{
insert(ul[i]);
insert(lst[i]);
}
}
@ -90,32 +100,99 @@ public:
HashTable<empty, Key, Hash>(hs)
{}
//- Construct by transferring the parameter contents
HashSet(const xfer<HashSet<Key, Hash> >& hs)
:
HashTable<empty, Key, Hash>(hs)
{}
//- Construct from table of contents of the HashTable
template<class T>
HashSet(const HashTable<T, Key, Hash>& ht);
// Member Functions
// Edit
//- Insert a new hashedEntry
bool insert(const Key& key)
{
return HashTable<empty, Key, Hash>::insert(key, empty());
}
//- Insert a new entry
bool insert(const Key& key)
{
return HashTable<empty, Key, Hash>::insert(key, empty());
}
//- Same as insert (cannot overwrite empty content)
bool set(const Key& key)
{
return HashTable<empty, Key, Hash>::insert(key, empty());
}
// Member Operators
//- Equality. Two hashtables are equal if all contents of first are
// also in second and vice versa. So does not depend on table size or
// order!
//- Equality. Two hashtables are equal when their contents are equal.
// Independent of table size or order.
bool operator==(const HashSet<Key, Hash>&) const;
//- The opposite of the equality operation.
bool operator!=(const HashSet<Key, Hash>&) const;
//- Combine entries from HashSets
void operator|=(const HashSet<Key, Hash>&);
//- Only retain entries found in both HashSets
void operator&=(const HashSet<Key, Hash>&);
//- Only retain unique entries (xor)
void operator^=(const HashSet<Key, Hash>&);
//- Add entries listed in the given HashSet to this HashSet
inline void operator+=(const HashSet<Key, Hash>& rhs)
{
this->operator|=(rhs);
}
//- Remove entries listed in the given HashSet from this HashSet
void operator-=(const HashSet<Key, Hash>&);
};
// Global Operators
//- Combine entries from HashSets
template<class Key, class Hash>
HashSet<Key,Hash> operator|
(
const HashSet<Key,Hash>& hash1,
const HashSet<Key,Hash>& hash2
);
//- Create a HashSet that only contains entries found in both HashSets
template<class Key, class Hash>
HashSet<Key,Hash> operator&
(
const HashSet<Key,Hash>& hash1,
const HashSet<Key,Hash>& hash2
);
//- Create a HashSet that only contains unique entries (xor)
template<class Key, class Hash>
HashSet<Key,Hash> operator^
(
const HashSet<Key,Hash>& hash1,
const HashSet<Key,Hash>& hash2
);
//- A HashSet with word keys.
typedef HashSet<> wordHashSet;
//- A HashSet with label keys.
typedef HashSet<label, Hash<label> > labelHashSet;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -54,9 +54,15 @@ class Map
{
public:
typedef typename HashTable<T, label, Hash<label> >::iterator iterator;
typedef typename HashTable<T, label, Hash<label> >::const_iterator
const_iterator;
// Constructors
//- Construct given initial map size
//- Construct given initial size
Map(label size = 100)
:
HashTable<T, label, Hash<label> >(size)
@ -74,6 +80,12 @@ public:
HashTable<T, label, Hash<label> >(map)
{}
//- Construct by transferring the parameter contents
Map(const xfer<Map<T> >& map)
:
HashTable<T, label, Hash<label> >(map)
{}
//- Return a null Map
static const Map<T>& null()

View File

@ -67,7 +67,7 @@ public:
(
const UList<T>& posList,
const UList<T>& negList,
const List<label>&
const UList<label>&
);

View File

@ -31,7 +31,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
(
const UList<T>& posList,
const UList<T>& negList,
const List<label>& addr
const UList<label>& addr
)
:
posList_(const_cast<UList<T>&>(posList)),

View File

@ -88,11 +88,11 @@ public:
inline Hash();
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html.
label operator()(const FixedList<T, Size>& fl) const;
label operator()(const FixedList<T, Size>&) const;
label operator()
(
const FixedList<T, Size>& fl,
const FixedList<T, Size>&,
const label tableSize
) const;
};
@ -160,6 +160,9 @@ public:
// needed to make FixedList consistent with List
inline void setSize(const label);
//- Copy (not transfer) the argument contents
// needed to make FixedList consistent with List
void transfer(const FixedList<T, Size>&);
//- Write the FixedList as a dictionary entry
void writeEntry(Ostream& os) const;

View File

@ -33,6 +33,7 @@ template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList()
{}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const T v[Size])
{
@ -42,6 +43,7 @@ inline Foam::FixedList<T, Size>::FixedList(const T v[Size])
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const T& t)
{
@ -51,27 +53,29 @@ inline Foam::FixedList<T, Size>::FixedList(const T& t)
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const UList<T>& ul)
inline Foam::FixedList<T, Size>::FixedList(const UList<T>& lst)
{
checkSize(ul.size());
checkSize(lst.size());
for (register label i=0; i<Size; i++)
{
v_[i] = ul[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& sll)
inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& lst)
{
checkSize(sll.size());
checkSize(lst.size());
register label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -79,15 +83,17 @@ inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& sll)
}
}
template<class T, Foam::label Size>
inline Foam::FixedList<T, Size>::FixedList(const FixedList<T, Size>& fl)
inline Foam::FixedList<T, Size>::FixedList(const FixedList<T, Size>& lst)
{
for (register label i=0; i<Size; i++)
{
v_[i] = fl[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline Foam::autoPtr<Foam::FixedList<T, Size> >
Foam::FixedList<T, Size>::clone() const
@ -101,14 +107,14 @@ Foam::FixedList<T, Size>::clone() const
template<class T, Foam::label Size>
inline Foam::label Foam::FixedList<T, Size>::fcIndex(const label i) const
{
return (i == Size-1 ? 0 : i+1);
return (i == Size-1 ? 0 : i+1);
}
template<class T, Foam::label Size>
inline Foam::label Foam::FixedList<T, Size>::rcIndex(const label i) const
{
return (i == 0 ? Size-1 : i-1);
return (i == 0 ? Size-1 : i-1);
}
@ -165,6 +171,14 @@ inline void Foam::FixedList<T, Size>::setSize(const label s)
# endif
}
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::transfer(const FixedList<T, Size>& lst)
{
for (register label i=0; i<Size; i++)
{
v_[i] = lst[i];
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
@ -191,35 +205,35 @@ inline const T& Foam::FixedList<T, Size>::operator[](const label i) const
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::operator=(const T v[Size])
inline void Foam::FixedList<T, Size>::operator=(const T lst[Size])
{
for (register label i=0; i<Size; i++)
{
v_[i] = v[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::operator=(const UList<T>& ul)
inline void Foam::FixedList<T, Size>::operator=(const UList<T>& lst)
{
checkSize(ul.size());
checkSize(lst.size());
for (register label i=0; i<Size; i++)
{
v_[i] = ul[i];
v_[i] = lst[i];
}
}
template<class T, Foam::label Size>
inline void Foam::FixedList<T, Size>::operator=(const SLList<T>& sll)
inline void Foam::FixedList<T, Size>::operator=(const SLList<T>& lst)
{
checkSize(sll.size());
checkSize(lst.size());
register label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -329,12 +343,12 @@ template<class HashT>
inline Foam::FixedList<T, Size>::Hash<HashT>::Hash()
{}
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html.
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html
template<class T, Foam::label Size>
template<class HashT>
inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
(
const FixedList<T, Size>& fl
const FixedList<T, Size>& lst
) const
{
static const label farbit(8*sizeof(label)-4);
@ -343,7 +357,7 @@ inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
for (register int i=0; i<Size; i++)
{
val = (val<<4)^(val>>farbit)^HashT()(fl[i]);
val = (val<<4)^(val>>farbit)^HashT()(lst[i]);
}
return val;
@ -353,11 +367,11 @@ template<class T, Foam::label Size>
template<class HashT>
inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
(
const FixedList<T, Size>& fl,
const FixedList<T, Size>& lst,
const label tableSize
) const
{
return mag(operator()(fl)) % tableSize;
return mag(operator()(lst)) % tableSize;
}
#endif

View File

@ -61,7 +61,7 @@ public:
// Constructors
//- Construct given the complete list and the addressing array
inline IndirectList(const UList<T>&, const List<label>&);
inline IndirectList(const UList<T>&, const UList<label>&);
// Member Functions
@ -75,7 +75,7 @@ public:
// Edit
//- Reset addressing
void resetAddressing(const List<label>& addr);
void resetAddressing(const UList<label>&);
// Member Operators

View File

@ -30,7 +30,7 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList
(
const UList<T>& completeList,
const List<label>& addr
const UList<label>& addr
)
:
completeList_(const_cast<UList<T>&>(completeList)),
@ -64,7 +64,7 @@ inline const Foam::List<Foam::label>& Foam::IndirectList<T>::addressing() const
template<class T>
inline void Foam::IndirectList<T>::resetAddressing
(
const List<label>& addr
const UList<label>& addr
)
{
addressing_ = addr;

View File

@ -206,7 +206,7 @@ Foam::List<T>::List(InputIterator first, InputIterator last)
// Construct as copy of FixedList<T, Size>
template<class T>
template<Foam::label Size>
Foam::List<T>::List(const FixedList<T, Size>& fl)
Foam::List<T>::List(const FixedList<T, Size>& lst)
:
UList<T>(NULL, Size)
{
@ -216,7 +216,7 @@ Foam::List<T>::List(const FixedList<T, Size>& fl)
forAll(*this, i)
{
this->operator[](i) = fl[i];
this->operator[](i) = lst[i];
}
}
else
@ -228,9 +228,9 @@ Foam::List<T>::List(const FixedList<T, Size>& fl)
// Construct as copy of PtrList<T>
template<class T>
Foam::List<T>::List(const PtrList<T>& sptrl)
Foam::List<T>::List(const PtrList<T>& lst)
:
UList<T>(NULL, sptrl.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
@ -238,7 +238,7 @@ Foam::List<T>::List(const PtrList<T>& sptrl)
forAll(*this, i)
{
this->operator[](i) = sptrl[i];
this->operator[](i) = lst[i];
}
}
else
@ -250,9 +250,9 @@ Foam::List<T>::List(const PtrList<T>& sptrl)
// Construct as copy of SLList<T>
template<class T>
Foam::List<T>::List(const SLList<T>& sll)
Foam::List<T>::List(const SLList<T>& lst)
:
UList<T>(NULL, sll.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
@ -261,8 +261,8 @@ Foam::List<T>::List(const SLList<T>& sll)
label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -278,9 +278,9 @@ Foam::List<T>::List(const SLList<T>& sll)
// Construct as copy of IndirectList<T>
template<class T>
Foam::List<T>::List(const IndirectList<T>& idl)
Foam::List<T>::List(const IndirectList<T>& lst)
:
UList<T>(NULL, idl.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
@ -288,7 +288,7 @@ Foam::List<T>::List(const IndirectList<T>& idl)
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
else
@ -300,9 +300,9 @@ Foam::List<T>::List(const IndirectList<T>& idl)
// Construct as copy of BiIndirectList<T>
template<class T>
Foam::List<T>::List(const BiIndirectList<T>& idl)
Foam::List<T>::List(const BiIndirectList<T>& lst)
:
UList<T>(NULL, idl.size())
UList<T>(NULL, lst.size())
{
if (this->size_)
{
@ -310,7 +310,7 @@ Foam::List<T>::List(const BiIndirectList<T>& idl)
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
else
@ -522,13 +522,13 @@ void Foam::List<T>::operator=(const List<T>& a)
// Assignment operator. Takes linear time.
template<class T>
void Foam::List<T>::operator=(const SLList<T>& sll)
void Foam::List<T>::operator=(const SLList<T>& lst)
{
if (sll.size() != this->size_)
if (lst.size() != this->size_)
{
if (this->v_) delete[] this->v_;
this->v_ = 0;
this->size_ = sll.size();
this->size_ = lst.size();
if (this->size_) this->v_ = new T[this->size_];
}
@ -537,8 +537,8 @@ void Foam::List<T>::operator=(const SLList<T>& sll)
label i = 0;
for
(
typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end();
typename SLList<T>::const_iterator iter = lst.begin();
iter != lst.end();
++iter
)
{
@ -550,13 +550,13 @@ void Foam::List<T>::operator=(const SLList<T>& sll)
// Assignment operator. Takes linear time.
template<class T>
void Foam::List<T>::operator=(const IndirectList<T>& idl)
void Foam::List<T>::operator=(const IndirectList<T>& lst)
{
if (idl.size() != this->size_)
if (lst.size() != this->size_)
{
if (this->v_) delete[] this->v_;
this->v_ = 0;
this->size_ = idl.size();
this->size_ = lst.size();
if (this->size_) this->v_ = new T[this->size_];
}
@ -564,7 +564,7 @@ void Foam::List<T>::operator=(const IndirectList<T>& idl)
{
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
}
@ -572,13 +572,13 @@ void Foam::List<T>::operator=(const IndirectList<T>& idl)
// Assignment operator. Takes linear time.
template<class T>
void Foam::List<T>::operator=(const BiIndirectList<T>& idl)
void Foam::List<T>::operator=(const BiIndirectList<T>& lst)
{
if (idl.size() != this->size_)
if (lst.size() != this->size_)
{
if (this->v_) delete[] this->v_;
this->v_ = 0;
this->size_ = idl.size();
this->size_ = lst.size();
if (this->size_) this->v_ = new T[this->size_];
}
@ -586,7 +586,7 @@ void Foam::List<T>::operator=(const BiIndirectList<T>& idl)
{
forAll(*this, i)
{
this->operator[](i) = idl[i];
this->operator[](i) = lst[i];
}
}
}

View File

@ -28,7 +28,11 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
Foam::labelList Foam::invert(const label len, const labelList& map)
Foam::labelList Foam::invert
(
const label len,
const UList<label>& map
)
{
labelList inverse(len, -1);
@ -40,8 +44,8 @@ Foam::labelList Foam::invert(const label len, const labelList& map)
{
if (inverse[newPos] >= 0)
{
FatalErrorIn("invert(const label, const labelList&)")
<< "Map is not one to one. At index " << i
FatalErrorIn("invert(const label, const UList<label>&)")
<< "Map is not one-to-one. At index " << i
<< " element " << newPos << " has already occurred before"
<< nl << "Please use invertOneToMany instead"
<< abort(FatalError);
@ -54,7 +58,11 @@ Foam::labelList Foam::invert(const label len, const labelList& map)
}
Foam::labelListList Foam::invertOneToMany(const label len, const labelList& map)
Foam::labelListList Foam::invertOneToMany
(
const label len,
const UList<label>& map
)
{
labelList nElems(len, 0);

View File

@ -44,56 +44,62 @@ SourceFiles
namespace Foam
{
//- Renumber the values (not the indices) of a list. List elements <= 0 are
// left as is.
template<class List>
List renumber(const labelList& oldToNew, const List&);
//- Renumber the values (not the indices) of a list.
// Negative ListType elements are left as is.
template<class ListType>
ListType renumber(const UList<label>& oldToNew, const ListType&);
//- Inplace renumber the values of a list. List elements <= 0 are
// left as is.
template<class List>
void inplaceRenumber(const labelList& oldToNew, List&);
//- Inplace renumber the values of a list.
// Negative ListType elements are left as is.
template<class ListType>
void inplaceRenumber(const UList<label>& oldToNew, ListType&);
//- Reorder the elements (indices, not values) of a list.
// List elements <= 0 are left as is.
template<class List>
List reorder(const labelList& oldToNew, const List&);
// Negative ListType elements are left as is.
template<class ListType>
ListType reorder(const UList<label>& oldToNew, const ListType&);
//- Inplace reorder the elements of a list.
// List elements <= 0 are left as is.
template<class List>
void inplaceReorder(const labelList& oldToNew, List&);
// Negative ListType elements are left as is.
template<class ListType>
void inplaceReorder(const UList<label>& oldToNew, ListType&);
// Variants to work with iterators and sparse tables. Need to have iterators
// and insert()
// Variants to work with iterators and sparse tables.
// Need to have iterators and insert()
//- Map values. Do not map negative values.
template<class Container>
void inplaceMapValue(const labelList& oldToNew, Container&);
void inplaceMapValue(const UList<label>& oldToNew, Container&);
//- Recreate with mapped keys. Remove elements with negative key.
template<class Container>
void inplaceMapKey(const labelList& oldToNew, Container&);
void inplaceMapKey(const UList<label>& oldToNew, Container&);
//- Extract elements of List whose region is certain value. Use e.g.
// to extract all selected elements:
// subset<boolList, labelList>(selectedElems, true, lst);
template<class T, class List>
List subset(const UList<T>& regions, const T& region, const List&);
//- Generate the (stable) sort order for the list
template<class T>
void sortedOrder(const UList<T>&, labelList& order);
//- Extract elements of List whose region is certain value.
// Use e.g. to extract all selected elements:
// subset<boolList, labelList>(selectedElems, true, lst);
template<class T, class ListType>
ListType subset(const UList<T>& regions, const T& region, const ListType&);
//- Inplace extract elements of List whose region is certain value. Use e.g.
// to extract all selected elements:
// inplaceSubset<boolList, labelList>(selectedElems, true, lst);
template<class T, class List>
void inplaceSubset(const UList<T>& regions, const T& region, List&);
template<class T, class ListType>
void inplaceSubset(const UList<T>& regions, const T& region, ListType&);
//- Invert one-to-one map. Unmapped elements will be -1.
labelList invert(const label len, const labelList& oldToNew);
labelList invert(const label len, const UList<label>&);
//- Invert one-to-many map. Unmapped elements will be size 0.
labelListList invertOneToMany(const label len, const labelList&);
labelListList invertOneToMany(const label len, const UList<label>&);
//- Invert many-to-many. Input and output types need to be inherited
// from List. E.g. faces to pointFaces.
@ -113,72 +119,72 @@ labelList identity(const label len);
//- Find first occurence of given element and return index,
// return -1 if not found. Linear search.
template<class List>
template<class ListType>
label findIndex
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);
//- Find all occurences of given element. Linear search.
template<class List>
template<class ListType>
labelList findIndices
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);
//- Opposite of findIndices: set values at indices to given value
template<class List>
template<class ListType>
void setValues
(
List&,
const labelList& indices,
typename List::const_reference
ListType&,
const UList<label>& indices,
typename ListType::const_reference
);
//- Opposite of findIndices: set values at indices to given value
template<class List>
List createWithValues
template<class ListType>
ListType createWithValues
(
const label sz,
const typename List::const_reference initValue,
const labelList& indices,
typename List::const_reference setValue
const typename ListType::const_reference initValue,
const UList<label>& indices,
typename ListType::const_reference setValue
);
//- Find index of max element (and larger than given element).
// return -1 if not found. Linear search.
template<class List>
label findMax(const List&, const label start=0);
template<class ListType>
label findMax(const ListType&, const label start=0);
//- Find index of min element (and less than given element).
// return -1 if not found. Linear search.
template<class List>
label findMin(const List&, const label start=0);
template<class ListType>
label findMin(const ListType&, const label start=0);
//- Find first occurence of given element in sorted list and return index,
// return -1 if not found. Binary search.
template<class List>
template<class ListType>
label findSortedIndex
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);
//- Find last element < given value in sorted list and return index,
// return -1 if not found. Binary search.
template<class List>
template<class ListType>
label findLower
(
const List&,
typename List::const_reference,
const ListType&,
typename ListType::const_reference,
const label start=0
);

View File

@ -28,15 +28,15 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class List>
List Foam::renumber
template<class ListType>
ListType Foam::renumber
(
const labelList& oldToNew,
const List& lst
const UList<label>& oldToNew,
const ListType& lst
)
{
// Create copy
List newLst(lst.size());
ListType newLst(lst.size());
forAll(lst, elemI)
{
@ -50,11 +50,11 @@ List Foam::renumber
}
template<class List>
template<class ListType>
void Foam::inplaceRenumber
(
const labelList& oldToNew,
List& lst
const UList<label>& oldToNew,
ListType& lst
)
{
forAll(lst, elemI)
@ -67,15 +67,15 @@ void Foam::inplaceRenumber
}
template<class List>
List Foam::reorder
template<class ListType>
ListType Foam::reorder
(
const labelList& oldToNew,
const List& lst
const UList<label>& oldToNew,
const ListType& lst
)
{
// Create copy
List newLst(lst.size());
ListType newLst(lst.size());
forAll(lst, elemI)
{
@ -92,15 +92,15 @@ List Foam::reorder
}
template<class List>
template<class ListType>
void Foam::inplaceReorder
(
const labelList& oldToNew,
List& lst
const UList<label>& oldToNew,
ListType& lst
)
{
// Create copy
List newLst(lst.size());
ListType newLst(lst.size());
forAll(lst, elemI)
{
@ -121,7 +121,7 @@ void Foam::inplaceReorder
template<class Container>
void Foam::inplaceMapValue
(
const labelList& oldToNew,
const UList<label>& oldToNew,
Container& lst
)
{
@ -143,7 +143,7 @@ void Foam::inplaceMapValue
template<class Container>
void Foam::inplaceMapKey
(
const labelList& oldToNew,
const UList<label>& oldToNew,
Container& lst
)
{
@ -161,23 +161,46 @@ void Foam::inplaceMapKey
newLst.insert(oldToNew[iter.key()], iter());
}
}
lst.transfer(newLst);
}
template<class T, class List>
List Foam::subset(const UList<T>& regions, const T& region, const List& lst)
template<class T>
void Foam::sortedOrder
(
const UList<T>& lst,
labelList& order
)
{
order.setSize(lst.size());
forAll(order, elemI)
{
order[elemI] = elemI;
}
Foam::stableSort(order, typename UList<T>::less(lst));
}
template<class T, class ListType>
ListType Foam::subset
(
const UList<T>& regions,
const T& region,
const ListType& lst
)
{
if (regions.size() < lst.size())
{
FatalErrorIn("subset(const UList<T>&, const T&, const List&)")
FatalErrorIn("subset(const UList<T>&, const T&, const ListType&)")
<< "Regions is of size " << regions.size()
<< "; list it is supposed to index is of size " << lst.size()
<< abort(FatalError);
}
List newLst(lst.size());
ListType newLst(lst.size());
label nElem = 0;
forAll(lst, elemI)
@ -193,12 +216,17 @@ List Foam::subset(const UList<T>& regions, const T& region, const List& lst)
}
template<class T, class List>
void Foam::inplaceSubset(const UList<T>& regions, const T& region, List& lst)
template<class T, class ListType>
void Foam::inplaceSubset
(
const UList<T>& regions,
const T& region,
ListType& lst
)
{
if (regions.size() < lst.size())
{
FatalErrorIn("inplaceSubset(const UList<T>&, const T&, List&)")
FatalErrorIn("inplaceSubset(const UList<T>&, const T&, ListType&)")
<< "Regions is of size " << regions.size()
<< "; list it is supposed to index is of size " << lst.size()
<< abort(FatalError);
@ -221,8 +249,8 @@ void Foam::inplaceSubset(const UList<T>& regions, const T& region, List& lst)
}
// As clarification coded as inversion from pointEdges to edges but completely
// general.
// As clarification:
// coded as inversion from pointEdges to edges but completely general.
template<class InList, class OutList>
void Foam::invertManyToMany
(
@ -268,11 +296,11 @@ void Foam::invertManyToMany
}
template<class List>
template<class ListType>
Foam::label Foam::findIndex
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -291,11 +319,11 @@ Foam::label Foam::findIndex
}
template<class List>
template<class ListType>
Foam::labelList Foam::findIndices
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -326,12 +354,12 @@ Foam::labelList Foam::findIndices
}
template<class List>
template<class ListType>
void Foam::setValues
(
List& l,
const labelList& indices,
typename List::const_reference t
ListType& l,
const UList<label>& indices,
typename ListType::const_reference t
)
{
forAll(indices, i)
@ -341,23 +369,23 @@ void Foam::setValues
}
template<class List>
List Foam::createWithValues
template<class ListType>
ListType Foam::createWithValues
(
const label sz,
const typename List::const_reference initValue,
const labelList& indices,
typename List::const_reference setValue
const typename ListType::const_reference initValue,
const UList<label>& indices,
typename ListType::const_reference setValue
)
{
List l(sz, initValue);
ListType l(sz, initValue);
setValues(l, indices, setValue);
return l;
}
template<class List>
Foam::label Foam::findMax(const List& l, const label start)
template<class ListType>
Foam::label Foam::findMax(const ListType& l, const label start)
{
if (start >= l.size())
{
@ -378,8 +406,8 @@ Foam::label Foam::findMax(const List& l, const label start)
}
template<class List>
Foam::label Foam::findMin(const List& l, const label start)
template<class ListType>
Foam::label Foam::findMin(const ListType& l, const label start)
{
if (start >= l.size())
{
@ -400,11 +428,11 @@ Foam::label Foam::findMin(const List& l, const label start)
}
template<class List>
template<class ListType>
Foam::label Foam::findSortedIndex
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -438,11 +466,11 @@ Foam::label Foam::findSortedIndex
}
template<class List>
template<class ListType>
Foam::label Foam::findLower
(
const List& l,
typename List::const_reference t,
const ListType& l,
typename ListType::const_reference t,
const label start
)
{
@ -489,31 +517,31 @@ Foam::label Foam::findLower
template<class Container, class T, int nRows>
Foam::List<Container> Foam::initList(const T elems[nRows])
{
List<Container> faces(nRows);
List<Container> lst(nRows);
forAll(faces, faceI)
forAll(lst, rowI)
{
faces[faceI] = Container(elems[faceI]);
lst[rowI] = Container(elems[rowI]);
}
return faces;
return lst;
}
template<class Container, class T, int nRows, int nColumns>
Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
{
List<Container> faces(nRows);
List<Container> lst(nRows);
Container f(nColumns);
forAll(faces, faceI)
Container cols(nColumns);
forAll(lst, rowI)
{
forAll(f, i)
forAll(cols, colI)
{
f[i] = elems[faceI][i];
cols[colI] = elems[rowI][colI];
}
faces[faceI] = f;
lst[rowI] = cols;
}
return faces;
return lst;
}

View File

@ -26,16 +26,10 @@ License
#include "PackedList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct with given size and value for all elements.
template<int nBits>
PackedList<nBits>::PackedList(const label size, const unsigned int val)
Foam::PackedList<nBits>::PackedList(const label size, const unsigned int val)
:
List<unsigned int>(intSize(size)),
size_(size)
@ -44,26 +38,23 @@ PackedList<nBits>::PackedList(const label size, const unsigned int val)
}
//- Copy constructor.
template<int nBits>
PackedList<nBits>::PackedList(const PackedList<nBits>& PList)
Foam::PackedList<nBits>::PackedList(const PackedList<nBits>& lst)
:
List<unsigned int>(PList),
size_(PList.size())
List<unsigned int>(lst),
size_(lst.size())
{}
template<int nBits>
PackedList<nBits>::PackedList(const xfer<PackedList<nBits> >& lst)
Foam::PackedList<nBits>::PackedList(const xfer<PackedList<nBits> >& lst)
{
transfer(lst());
}
//- Construct from labelList
template<int nBits>
PackedList<nBits>::PackedList(const labelList& lst)
Foam::PackedList<nBits>::PackedList(const UList<label>& lst)
:
List<unsigned int>(intSize(lst.size()), 0),
size_(lst.size())
@ -76,7 +67,7 @@ PackedList<nBits>::PackedList(const labelList& lst)
template<int nBits>
autoPtr<PackedList<nBits> > PackedList<nBits>::clone() const
Foam::autoPtr<Foam::PackedList<nBits> > Foam::PackedList<nBits>::clone() const
{
return autoPtr<PackedList<nBits> >(new PackedList<nBits>(*this));
}
@ -84,24 +75,24 @@ autoPtr<PackedList<nBits> > PackedList<nBits>::clone() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <int nBits>
void PackedList<nBits>::setSize(const label size)
template<int nBits>
void Foam::PackedList<nBits>::setSize(const label size)
{
List<unsigned int>::setSize(intSize(size));
size_ = size;
}
template <int nBits>
void PackedList<nBits>::clear()
template<int nBits>
void Foam::PackedList<nBits>::clear()
{
List<unsigned int>::clear();
size_ = 0;
}
template <int nBits>
void PackedList<nBits>::transfer(PackedList<nBits>& lst)
template<int nBits>
void Foam::PackedList<nBits>::transfer(PackedList<nBits>& lst)
{
size_ = lst.size();
List<unsigned int>::transfer(lst);
@ -111,16 +102,16 @@ void PackedList<nBits>::transfer(PackedList<nBits>& lst)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// Assignment.
template <int nBits>
void PackedList<nBits>::operator=(const PackedList<nBits>& pl)
template<int nBits>
void Foam::PackedList<nBits>::operator=(const PackedList<nBits>& lst)
{
setSize(pl.size());
List<unsigned int>::operator=(pl);
setSize(lst.size());
List<unsigned int>::operator=(lst);
}
template <int nBits>
labelList PackedList<nBits>::operator()() const
template<int nBits>
Foam::labelList Foam::PackedList<nBits>::operator()() const
{
labelList elems(size());
@ -134,17 +125,14 @@ labelList PackedList<nBits>::operator()() const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
//template <int nBits>
//Ostream& ::Foam::operator<<(Ostream& os, const PackedList<nBits>& PL)
//template<int nBits>
//Foam::Ostream& ::Foam::operator<<(Ostream& os, const PackedList<nBits>& lst)
//{
// os << PL();
// os << lst();
// return os;
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,7 +26,8 @@ Class
Foam::PackedList
Description
List of packed unsigned ints. Gets given the number of bits per item.
List of packed unsigned ints.
Gets given the number of bits per item.
SourceFiles
PackedListI.H
@ -47,14 +48,14 @@ namespace Foam
/*---------------------------------------------------------------------------*\
Class PackedListName Declaration
Class PackedListName Declaration
\*---------------------------------------------------------------------------*/
TemplateName(PackedList);
/*---------------------------------------------------------------------------*\
Class PackedList Declaration
Class PackedList Declaration
\*---------------------------------------------------------------------------*/
//- For PackedList
@ -137,8 +138,8 @@ public:
//- Construct by transferring the parameter contents
PackedList(const xfer<PackedList<nBits> >&);
//- Construct from labelList.
PackedList(const labelList&);
//- Construct from a list of labels
PackedList(const UList<label>&);
//- Clone
inline autoPtr<PackedList<nBits> > clone() const;

View File

@ -125,7 +125,7 @@ void Foam::ParSortableList<Type>::checkAndSend
// Construct from List, sorting the elements
template <class Type>
Foam::ParSortableList<Type>::ParSortableList(const List<Type>& values)
Foam::ParSortableList<Type>::ParSortableList(const UList<Type>& values)
:
List<Type>(values),
indices_(0),

View File

@ -173,7 +173,7 @@ public:
// Constructors
//- Construct from List, sorting the elements.
ParSortableList(const List<Type>&);
ParSortableList(const UList<Type>&);
//- Construct given size. Sort later on.
ParSortableList(const label size);
@ -181,10 +181,9 @@ public:
// Member Functions
//- Sort the list (if changed after construction time)
//- (stable) sort the list (if changed after construction time)
void sort();
//- Return the list of sorted point indices
const labelList& indices() const
{

View File

@ -24,53 +24,45 @@ License
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from List
template <class Type>
Foam::SortableList<Type>::SortableList()
{}
template <class Type>
Foam::SortableList<Type>::SortableList(const UList<Type>& values)
:
List<Type>(values),
indices_(values.size())
List<Type>(values)
{
sort();
}
// Construct from List by transferring
template <class Type>
Foam::SortableList<Type>::SortableList(const xfer<List<Type> >& values)
:
List<Type>(),
indices_(values->size())
List<Type>(values)
{
List<Type>::transfer(values());
sort();
}
// Construct given size. Sort later on.
template <class Type>
Foam::SortableList<Type>::SortableList(const label size)
:
List<Type>(size),
indices_(size)
List<Type>(size)
{}
// Construct given size and initial value. Sort later on.
template <class Type>
Foam::SortableList<Type>::SortableList(const label size, const Type& val)
:
List<Type>(size, val),
indices_(size)
List<Type>(size, val)
{}
// Construct as copy.
template <class Type>
Foam::SortableList<Type>::SortableList(const SortableList<Type>& lst)
:
@ -85,34 +77,59 @@ template <class Type>
void Foam::SortableList<Type>::setSize(const label newSize)
{
List<Type>::setSize(newSize);
indices_.setSize(newSize);
indices_.setSize(newSize, -1);
}
template <class Type>
void Foam::SortableList<Type>::clear()
{
List<Type>::clear();
indices_.clear();
}
template <class Type>
Foam::List<Type>& Foam::SortableList<Type>::shrink()
{
indices_.clear();
return static_cast<List<Type>&>(*this);
}
template <class Type>
void Foam::SortableList<Type>::sort()
{
// list lengths must be identical
indices_.setSize(this->size());
forAll(indices_, i)
{
indices_[i] = i;
}
// Foam::sort(indices_, less(*this));
Foam::stableSort(indices_, less(*this));
List<Type> tmpValues(this->size());
Foam::stableSort(indices_, typename UList<Type>::less(*this));
List<Type> lst(this->size());
forAll(indices_, i)
{
tmpValues[i] = this->operator[](indices_[i]);
lst[i] = this->operator[](indices_[i]);
}
List<Type>::transfer(tmpValues);
List<Type>::transfer(lst);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template <class Type>
void Foam::SortableList<Type>::operator=(const UList<Type>& rhs)
{
List<Type>::operator=(rhs);
indices_.clear();
}
template <class Type>
void Foam::SortableList<Type>::operator=(const SortableList<Type>& rhs)
{
@ -120,7 +137,6 @@ void Foam::SortableList<Type>::operator=(const SortableList<Type>& rhs)
indices_ = rhs.indices();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -60,44 +60,25 @@ class SortableList
//- Original indices
labelList indices_;
public:
// Public classes
//- Less function class used by the sort function
class less
{
const UList<Type>& values_;
public:
less(const UList<Type>& values)
:
values_(values)
{}
bool operator()(const label a, const label b)
{
return values_[a] < values_[b];
}
};
// Constructors
//- Construct from List, sorting the elements.
// Starts with indices set to index in argument
//- Null constructor, sort later (eg, after assignment or transfer)
SortableList();
//- Construct from UList, sorting immediately.
explicit SortableList(const UList<Type>&);
//- Construct from tranferred List, sorting the elements.
// Starts with indices set to index in argument
//- Construct from transferred List, sorting immediately.
explicit SortableList(const xfer<List<Type> >&);
//- Construct given size. Sort later on.
// The indices remain empty until the list is sorted
explicit SortableList(const label size);
//- Construct given size and initial value. Sort later on.
// The indices remain empty until the list is sorted
SortableList(const label size, const Type&);
//- Construct as copy.
@ -112,15 +93,31 @@ public:
return indices_;
}
//- Size the list. If grow can cause undefined indices (until next sort)
//- Return non-const access to the sorted indices. Updated every sort.
labelList& indices()
{
return indices_;
}
//- Size the list. Growing can cause undefined indices (until next sort)
void setSize(const label);
//- (stable) sort the list (if changed after construction time)
void sort();
//- Clear the list and the indices
void clear();
//- Clear the indices and return a reference to the underlying List
List<Type>& shrink();
//- (stable) sort the list (if changed after construction time)
// also resizes the indices as required
void sort();
// Member Operators
//- Assignment from UList operator. Takes linear time.
void operator=(const UList<Type>&);
//- Assignment operator. Takes linear time.
void operator=(const SortableList<Type>&);
};

View File

@ -92,6 +92,26 @@ public:
//- Declare friendship with the SubList class
friend class SubList<T>;
// Public classes
//- Less function class that can be used for sorting
class less
{
const UList<T>& values_;
public:
less(const UList<T>& values)
:
values_(values)
{}
bool operator()(const label a, const label b)
{
return values_[a] < values_[b];
}
};
// Constructors

View File

@ -35,28 +35,88 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
#define addToMemberFunctionSelectionTable\
(baseType,thisType,memberFunction,argNames) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType memberFunction to the table */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
add##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_
// add to hash-table of functions with 'lookup' as the key
#define addNamedToMemberFunctionSelectionTable\
(baseType,thisType,memberFunction,argNames,lookup) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
add_##lookup##_##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addTemplateToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType memberFunction to the table */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addNamedTemplateToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
\
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Table_(#lookup)
// use when baseType requires the Targ template argument as well
#define addTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames) \
\
/* Add the thisType memberFunction to the table */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_
// use when baseType requires the Targ template argument as well
#define addNamedTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
\
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType requires the Targ template argument as well
#define addTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames) \
\
/* Add the thisType memberFunction to the table */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType requires the Targ template argument as well
#define addNamedTemplatedToMemberFunctionSelectionTable\
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
\
/* Add the thisType memberFunction to the table, find by lookup name */ \
baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -39,6 +39,10 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection:
#define declareMemberFunctionSelectionTable\
(returnType,baseType,memberFunction,argNames,argList,parList) \
\
@ -79,17 +83,19 @@ Description
} \
}; \
\
/* Table MemberFunction called from the table add function */ \
/* Table memberFunction called from the table add function */ \
static void construct##memberFunction##argNames##MemberFunctionTables(); \
\
/* Table destructor called from the table add function destructor */ \
static void destroy##memberFunction##argNames##MemberFunctionTables()
// internal use:
// constructor aid
#define defineMemberFunctionSelectionTableMemberFunction\
(baseType,memberFunction,argNames) \
\
/* Table MemberFunction called from the table add function */ \
/* Table memberFunction called from the table add function */ \
void baseType::construct##memberFunction##argNames##MemberFunctionTables()\
{ \
static bool constructed = false; \
@ -103,6 +109,9 @@ Description
} \
}
// internal use:
// destructor aid
#define defineMemberFunctionSelectionTableDestructor\
(baseType,memberFunction,argNames) \
\
@ -116,21 +125,33 @@ Description
} \
}
// internal use:
// create pointer to hash-table of functions
#define defineMemberFunctionSelectionTablePtr\
(baseType,memberFunction,argNames) \
\
/* Define the constructor function table */ \
/* Define the memberFunction table */ \
baseType::memberFunction##argNames##MemberFunctionTable* \
baseType::memberFunction##argNames##MemberFunctionTablePtr_ = NULL
// not much in use:
#define defineTemplateMemberFunctionSelectionTablePtr\
(baseType,memberFunction,argNames) \
\
/* Define the constructor function table */ \
/* Define the memberFunction table */ \
typename baseType::memberFunction##argNames##MemberFunctionTable* \
baseType::memberFunction##argNames##MemberFunctionTablePtr_ = NULL
#define defineMemberFunctionSelectionTable(baseType,memberFunction,argNames) \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table
#define defineMemberFunctionSelectionTable\
(baseType,memberFunction,argNames) \
\
defineMemberFunctionSelectionTablePtr \
(baseType,memberFunction,argNames); \
@ -139,6 +160,11 @@ Description
defineMemberFunctionSelectionTableDestructor \
(baseType,memberFunction,argNames)
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType doesn't need a template argument (eg, is a typedef)
#define defineTemplateMemberFunctionSelectionTable\
(baseType,memberFunction,argNames) \
\
@ -155,6 +181,74 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// internal use:
// constructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTableMemberFunction\
(baseType,memberFunction,argNames,Targ) \
\
/* Table memberFunction called from the table add function */ \
void baseType<Targ>::construct##memberFunction##argNames##MemberFunctionTables()\
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ \
= new baseType<Targ>::memberFunction##argNames##MemberFunctionTable;\
\
constructed = true; \
} \
}
// internal use:
// destructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTableDestructor\
(baseType,memberFunction,argNames,Targ) \
\
/* Table destructor called from the table add function destructor */ \
void baseType<Targ>::destroy##memberFunction##argNames##MemberFunctionTables() \
{ \
if (baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_) \
{ \
delete baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_;\
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ = NULL;\
} \
}
// internal use:
// create pointer to hash-table of functions
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTablePtr\
(baseType,memberFunction,argNames,Targ) \
\
/* Define the memberFunction table */ \
baseType<Targ>::memberFunction##argNames##MemberFunctionTable* \
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ = NULL
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType requires the Targ template argument
#define defineTemplatedMemberFunctionSelectionTable\
(baseType,memberFunction,argNames,Targ) \
\
template<> \
defineTemplatedMemberFunctionSelectionTablePtr \
(baseType,memberFunction,argNames,Targ); \
template<> \
defineTemplatedMemberFunctionSelectionTableMemberFunction \
(baseType,memberFunction,argNames,Targ) \
template<> \
defineTemplatedMemberFunctionSelectionTableDestructor \
(baseType,memberFunction,argNames,Targ)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,24 +35,70 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define addToRunTimeSelectionTable(baseType,thisType,argNames) \
// add to hash-table of functions with typename as the key
#define addToRunTimeSelectionTable\
(baseType,thisType,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType> \
add##thisType##argNames##ConstructorTo##baseType##Table_
#define addNamedToRunTimeSelectionTable(baseType,thisType,argNames,lookup) \
// add to hash-table of functions with 'lookup' as the key
#define addNamedToRunTimeSelectionTable\
(baseType,thisType,argNames,lookup) \
\
/* Add the thisType constructor function to the table */ \
/* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType> \
add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_(#lookup)
#define addTemplateToRunTimeSelectionTable(baseType,thisType,Targ,argNames) \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addTemplateToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ> > \
add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType doesn't need a template argument (eg, is a typedef)
#define addNamedTemplateToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames,lookup) \
\
/* Add the thisType constructor function to the table, find by lookup */ \
baseType::add##argNames##ConstructorToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// add to hash-table of functions with typename as the key
// use when baseType requires the Targ template argument as well
#define addTemplatedToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames) \
\
/* Add the thisType constructor function to the table */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ> > \
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
// add to hash-table of functions with 'lookup' as the key
// use when baseType requires the Targ template argument as well
#define addNamedTemplatedToRunTimeSelectionTable\
(baseType,thisType,Targ,argNames,lookup) \
\
/* Add the thisType constructor function to the table, find by lookup */ \
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ> > \
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_(#lookup)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -46,158 +46,259 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection:
#define declareRunTimeSelectionTable\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New argList \
{ \
return autoPtr<baseType>(new baseType##Type parList); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert(lookup, New); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table Constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New argList \
{ \
return autoPtr<baseType>(new baseType##Type parList); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert(lookup, New); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */ \
static void destroy##argNames##ConstructorTables()
// external use:
// ~~~~~~~~~~~~~
// declare a run-time selection for derived classes:
#define declareRunTimeNewSelectionTable\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New##baseType argList \
{ \
return autoPtr<baseType>(baseType##Type::New parList.ptr());\
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert \
( \
lookup, \
New##baseType \
); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table Constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */\
(autoPtr,baseType,argNames,argList,parList) \
\
/* Construct from argList function pointer type */ \
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
\
/* Construct from argList function table type */ \
typedef HashTable<argNames##ConstructorPtr, word, string::hash> \
argNames##ConstructorTable; \
\
/* Construct from argList function pointer table pointer */ \
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
\
/* Class to add constructor from argList to table */ \
template<class baseType##Type> \
class add##argNames##ConstructorToTable \
{ \
public: \
\
static autoPtr<baseType> New##baseType argList \
{ \
return autoPtr<baseType>(baseType##Type::New parList.ptr()); \
} \
\
add##argNames##ConstructorToTable \
( \
const word& lookup = baseType##Type::typeName \
) \
{ \
construct##argNames##ConstructorTables(); \
argNames##ConstructorTablePtr_->insert \
( \
lookup, \
New##baseType \
); \
} \
\
~add##argNames##ConstructorToTable() \
{ \
destroy##argNames##ConstructorTables(); \
} \
}; \
\
/* Table constructor called from the table add function */ \
static void construct##argNames##ConstructorTables(); \
\
/* Table destructor called from the table add function destructor */ \
static void destroy##argNames##ConstructorTables()
#define defineRunTimeSelectionTableConstructor(baseType,argNames) \
\
/* Table Constructor called from the table add function */ \
void baseType::construct##argNames##ConstructorTables() \
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType::argNames##ConstructorTablePtr_ \
= new baseType::argNames##ConstructorTable; \
\
constructed = true; \
} \
// internal use:
// constructor aid
#define defineRunTimeSelectionTableConstructor\
(baseType,argNames) \
\
/* Table constructor called from the table add function */ \
void baseType::construct##argNames##ConstructorTables() \
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType::argNames##ConstructorTablePtr_ \
= new baseType::argNames##ConstructorTable; \
\
constructed = true; \
} \
}
#define defineRunTimeSelectionTableDestructor(baseType,argNames) \
\
/* Table destructor called from the table add function destructor */\
void baseType::destroy##argNames##ConstructorTables() \
{ \
if (baseType::argNames##ConstructorTablePtr_) \
{ \
delete baseType::argNames##ConstructorTablePtr_; \
baseType::argNames##ConstructorTablePtr_ = NULL; \
} \
// internal use:
// destructor aid
#define defineRunTimeSelectionTableDestructor\
(baseType,argNames) \
\
/* Table destructor called from the table add function destructor */ \
void baseType::destroy##argNames##ConstructorTables() \
{ \
if (baseType::argNames##ConstructorTablePtr_) \
{ \
delete baseType::argNames##ConstructorTablePtr_; \
baseType::argNames##ConstructorTablePtr_ = NULL; \
} \
}
#define defineRunTimeSelectionTablePtr(baseType,argNames) \
\
/* Define the constructor function table */ \
baseType::argNames##ConstructorTable* \
// internal use:
// create pointer to hash-table of functions
#define defineRunTimeSelectionTablePtr\
(baseType,argNames) \
\
/* Define the constructor function table */ \
baseType::argNames##ConstructorTable* \
baseType::argNames##ConstructorTablePtr_ = NULL
#define defineTemplateRunTimeSelectionTablePtr(baseType,argNames) \
\
/* Define the constructor function table */ \
typename baseType::argNames##ConstructorTable* \
// not much in use:
#define defineTemplateRunTimeSelectionTablePtr(baseType,argNames) \
\
/* Define the constructor function table */ \
typename baseType::argNames##ConstructorTable* \
baseType::argNames##ConstructorTablePtr_ = NULL
#define defineRunTimeSelectionTable(baseType,argNames) \
\
defineRunTimeSelectionTablePtr(baseType,argNames); \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table
#define defineRunTimeSelectionTable\
(baseType,argNames) \
\
defineRunTimeSelectionTablePtr(baseType,argNames); \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
defineRunTimeSelectionTableDestructor(baseType,argNames)
#define defineTemplateRunTimeSelectionTable(baseType,argNames) \
\
template<> \
defineRunTimeSelectionTablePtr(baseType,argNames); \
template<> \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
template<> \
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType doesn't need a template argument (eg, is a typedef)
#define defineTemplateRunTimeSelectionTable\
(baseType,argNames) \
\
template<> \
defineRunTimeSelectionTablePtr(baseType,argNames); \
template<> \
defineRunTimeSelectionTableConstructor(baseType,argNames) \
template<> \
defineRunTimeSelectionTableDestructor(baseType,argNames)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// internal use:
// constructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTableConstructor\
(baseType,argNames,Targ) \
\
/* Table constructor called from the table add function */ \
void baseType<Targ>::construct##argNames##ConstructorTables() \
{ \
static bool constructed = false; \
\
if (!constructed) \
{ \
baseType<Targ>::argNames##ConstructorTablePtr_ \
= new baseType<Targ>::argNames##ConstructorTable; \
\
constructed = true; \
} \
}
// internal use:
// destructor aid
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTableDestructor\
(baseType,argNames,Targ) \
\
/* Table destructor called from the table add function destructor */ \
void baseType<Targ>::destroy##argNames##ConstructorTables() \
{ \
if (baseType<Targ>::argNames##ConstructorTablePtr_) \
{ \
delete baseType<Targ>::argNames##ConstructorTablePtr_; \
baseType<Targ>::argNames##ConstructorTablePtr_ = NULL; \
} \
}
// internal use:
// create pointer to hash-table of functions
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTablePtr\
(baseType,argNames,Targ) \
\
/* Define the constructor function table */ \
baseType<Targ>::argNames##ConstructorTable* \
baseType<Targ>::argNames##ConstructorTablePtr_ = NULL
// external use:
// ~~~~~~~~~~~~~
// define run-time selection table for template classes
// use when baseType requires the Targ template argument
#define defineTemplatedRunTimeSelectionTable\
(baseType,argNames,Targ) \
\
template<> \
defineTemplatedRunTimeSelectionTablePtr(baseType,argNames,Targ); \
template<> \
defineTemplatedRunTimeSelectionTableConstructor(baseType,argNames,Targ) \
template<> \
defineTemplatedRunTimeSelectionTableDestructor(baseType,argNames,Targ)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -181,10 +181,7 @@ inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap)
{
if (this != &ap)
{
const_cast<autoPtr<T>&>(*this).reset
(
const_cast<autoPtr<T>&>(ap).ptr()
);
reset(const_cast<autoPtr<T>&>(ap).ptr());
}
}

View File

@ -90,10 +90,10 @@ public:
inline explicit xfer(T* = 0);
//- Construct by copying or by transferring the parameter contents
inline xfer(T&, bool allowTransfer=false);
inline explicit xfer(T&, bool allowTransfer=false);
//- Construct by copying the parameter contents
inline xfer(const T&);
inline explicit xfer(const T&);
//- Construct by transferring the contents
inline xfer(const xfer<T>&);

View File

@ -27,14 +27,9 @@ License
#include "boundBox.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
boundBox::boundBox(const pointField& points, const bool doReduce)
Foam::boundBox::boundBox(const pointField& points, const bool doReduce)
:
min_(vector::zero),
max_(vector::zero)
@ -78,7 +73,7 @@ boundBox::boundBox(const pointField& points, const bool doReduce)
}
boundBox::boundBox(Istream& is)
Foam::boundBox::boundBox(Istream& is)
{
operator>>(is, *this);
}
@ -86,7 +81,7 @@ boundBox::boundBox(Istream& is)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const boundBox& bb)
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
{
if (os.format() == IOstream::ASCII)
{
@ -108,7 +103,7 @@ Ostream& operator<<(Ostream& os, const boundBox& bb)
}
Istream& operator>>(Istream& is, boundBox& bb)
Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
{
if (is.format() == IOstream::ASCII)
{
@ -129,9 +124,4 @@ Istream& operator>>(Istream& is, boundBox& bb)
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -75,8 +75,8 @@ public:
//- Construct given size
explicit inline cell(label);
//- Construct from components
explicit inline cell(const labelList&);
//- Construct from list of labels
explicit inline cell(const UList<label>&);
//- Construct by transferring the parameter contents
explicit inline cell(const xfer<labelList>&);

Some files were not shown because too many files have changed in this diff Show More