Merge commit 'origin/master' into olesenm
This commit is contained in:
commit
8e2182dd69
@ -43,23 +43,20 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readTimeControls.H"
|
||||
# include "readPIMPLEControls.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "readPIMPLEControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
@ -75,13 +72,13 @@ int main(int argc, char *argv[])
|
||||
int oCorr=0;
|
||||
do
|
||||
{
|
||||
# include "UEqn.H"
|
||||
# include "hEqn.H"
|
||||
#include "UEqn.H"
|
||||
#include "hEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
# include "pEqn.H"
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
@ -37,8 +37,7 @@
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
rho0 + psi*(p - p0),
|
||||
p.boundaryField().types()
|
||||
rhoO + psi*p
|
||||
);
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ Application
|
||||
sonicLiquidFoam
|
||||
|
||||
Description
|
||||
Transient solver for trans-sonic/supersonic, laminar flow of a
|
||||
Transient solver for trans-sonic/supersonic, laminar flow of a
|
||||
compressible liquid.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
buoyantSimpleRadiationFoam.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/buoyantSimpleRadiationFoam
|
||||
EXE = $(FOAM_APPBIN)/buoyantSimpleRadiationFoam
|
||||
|
||||
|
3
applications/solvers/molecularDynamics/gnemdFoam/Make/files
Executable file
3
applications/solvers/molecularDynamics/gnemdFoam/Make/files
Executable file
@ -0,0 +1,3 @@
|
||||
gnemdFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/gnemdFoam
|
11
applications/solvers/molecularDynamics/gnemdFoam/Make/options
Executable file
11
applications/solvers/molecularDynamics/gnemdFoam/Make/options
Executable file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/molecule/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llagrangian \
|
||||
-lmolecule
|
90
applications/solvers/molecularDynamics/gnemdFoam/gnemdFoam.C
Executable file
90
applications/solvers/molecularDynamics/gnemdFoam/gnemdFoam.C
Executable file
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2005 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
|
||||
gnemdFOAM
|
||||
|
||||
Description
|
||||
MD for Fluid Mechanics and hybridising with a continuum solver.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "md.H"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
moleculeCloud molecules(mesh);
|
||||
|
||||
# include "createMDFields.H"
|
||||
|
||||
molecules.removeHighEnergyOverlaps();
|
||||
|
||||
# include "temperatureAndPressureVariables.H"
|
||||
|
||||
label nAveragingSteps = 0;
|
||||
|
||||
Info << "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
runTime++;
|
||||
|
||||
nAveragingSteps++;
|
||||
|
||||
Info << "Time = " << runTime.timeName() << endl;
|
||||
|
||||
molecules.integrateEquationsOfMotion();
|
||||
|
||||
# include "meanMomentumEnergyAndNMols.H"
|
||||
|
||||
# include "temperatureAndPressure.H"
|
||||
|
||||
# include "calculateMDFields.H"
|
||||
|
||||
# include "averageMDFields.H"
|
||||
|
||||
runTime.write();
|
||||
|
||||
# include "resetMDFields.H"
|
||||
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
nAveragingSteps = 0;
|
||||
}
|
||||
|
||||
Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info << "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
3
applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files
Executable file
3
applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/files
Executable file
@ -0,0 +1,3 @@
|
||||
mdEquilibrationFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/mdEquilibrationFoam
|
11
applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options
Executable file
11
applications/solvers/molecularDynamics/mdEquilibrationFoam/Make/options
Executable file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/molecule/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume \
|
||||
-llagrangian \
|
||||
-lmolecule
|
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2005 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
|
||||
mdEquilibrationFOAM
|
||||
|
||||
Description
|
||||
Equilibrates and/or preconditions MD systems
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "md.H"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
moleculeCloud molecules(mesh);
|
||||
|
||||
molecules.removeHighEnergyOverlaps();
|
||||
|
||||
# include "temperatureAndPressureVariables.H"
|
||||
|
||||
# include "readmdEquilibrationDict.H"
|
||||
|
||||
label nAveragingSteps = 0;
|
||||
|
||||
Info << "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
runTime++;
|
||||
|
||||
nAveragingSteps++;
|
||||
|
||||
Info << "Time = " << runTime.timeName() << endl;
|
||||
|
||||
molecules.integrateEquationsOfMotion();
|
||||
|
||||
# include "meanMomentumEnergyAndNMols.H"
|
||||
|
||||
# include "temperatureAndPressure.H"
|
||||
|
||||
# include "temperatureEquilibration.H"
|
||||
|
||||
runTime.write();
|
||||
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
nAveragingSteps = 0;
|
||||
}
|
||||
|
||||
Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info << "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
Info<< "Reading MD Equilibration Dictionary" << nl << endl;
|
||||
|
||||
IOdictionary mdEquilibrationDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mdEquilibrationDict",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
scalar targetTemperature = readScalar
|
||||
(
|
||||
mdEquilibrationDict.lookup("equilibrationTargetTemperature")
|
||||
);
|
@ -1,3 +1,3 @@
|
||||
compressibleLesInterFoam.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/compressibleLesInterFoam
|
||||
EXE = $(FOAM_APPBIN)/compressibleLesInterFoam
|
||||
|
@ -23,9 +23,10 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
rasCavitatingFoam
|
||||
lesCavitatingFoam
|
||||
|
||||
Description
|
||||
Transient cavitation code with LES turbulence.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -26,6 +26,7 @@ Application
|
||||
rasCavitatingFoam
|
||||
|
||||
Description
|
||||
Transient cavitation code with RAS turbulence.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -71,8 +71,8 @@ frictionalPressure
|
||||
const dimensionedScalar& eta,
|
||||
const dimensionedScalar& p
|
||||
) const
|
||||
{
|
||||
return
|
||||
{
|
||||
return
|
||||
dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24)
|
||||
*pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0);
|
||||
}
|
||||
@ -89,7 +89,7 @@ frictionalPressurePrime
|
||||
const dimensionedScalar& p
|
||||
) const
|
||||
{
|
||||
return
|
||||
return
|
||||
dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25)
|
||||
*pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0);
|
||||
}
|
||||
@ -129,8 +129,8 @@ Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::muf
|
||||
{
|
||||
if (alpha[celli] > alphaMax.value()-5e-2)
|
||||
{
|
||||
muf_[celli] =
|
||||
0.5*alpha[celli]*pf[celli]*sin(phi.value())
|
||||
muf_[celli] =
|
||||
0.5*pf[celli]*sin(phi.value())
|
||||
/(
|
||||
sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy())
|
||||
+ sqr(D[celli].yy() - D[celli].zz())
|
||||
|
3
applications/test/dataEntry/Make/files
Normal file
3
applications/test/dataEntry/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
testDataEntry.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/testDataEntry
|
11
applications/test/dataEntry/Make/options
Normal file
11
applications/test/dataEntry/Make/options
Normal file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-llagrangianIntermediate \
|
||||
-lradiation \
|
||||
-lthermophysicalFunctions
|
4
applications/test/dataEntry/files
Normal file
4
applications/test/dataEntry/files
Normal file
@ -0,0 +1,4 @@
|
||||
testTable.C
|
||||
|
||||
EXE=$(FOAM_USER_APPBIN)/testTable
|
||||
|
@ -23,83 +23,64 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
Rcomponents
|
||||
testDataEntry
|
||||
|
||||
Description
|
||||
Calculates and writes the scalar fields of the six components of the
|
||||
Reynolds stress R for each time.
|
||||
Tests lagrangian/intermediate/submodels/IO/DataEntry
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "DataEntry.H"
|
||||
#include "IOdictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
// set startTime and endTime depending on -time and -latestTime options
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
|
||||
# include "createMesh.H"
|
||||
|
||||
for (label i=startTime; i<endTime; i++)
|
||||
{
|
||||
runTime.setTime(Times[i], i);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
IOobject Rheader
|
||||
IOdictionary dataEntryProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R",
|
||||
runTime.timeName(),
|
||||
"dataEntryProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
// Check R exists
|
||||
if (Rheader.headerOk())
|
||||
{
|
||||
mesh.readUpdate();
|
||||
autoPtr<DataEntry<scalar> > dataEntry
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"dataEntry",
|
||||
dataEntryProperties
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Reading R" << endl;
|
||||
volSymmTensorField R(Rheader, mesh);
|
||||
scalar x0 = readScalar(dataEntryProperties.lookup("x0"));
|
||||
scalar x1 = readScalar(dataEntryProperties.lookup("x1"));
|
||||
|
||||
for (direction i=0; i<tensor::nComponents; i++)
|
||||
{
|
||||
Info<< " Calculating R" << tensor::componentNames[i] << endl;
|
||||
Info<< "Data entry type: " << dataEntry().type() << nl << endl;
|
||||
|
||||
volScalarField Ri
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R" + word(tensor::componentNames[i]),
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
R.component(i)
|
||||
);
|
||||
Ri.write();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " No R" << endl;
|
||||
}
|
||||
Info<< "Inputs" << nl
|
||||
<< " x0 = " << x0 << nl
|
||||
<< " x1 = " << x1 << nl
|
||||
<< endl;
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
Info<< "Interpolation" << nl
|
||||
<< " f(x0) = " << dataEntry().value(x0) << nl
|
||||
<< " f(x1) = " << dataEntry().value(x1) << nl
|
||||
<< endl;
|
||||
|
||||
Info<< "Integration" << nl
|
||||
<< " int(f(x)) lim(x0->x1) = " << dataEntry().integrate(x0, x1) << nl
|
||||
<< endl;
|
||||
|
||||
return(0);
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
refineHexMesh.C
|
||||
EXE = $(FOAM_APPBIN)/refineHexMesh
|
||||
|
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools \
|
||||
-lfiniteVolume
|
@ -0,0 +1,185 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Description
|
||||
Hex 2x2x2 refiner
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvMesh.H"
|
||||
#include "pointMesh.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "hexRef8.H"
|
||||
#include "cellSet.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
#include "IFstream.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "volMesh.H"
|
||||
#include "surfaceMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pointFields.H"
|
||||
#include "ReadFields.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Main program:
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validArgs.append("cellSet");
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
pointMesh pMesh(mesh);
|
||||
|
||||
word cellSetName(args.args()[1]);
|
||||
|
||||
Info<< "Reading cells to refine from cellSet " << cellSetName
|
||||
<< nl << endl;
|
||||
|
||||
cellSet cellsToRefine(mesh, cellSetName);
|
||||
|
||||
Info<< "Read " << returnReduce(cellsToRefine.size(), sumOp<label>())
|
||||
<< " cells to refine from cellSet " << cellSetName << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
// Read objects in time directory
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
// Read vol fields.
|
||||
|
||||
PtrList<volScalarField> vsFlds;
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
|
||||
PtrList<volVectorField> vvFlds;
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
|
||||
PtrList<volSphericalTensorField> vstFlds;
|
||||
ReadFields(mesh, objects, vstFlds);
|
||||
|
||||
PtrList<volSymmTensorField> vsymtFlds;
|
||||
ReadFields(mesh, objects, vsymtFlds);
|
||||
|
||||
PtrList<volTensorField> vtFlds;
|
||||
ReadFields(mesh, objects, vtFlds);
|
||||
|
||||
// Read surface fields.
|
||||
|
||||
PtrList<surfaceScalarField> ssFlds;
|
||||
ReadFields(mesh, objects, ssFlds);
|
||||
|
||||
PtrList<surfaceVectorField> svFlds;
|
||||
ReadFields(mesh, objects, svFlds);
|
||||
|
||||
PtrList<surfaceSphericalTensorField> sstFlds;
|
||||
ReadFields(mesh, objects, sstFlds);
|
||||
|
||||
PtrList<surfaceSymmTensorField> ssymtFlds;
|
||||
ReadFields(mesh, objects, ssymtFlds);
|
||||
|
||||
PtrList<surfaceTensorField> stFlds;
|
||||
ReadFields(mesh, objects, stFlds);
|
||||
|
||||
// Read point fields
|
||||
PtrList<pointScalarField> psFlds;
|
||||
ReadFields(pMesh, objects, psFlds);
|
||||
|
||||
PtrList<pointVectorField> pvFlds;
|
||||
ReadFields(pMesh, objects, pvFlds);
|
||||
|
||||
|
||||
|
||||
// Construct refiner without unrefinement. Read existing point/cell level.
|
||||
hexRef8 meshCutter(mesh);
|
||||
|
||||
// Some stats
|
||||
Info<< "Read mesh:" << nl
|
||||
<< " cells:" << mesh.globalData().nTotalCells() << nl
|
||||
<< " faces:" << mesh.globalData().nTotalFaces() << nl
|
||||
<< " points:" << mesh.globalData().nTotalPoints() << nl
|
||||
<< " cellLevel :"
|
||||
<< " min:" << gMin(meshCutter.cellLevel())
|
||||
<< " max:" << gMax(meshCutter.cellLevel()) << nl
|
||||
<< " pointLevel :"
|
||||
<< " min:" << gMin(meshCutter.pointLevel())
|
||||
<< " max:" << gMax(meshCutter.pointLevel()) << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
// Maintain 2:1 ratio
|
||||
labelList newCellsToRefine
|
||||
(
|
||||
meshCutter.consistentRefinement
|
||||
(
|
||||
cellsToRefine.toc(),
|
||||
true // extend set
|
||||
)
|
||||
);
|
||||
|
||||
// Mesh changing engine.
|
||||
polyTopoChange meshMod(mesh);
|
||||
|
||||
// Play refinement commands into mesh changer.
|
||||
meshCutter.setRefinement(newCellsToRefine, meshMod);
|
||||
|
||||
runTime++;
|
||||
|
||||
// Create mesh, return map from old to new mesh.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
pMesh.updateMesh(map);
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter.updateMesh(map);
|
||||
|
||||
// Optionally inflate mesh
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
mesh.movePoints(map().preMotionPoints());
|
||||
pMesh.movePoints(map().preMotionPoints());
|
||||
}
|
||||
|
||||
Pout<< "Refined from " << returnReduce(map().nOldCells(), sumOp<label>())
|
||||
<< " to " << mesh.globalData().nTotalCells() << " cells." << nl << endl;
|
||||
|
||||
Info<< "Writing mesh to " << runTime.timeName() << endl;
|
||||
|
||||
mesh.write();
|
||||
meshCutter.write();
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -56,18 +56,14 @@ NOTE:
|
||||
always. Might use some geometric check instead.
|
||||
- marked faces might not actually be boundary faces of mesh. This is not handled
|
||||
and you'll have to run without face file (-noFaceFile option)
|
||||
- default is to have indices starting at 1. Use -startAt0 if starting at 0.
|
||||
- all input is expected to be ordered.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IFstream.H"
|
||||
#include "polyPatch.H"
|
||||
#include "cellModeller.H"
|
||||
#include "ListOps.H"
|
||||
#include <fstream>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -79,7 +75,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validArgs.append("file prefix");
|
||||
argList::validOptions.insert("noFaceFile", "");
|
||||
argList::validOptions.insert("startAt0", "");
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
@ -87,34 +82,29 @@ int main(int argc, char *argv[])
|
||||
|
||||
bool readFaceFile = !args.options().found("noFaceFile");
|
||||
|
||||
bool startAt1 = !args.options().found("startAt0");
|
||||
|
||||
fileName prefix(args.additionalArgs()[0]);
|
||||
|
||||
fileName nodeFile(prefix + ".node");
|
||||
fileName eleFile(prefix + ".ele");
|
||||
fileName faceFile(prefix + ".face");
|
||||
|
||||
Info<< "Files:" << endl
|
||||
<< " nodes : " << nodeFile << endl
|
||||
<< " elems : " << eleFile << endl
|
||||
<< " faces : " << faceFile << endl
|
||||
<< endl;
|
||||
|
||||
|
||||
if (readFaceFile)
|
||||
if (!readFaceFile)
|
||||
{
|
||||
Info<< "Reading .file for boundary information" << nl << endl;
|
||||
}
|
||||
if (startAt1)
|
||||
{
|
||||
Info<< "Numbering in files starts at 1" << nl << endl;
|
||||
Info<< "Files:" << endl
|
||||
<< " nodes : " << nodeFile << endl
|
||||
<< " elems : " << eleFile << endl
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Numbering in files starts at 0" << nl << endl;
|
||||
}
|
||||
Info<< "Files:" << endl
|
||||
<< " nodes : " << nodeFile << endl
|
||||
<< " elems : " << eleFile << endl
|
||||
<< " faces : " << faceFile << endl
|
||||
<< endl;
|
||||
|
||||
Info<< "Reading .face file for boundary information" << nl << endl;
|
||||
}
|
||||
|
||||
if (!exists(nodeFile) || !exists(eleFile))
|
||||
{
|
||||
@ -134,7 +124,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
std::ifstream nodeStream(nodeFile.c_str());
|
||||
IFstream nodeStream(nodeFile);
|
||||
|
||||
//
|
||||
// Read nodes.
|
||||
@ -145,7 +135,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
do
|
||||
{
|
||||
std::getline(nodeStream, line);
|
||||
nodeStream.getLine(line);
|
||||
}
|
||||
while((line.size() > 0) && (line[0] == '#'));
|
||||
|
||||
@ -169,61 +159,60 @@ int main(int argc, char *argv[])
|
||||
//
|
||||
|
||||
pointField points(nNodes);
|
||||
Map<label> nodeToPoint(nNodes);
|
||||
|
||||
label pointI = 0;
|
||||
|
||||
while (nodeStream.good())
|
||||
{
|
||||
std::getline(nodeStream, line);
|
||||
labelList pointIndex(nNodes);
|
||||
|
||||
if ((line.size() > 0) && (line[0] != '#'))
|
||||
label pointI = 0;
|
||||
|
||||
while (nodeStream.good())
|
||||
{
|
||||
IStringStream nodeLine(line);
|
||||
nodeStream.getLine(line);
|
||||
|
||||
label nodeI;
|
||||
scalar x, y, z;
|
||||
label dummy;
|
||||
|
||||
nodeLine >> nodeI >> x >> y >> z;
|
||||
|
||||
for (label i = 0; i < nNodeAttr; i++)
|
||||
if ((line.size() > 0) && (line[0] != '#'))
|
||||
{
|
||||
nodeLine >> dummy;
|
||||
}
|
||||
IStringStream nodeLine(line);
|
||||
|
||||
if (hasRegion)
|
||||
{
|
||||
nodeLine >> dummy;
|
||||
}
|
||||
label nodeI;
|
||||
scalar x, y, z;
|
||||
label dummy;
|
||||
|
||||
// Store point and node number.
|
||||
if
|
||||
(
|
||||
(!startAt1 && nodeI != pointI)
|
||||
|| (startAt1 && nodeI-1 != pointI)
|
||||
)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "point numbering not consecutive for node " << nodeI
|
||||
<< " or numbering starts"
|
||||
<< " at 0 or 1. Perhaps rerun w/o -startAt0 option?"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
nodeLine >> nodeI >> x >> y >> z;
|
||||
|
||||
points[pointI++] = point(x, y, z);
|
||||
for (label i = 0; i < nNodeAttr; i++)
|
||||
{
|
||||
nodeLine >> dummy;
|
||||
}
|
||||
|
||||
if (hasRegion)
|
||||
{
|
||||
nodeLine >> dummy;
|
||||
}
|
||||
|
||||
// Store point and node number.
|
||||
points[pointI] = point(x, y, z);
|
||||
nodeToPoint.insert(nodeI, pointI);
|
||||
pointI++;
|
||||
}
|
||||
}
|
||||
if (pointI != nNodes)
|
||||
{
|
||||
FatalIOErrorIn(args.executable().c_str(), nodeStream)
|
||||
<< "Only " << pointI << " nodes present instead of " << nNodes
|
||||
<< " from header." << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// read elements
|
||||
//
|
||||
|
||||
std::ifstream eleStream(eleFile.c_str());
|
||||
IFstream eleStream(eleFile);
|
||||
|
||||
do
|
||||
{
|
||||
std::getline(eleStream, line);
|
||||
eleStream.getLine(line);
|
||||
}
|
||||
while((line.size() > 0) && (line[0] == '#'));
|
||||
|
||||
@ -242,10 +231,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (nPtsPerTet != 4)
|
||||
{
|
||||
FatalErrorIn(args.executable()) << "Cannot handle tets with "
|
||||
FatalIOErrorIn(args.executable().c_str(), eleStream)
|
||||
<< "Cannot handle tets with "
|
||||
<< nPtsPerTet << " points per tetrahedron in .ele file" << endl
|
||||
<< "Can only handle tetrahedra with four points"
|
||||
<< exit(FatalError);
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (nElemAttr != 0)
|
||||
@ -262,39 +252,27 @@ int main(int argc, char *argv[])
|
||||
labelList tetPoints(4);
|
||||
|
||||
cellShapeList cells(nTets);
|
||||
label cellI = 0;
|
||||
|
||||
while (eleStream.good())
|
||||
{
|
||||
std::getline(eleStream, line);
|
||||
eleStream.getLine(line);
|
||||
|
||||
if ((line.size() > 0) && (line[0] != '#'))
|
||||
{
|
||||
IStringStream eleLine(line);
|
||||
|
||||
label elemI;
|
||||
|
||||
eleLine >> elemI;
|
||||
|
||||
if (startAt1)
|
||||
{
|
||||
--elemI;
|
||||
}
|
||||
|
||||
for (label i = 0; i < 4; i++)
|
||||
{
|
||||
label nodeI;
|
||||
|
||||
eleLine >> nodeI;
|
||||
|
||||
if (startAt1)
|
||||
{
|
||||
--nodeI;
|
||||
}
|
||||
|
||||
tetPoints[i] = nodeI;
|
||||
tetPoints[i] = nodeToPoint[nodeI];
|
||||
}
|
||||
|
||||
cells[elemI] = cellShape(tet, tetPoints);
|
||||
cells[cellI++] = cellShape(tet, tetPoints);
|
||||
|
||||
// Skip attributes
|
||||
for (label i = 0; i < nElemAttr; i++)
|
||||
@ -321,11 +299,11 @@ int main(int argc, char *argv[])
|
||||
// read boundary faces
|
||||
//
|
||||
|
||||
std::ifstream faceStream(faceFile.c_str());
|
||||
IFstream faceStream(faceFile);
|
||||
|
||||
do
|
||||
{
|
||||
std::getline(faceStream, line);
|
||||
faceStream.getLine(line);
|
||||
}
|
||||
while((line.size() > 0) && (line[0] == '#'));
|
||||
|
||||
@ -344,10 +322,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (nFaceAttr != 1)
|
||||
{
|
||||
FatalErrorIn(args.executable()) << "Expect boundary markers to be"
|
||||
FatalIOErrorIn(args.executable().c_str(), faceStream)
|
||||
<< "Expect boundary markers to be"
|
||||
<< " present in .face file." << endl
|
||||
<< "This is the second number in the header which is now:"
|
||||
<< nFaceAttr << exit(FatalError);
|
||||
<< nFaceAttr << exit(FatalIOError);
|
||||
}
|
||||
|
||||
// List of Foam vertices per boundary face
|
||||
@ -357,6 +336,8 @@ int main(int argc, char *argv[])
|
||||
boundaryPatch.setSize(nFaces);
|
||||
boundaryPatch = -1;
|
||||
|
||||
label faceI = 0;
|
||||
|
||||
// Region to patch conversion
|
||||
Map<label> regionToPatch;
|
||||
|
||||
@ -364,35 +345,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (faceStream.good())
|
||||
{
|
||||
std::getline(faceStream, line);
|
||||
faceStream.getLine(line);
|
||||
|
||||
if ((line.size() > 0) && (line[0] != '#'))
|
||||
{
|
||||
IStringStream faceLine(line);
|
||||
|
||||
label faceI, dummy, region;
|
||||
label tetGenFaceI, dummy, region;
|
||||
|
||||
faceLine >> faceI;
|
||||
|
||||
if (startAt1)
|
||||
{
|
||||
--faceI;
|
||||
}
|
||||
faceLine >> tetGenFaceI;
|
||||
|
||||
// Read face and reverse orientation (Foam needs outwards
|
||||
// pointing)
|
||||
for (label i = 0; i < 3; i++)
|
||||
{
|
||||
label nodeI;
|
||||
|
||||
faceLine >> nodeI;
|
||||
|
||||
if (startAt1)
|
||||
{
|
||||
--nodeI;
|
||||
}
|
||||
|
||||
f[2-i] = nodeI;
|
||||
f[2-i] = nodeToPoint[nodeI];
|
||||
}
|
||||
|
||||
boundaryFaces[faceI] = f;
|
||||
@ -431,6 +400,8 @@ int main(int argc, char *argv[])
|
||||
faceLine >> dummy;
|
||||
}
|
||||
}
|
||||
|
||||
faceI++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
autoHexMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/autoHexMesh
|
@ -105,16 +105,39 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (writeTopo)
|
||||
{
|
||||
word objMeshFile(runTime.path()/"blockTopology.obj");
|
||||
|
||||
Info<< nl << "Dumping block structure as Lightwave obj format"
|
||||
<< " to " << objMeshFile << endl;
|
||||
|
||||
// Write mesh as edges.
|
||||
{
|
||||
fileName objMeshFile("blockTopology.obj");
|
||||
|
||||
OFstream objStream(objMeshFile);
|
||||
OFstream str(runTime.path()/objMeshFile);
|
||||
|
||||
blocks.writeTopology(objStream);
|
||||
Info<< nl << "Dumping block structure as Lightwave obj format"
|
||||
<< " to " << objMeshFile << endl;
|
||||
|
||||
blocks.writeTopology(str);
|
||||
}
|
||||
|
||||
// Write centres of blocks
|
||||
{
|
||||
fileName objCcFile("blockCentres.obj");
|
||||
|
||||
OFstream str(runTime.path()/objCcFile);
|
||||
|
||||
Info<< nl << "Dumping block centres as Lightwave obj format"
|
||||
<< " to " << objCcFile << endl;
|
||||
|
||||
const polyMesh& topo = blocks.topology();
|
||||
|
||||
const pointField& cellCentres = topo.cellCentres();
|
||||
|
||||
forAll(cellCentres, cellI)
|
||||
{
|
||||
//point cc = b.blockShape().centre(b.points());
|
||||
const point& cc = cellCentres[cellI];
|
||||
|
||||
str << "v " << cc.x() << ' ' << cc.y() << ' ' << cc.z() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl << "end" << endl;
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
snappyHexMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/snappyHexMesh
|
@ -1,6 +1,6 @@
|
||||
EXE_INC = \
|
||||
/* -g -DFULLDEBUG -O0 */ \
|
||||
-I$(FOAM_UTILITIES)/parallelProcessing/decompositionMethods/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/decompositionAgglomeration/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/autoMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
@ -23,10 +23,10 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
autoHexMesh
|
||||
snappyHexMesh
|
||||
|
||||
Description
|
||||
Automatic split hex mesher.
|
||||
Automatic split hex mesher. Refines and snaps to surface.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"autoHexMeshDict",
|
||||
"snappyHexMeshDict",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
@ -47,7 +47,7 @@ Description
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef READLINE
|
||||
#if READLINE != 0
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#endif
|
||||
@ -57,7 +57,7 @@ using namespace Foam;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#ifdef READLINE
|
||||
#if READLINE != 0
|
||||
static const char* historyFile = ".setSet";
|
||||
#endif
|
||||
|
||||
@ -739,7 +739,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fileStreamPtr = new std::ifstream(batchFile.c_str());
|
||||
}
|
||||
#ifdef READLINE
|
||||
#if READLINE != 0
|
||||
else if (!read_history(historyFile))
|
||||
{
|
||||
Info<< "Successfully read history from " << historyFile << endl;
|
||||
@ -784,7 +784,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
# ifdef READLINE
|
||||
# if READLINE != 0
|
||||
{
|
||||
char* linePtr = readline("readline>");
|
||||
|
||||
|
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (!noTopology)
|
||||
{
|
||||
noFailedChecks += checkTopology(mesh, allTopology);
|
||||
noFailedChecks += checkTopology(mesh, allTopology, allGeometry);
|
||||
}
|
||||
|
||||
noFailedChecks += checkGeometry(mesh, allGeometry);
|
||||
|
@ -7,7 +7,12 @@
|
||||
#include "pointSet.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
Foam::label Foam::checkTopology(const polyMesh& mesh, const bool allTopology)
|
||||
Foam::label Foam::checkTopology
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const bool allTopology,
|
||||
const bool allGeometry
|
||||
)
|
||||
{
|
||||
label noFailedChecks = 0;
|
||||
|
||||
@ -142,39 +147,38 @@ Foam::label Foam::checkTopology(const polyMesh& mesh, const bool allTopology)
|
||||
<< setw(20) << "Patch"
|
||||
<< setw(9) << "Faces"
|
||||
<< setw(9) << "Points"
|
||||
<< " Surface" << endl;
|
||||
<< setw(34) << "Surface topology";
|
||||
if (allGeometry)
|
||||
{
|
||||
Pout<< " Bounding box";
|
||||
}
|
||||
Pout<< endl;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
Pout<< " "
|
||||
<< setw(20) << pp.name()
|
||||
<< setw(9) << pp.size()
|
||||
<< setw(9) << pp.nPoints();
|
||||
|
||||
|
||||
primitivePatch::surfaceTopo pTyp = pp.surfaceType();
|
||||
|
||||
if (pp.size() == 0)
|
||||
{
|
||||
Pout<< " "
|
||||
<< setw(20) << pp.name()
|
||||
<< setw(9) << pp.size()
|
||||
<< setw(9) << pp.nPoints()
|
||||
<< " ok (empty)" << endl;
|
||||
Pout<< setw(34) << "ok (empty)";
|
||||
}
|
||||
else if (pTyp == primitivePatch::MANIFOLD)
|
||||
{
|
||||
if (pp.checkPointManifold(true, &points))
|
||||
{
|
||||
Pout<< " "
|
||||
<< setw(20) << pp.name()
|
||||
<< setw(9) << pp.size()
|
||||
<< setw(9) << pp.nPoints()
|
||||
<< " multiply connected (shared point)" << endl;
|
||||
Pout<< setw(34) << "multiply connected (shared point)";
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< " "
|
||||
<< setw(20) << pp.name()
|
||||
<< setw(9) << pp.size()
|
||||
<< setw(9) << pp.nPoints()
|
||||
<< " ok (closed singly connected surface)" << endl;
|
||||
Pout<< setw(34) << "ok (closed singly connected)";
|
||||
}
|
||||
|
||||
// Add points on non-manifold edges to make set complete
|
||||
@ -186,22 +190,35 @@ Foam::label Foam::checkTopology(const polyMesh& mesh, const bool allTopology)
|
||||
|
||||
if (pTyp == primitivePatch::OPEN)
|
||||
{
|
||||
Pout<< " "
|
||||
<< setw(20) << pp.name()
|
||||
<< setw(9) << pp.size()
|
||||
<< setw(9) << pp.nPoints()
|
||||
<< " ok (not multiply connected)" << endl;
|
||||
Pout<< setw(34) << "ok (non-closed singly connected)";
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< " "
|
||||
<< setw(20) << pp.name()
|
||||
<< setw(9) << pp.size()
|
||||
<< setw(9) << pp.nPoints()
|
||||
<< " multiply connected surface (shared edge)"
|
||||
<< endl;
|
||||
Pout<< setw(34) << "multiply connected (shared edge)";
|
||||
}
|
||||
}
|
||||
|
||||
if (allGeometry)
|
||||
{
|
||||
const pointField& pts = pp.points();
|
||||
const labelList& mp = pp.meshPoints();
|
||||
|
||||
boundBox bb(vector::zero, vector::zero);
|
||||
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
||||
{
|
||||
bb.min() = pts[mp[0]];
|
||||
bb.max() = pts[mp[0]];
|
||||
for (label i = 1; i < mp.size(); i++)
|
||||
{
|
||||
bb.min() = min(bb.min(), pts[mp[i]]);
|
||||
bb.max() = max(bb.max(), pts[mp[i]]);
|
||||
}
|
||||
reduce(bb.min(), minOp<vector>());
|
||||
reduce(bb.max(), maxOp<vector>());
|
||||
}
|
||||
Pout<< ' ' << bb;
|
||||
}
|
||||
Pout<< endl;
|
||||
}
|
||||
|
||||
if (points.size() > 0)
|
||||
|
@ -4,5 +4,5 @@ namespace Foam
|
||||
{
|
||||
class polyMesh;
|
||||
|
||||
label checkTopology(const polyMesh& mesh, const bool allTopology);
|
||||
label checkTopology(const polyMesh&, const bool, const bool);
|
||||
}
|
||||
|
@ -2,8 +2,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(FOAM_UTILITIES)/parallelProcessing/decompositionMethods/decompositionMethods/lnInclude
|
||||
|
||||
-I$(LIB_SRC)/decompositionAgglomeration/decompositionMethods/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
|
@ -60,7 +60,7 @@ void subsetVolFields
|
||||
|
||||
Info<< "Subsetting field " << fieldName << endl;
|
||||
|
||||
GeometricField<Type, fvPatchField, volMesh> volField
|
||||
GeometricField<Type, fvPatchField, volMesh> fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -73,7 +73,7 @@ void subsetVolFields
|
||||
baseMesh
|
||||
);
|
||||
|
||||
subFields.set(i, subsetter.interpolate(volField));
|
||||
subFields.set(i, subsetter.interpolate(fld));
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ void subsetSurfaceFields
|
||||
|
||||
Info<< "Subsetting field " << fieldName << endl;
|
||||
|
||||
GeometricField<Type, fvsPatchField, surfaceMesh> volField
|
||||
GeometricField<Type, fvsPatchField, surfaceMesh> fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -107,7 +107,42 @@ void subsetSurfaceFields
|
||||
baseMesh
|
||||
);
|
||||
|
||||
subFields.set(i, subsetter.interpolate(volField));
|
||||
subFields.set(i, subsetter.interpolate(fld));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void subsetPointFields
|
||||
(
|
||||
const fvMeshSubset& subsetter,
|
||||
const pointMesh& pMesh,
|
||||
const wordList& fieldNames,
|
||||
PtrList<GeometricField<Type, pointPatchField, pointMesh> >& subFields
|
||||
)
|
||||
{
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
forAll(fieldNames, i)
|
||||
{
|
||||
const word& fieldName = fieldNames[i];
|
||||
|
||||
Info<< "Subsetting field " << fieldName << endl;
|
||||
|
||||
GeometricField<Type, pointPatchField, pointMesh> fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
baseMesh.time().timeName(),
|
||||
baseMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
pMesh
|
||||
);
|
||||
|
||||
subFields.set(i, subsetter.interpolate(fld));
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +198,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
// Read vol fields and subset.
|
||||
|
||||
// Read vol fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
wordList scalarNames(objects.names(volScalarField::typeName));
|
||||
PtrList<volScalarField> scalarFlds(scalarNames.size());
|
||||
@ -191,7 +228,9 @@ int main(int argc, char *argv[])
|
||||
PtrList<volTensorField> tensorFlds(tensorNames.size());
|
||||
subsetVolFields(subsetter, tensorNames, tensorFlds);
|
||||
|
||||
// Read surface fields and subset.
|
||||
|
||||
// Read surface fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
wordList surfScalarNames(objects.names(surfaceScalarField::typeName));
|
||||
PtrList<surfaceScalarField> surfScalarFlds(surfScalarNames.size());
|
||||
@ -231,6 +270,59 @@ int main(int argc, char *argv[])
|
||||
subsetSurfaceFields(subsetter, surfTensorNames, surfTensorFlds);
|
||||
|
||||
|
||||
// Read point fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
pointMesh pMesh(mesh);
|
||||
|
||||
wordList pointScalarNames(objects.names(pointScalarField::typeName));
|
||||
PtrList<pointScalarField> pointScalarFlds(pointScalarNames.size());
|
||||
subsetPointFields(subsetter, pMesh, pointScalarNames, pointScalarFlds);
|
||||
|
||||
wordList pointVectorNames(objects.names(pointVectorField::typeName));
|
||||
PtrList<pointVectorField> pointVectorFlds(pointVectorNames.size());
|
||||
subsetPointFields(subsetter, pMesh, pointVectorNames, pointVectorFlds);
|
||||
|
||||
wordList pointSphericalTensorNames
|
||||
(
|
||||
objects.names(pointSphericalTensorField::typeName)
|
||||
);
|
||||
PtrList<pointSphericalTensorField> pointSphericalTensorFlds
|
||||
(
|
||||
pointSphericalTensorNames.size()
|
||||
);
|
||||
subsetPointFields
|
||||
(
|
||||
subsetter,
|
||||
pMesh,
|
||||
pointSphericalTensorNames,
|
||||
pointSphericalTensorFlds
|
||||
);
|
||||
|
||||
wordList pointSymmTensorNames
|
||||
(
|
||||
objects.names(pointSymmTensorField::typeName)
|
||||
);
|
||||
PtrList<pointSymmTensorField> pointSymmTensorFlds
|
||||
(
|
||||
pointSymmTensorNames.size()
|
||||
);
|
||||
subsetPointFields
|
||||
(
|
||||
subsetter,
|
||||
pMesh,
|
||||
pointSymmTensorNames,
|
||||
pointSymmTensorFlds
|
||||
);
|
||||
|
||||
wordList pointTensorNames(objects.names(pointTensorField::typeName));
|
||||
PtrList<pointTensorField> pointTensorFlds(pointTensorNames.size());
|
||||
subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds);
|
||||
|
||||
|
||||
|
||||
// Write mesh and fields to new time
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
runTime++;
|
||||
|
||||
@ -252,6 +344,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
vectorFlds[i].write();
|
||||
}
|
||||
forAll(sphericalTensorFlds, i)
|
||||
{
|
||||
sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
|
||||
|
||||
sphericalTensorFlds[i].write();
|
||||
}
|
||||
forAll(symmTensorFlds, i)
|
||||
{
|
||||
symmTensorFlds[i].rename(symmTensorNames[i]);
|
||||
|
||||
symmTensorFlds[i].write();
|
||||
}
|
||||
forAll(tensorFlds, i)
|
||||
{
|
||||
tensorFlds[i].rename(tensorNames[i]);
|
||||
@ -272,6 +376,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
surfVectorFlds[i].write();
|
||||
}
|
||||
forAll(surfSphericalTensorFlds, i)
|
||||
{
|
||||
surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
|
||||
|
||||
surfSphericalTensorFlds[i].write();
|
||||
}
|
||||
forAll(surfSymmTensorFlds, i)
|
||||
{
|
||||
surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
|
||||
|
||||
surfSymmTensorFlds[i].write();
|
||||
}
|
||||
forAll(surfTensorNames, i)
|
||||
{
|
||||
surfTensorFlds[i].rename(surfTensorNames[i]);
|
||||
@ -279,6 +395,39 @@ int main(int argc, char *argv[])
|
||||
surfTensorFlds[i].write();
|
||||
}
|
||||
|
||||
// Point ones
|
||||
forAll(pointScalarFlds, i)
|
||||
{
|
||||
pointScalarFlds[i].rename(pointScalarNames[i]);
|
||||
|
||||
pointScalarFlds[i].write();
|
||||
}
|
||||
forAll(pointVectorFlds, i)
|
||||
{
|
||||
pointVectorFlds[i].rename(pointVectorNames[i]);
|
||||
|
||||
pointVectorFlds[i].write();
|
||||
}
|
||||
forAll(pointSphericalTensorFlds, i)
|
||||
{
|
||||
pointSphericalTensorFlds[i].rename(pointSphericalTensorNames[i]);
|
||||
|
||||
pointSphericalTensorFlds[i].write();
|
||||
}
|
||||
forAll(pointSymmTensorFlds, i)
|
||||
{
|
||||
pointSymmTensorFlds[i].rename(pointSymmTensorNames[i]);
|
||||
|
||||
pointSymmTensorFlds[i].write();
|
||||
}
|
||||
forAll(pointTensorNames, i)
|
||||
{
|
||||
pointTensorFlds[i].rename(pointTensorNames[i]);
|
||||
|
||||
pointTensorFlds[i].write();
|
||||
}
|
||||
|
||||
|
||||
Info << nl << "End" << endl;
|
||||
|
||||
return 0;
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
(cd decompositionMethods; ./Allwmake)
|
||||
wmake decomposePar
|
||||
wmake reconstructPar
|
||||
wmake reconstructParMesh
|
||||
wmake redistributeMeshPar
|
@ -1,5 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I../decompositionMethods/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/decompositionAgglomeration/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
||||
|
||||
|
@ -21,6 +21,9 @@ FoamFile
|
||||
|
||||
numberOfSubdomains 4;
|
||||
|
||||
//preservePatches (inlet);
|
||||
//preserveFaceZones (heater solid1 solid3);
|
||||
|
||||
method simple;
|
||||
//method hierarchical;
|
||||
//method metis;
|
||||
@ -39,6 +42,17 @@ hierarchicalCoeffs
|
||||
order xyz;
|
||||
}
|
||||
|
||||
metisCoeffs
|
||||
{
|
||||
//processorWeights
|
||||
//(
|
||||
// 1
|
||||
// 1
|
||||
// 1
|
||||
// 1
|
||||
//);
|
||||
}
|
||||
|
||||
manualCoeffs
|
||||
{
|
||||
dataFile "decompositionData";
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
wmake libso metis-5.0pre2/GKlib
|
||||
wmake libso metis-5.0pre2/libmetis
|
||||
|
||||
wmake libso decompositionMethods
|
||||
(cd parMetisDecomp; ./Allwmake)
|
@ -1,155 +0,0 @@
|
||||
|
||||
|
||||
METIS 4.0.2, 3/10/04
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed a problem with weighted graphs and ometis.c
|
||||
|
||||
|
||||
METIS 4.0.1, 11/29/98
|
||||
------------------------------------------------------------------------------
|
||||
This is mostly a bug-fix release
|
||||
|
||||
- Fixed some bugs in the multi-constraint partitioning routines
|
||||
- Fixed some bugs in the volume-minimization routines
|
||||
|
||||
|
||||
|
||||
METIS 4.0.0, 9/20/98
|
||||
------------------------------------------------------------------------------
|
||||
METIS 4.0 contains a number of changes over the previous major release (ver
|
||||
3.0.x). Most of these changes are concentrated on the graph and mesh
|
||||
partitioning routines and they do not affect the sparse matrix re-ordering
|
||||
routines. Here is a list of the major changes:
|
||||
|
||||
Multi-Constraint Partitioning
|
||||
-----------------------------
|
||||
METIS now includes partitioning routines that can be used to a partition
|
||||
a graph in the presence of multiple balancing constraints.
|
||||
|
||||
Minimizing the Total Communication Volume
|
||||
-----------------------------------------
|
||||
METIS now includes partitioning routines whose objective is to minimize
|
||||
the total communication volume (as opposed to minimizing the edge-cut).
|
||||
|
||||
Minimizing the Maximum Connectivity of the Subdomains
|
||||
-----------------------------------------------------
|
||||
The k-way partitioning routines in METIS can now directly minimize the number
|
||||
of adjacent subdomains. For most graphs corresponding to finite element
|
||||
meshes, METIS is able to significantly reduce the maximum (and total) number of
|
||||
adjacent subdomains.
|
||||
|
||||
|
||||
|
||||
|
||||
METIS 3.0.6, 1/28/98
|
||||
-------------------------------------------------------------------------------
|
||||
- Fixed some problems when too many partitions were asked, and each partition
|
||||
end up having 0 vertices
|
||||
- Fixed some bugs in the I/O routines
|
||||
- Added support for the g77 compiler under Linux
|
||||
|
||||
|
||||
METIS 3.0.5, 12/22/97
|
||||
-------------------------------------------------------------------------------
|
||||
- Fixed problems on 64-bit architectures (eg., -64 option on SGIs).
|
||||
- Added some options in Makefile.in
|
||||
|
||||
|
||||
METIS 3.0.4, 12/1/97
|
||||
-------------------------------------------------------------------------------
|
||||
Fixed a memory leak in the ordering code.
|
||||
|
||||
|
||||
METIS 3.0.3, 11/5/97
|
||||
-------------------------------------------------------------------------------
|
||||
This is mostly a bug-fix release with just a few additions
|
||||
|
||||
Added functionality
|
||||
- Added support for quadrilateral elements.
|
||||
- Added a routine METIS_EstimateMemory that estimates the amount of
|
||||
memory that will be allocated by METIS. This is useful in determining
|
||||
if a problem can run on your system.
|
||||
- Added hooks to allow PARMETIS to use the orderings produced by METIS.
|
||||
This is hidden from the user but it will be used in the next release
|
||||
of PARMETIS.
|
||||
|
||||
Bug-fixes
|
||||
- Fixed a bug related to memory allocation. This should somewhat reduce the
|
||||
overall memory used by METIS.
|
||||
- Fixed some bugs in the 'graphchk' program in the case of weighted graphs.
|
||||
- Removed some code corresponding to unused options.
|
||||
- Fixed some minor bugs in the node-refinement code
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
METIS 3.0 contains a number of changes over METIS 2.0.
|
||||
The major changes are the following:
|
||||
|
||||
General Changes
|
||||
---------------
|
||||
1. Added code to directly partition finite element meshes.
|
||||
|
||||
2. Added code to convert finite element meshes into graphs so they
|
||||
can be used by METIS.
|
||||
|
||||
1. The names, calling sequences, and options of the routines in
|
||||
METISlib have been changed.
|
||||
|
||||
2. Better support has been added for Fortran programs.
|
||||
|
||||
3. Eliminated the 'metis' program. The only way to tune METIS's
|
||||
behavior is to use METISlib.
|
||||
|
||||
4. Improved memory management. METIS should now only abort if truly
|
||||
there is no more memory left in the system.
|
||||
|
||||
|
||||
Graph Partitioning
|
||||
------------------
|
||||
1. Added partitioning routines that can be used to compute a partition
|
||||
with prescribed partition weights. For example, they can be used to
|
||||
compute a 3-way partition such that partition 1 has 50% of the weight,
|
||||
partition 2 has 20% of the way, and partition 3 has 30% of the weight.
|
||||
|
||||
2. Improved the speed of the k-way partitioning algorithm (kmetis). The
|
||||
new code has better cache locality which dramatically improves the
|
||||
speed for large graphs. A factor of 4 speedup can be obtained for
|
||||
certain graphs. METIS can now partition a 4 million node graph
|
||||
in well under a minute on a MIPS R10000.
|
||||
|
||||
3. Eliminated some of the options that were seldom used.
|
||||
|
||||
|
||||
Fill-Reducing Orderings
|
||||
----------------------
|
||||
1. Added a node based ordering code `onmetis' that greatly improves
|
||||
ordering quality.
|
||||
|
||||
2. Improved the quality of the orderings produced by the original
|
||||
edge-based ordering code (it is now called 'oemetis').
|
||||
|
||||
3. METIS can now analyze the graph and try to compress together
|
||||
nodes with identical sparsity pattern. For some problems, this
|
||||
significantly reduces ordering time
|
||||
|
||||
4. METIS can now prune dense columns prior to ordering. This can be
|
||||
helpful for LP matrices.
|
||||
|
||||
|
||||
Mesh Partitioning
|
||||
-----------------
|
||||
1. METIS can now directly partition the element node array of finite
|
||||
element meshes. It produces two partitioning vectors. One for the
|
||||
elements and one for the nodes. METIS supports the following
|
||||
elements: triangles, tetrahedra, hexahedra
|
||||
|
||||
|
||||
Mesh-To-Graph Conversion Routines
|
||||
---------------------------------
|
||||
1. METIS now includes a number of mesh conversion functions that can
|
||||
be used to create the dual and nodal graphs directly from the
|
||||
element connectivity arrays. These are highly optimized routines.
|
||||
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
|
||||
metis-5.0pre2
|
||||
------------------------------------------------------------------------
|
||||
r1437 | karypis | 2007-04-07 23:16:16 -0500 (Sat, 07 Apr 2007) | 3 lines
|
||||
|
||||
- Added installation instructions and change-logs.
|
||||
- Tested 32bit & 64bit on 64bit architectures and passed tests.
|
||||
- Tested 32bit on 32bit architectures and passed tests.
|
||||
- strtoidx() addition for portable input file parsing
|
||||
- Restructured the internal memory allocation schemes for graph and
|
||||
refinement data. This should enhance portability and make the code
|
||||
easier to maintain.
|
||||
- Fixed some bad memory allocation calls (i.e., sizeof(x)/sizeof(idxtype).
|
||||
However, there are tons of those and need to be corrected once and for
|
||||
all by eliminating workspace and the associated mallocs.
|
||||
- Added mprint/mscanf family of functions for portable formated I/O
|
||||
of the idxtype datatype. The specifier for this datatype is %D.
|
||||
All library routines use this function for printing.
|
||||
The implementation of these routines is not very efficient, but
|
||||
that should do for now (in principle these routines should not be
|
||||
used unless debugging).
|
||||
- Incorporated GKlib into METIS, which replaced many of its internal
|
||||
functions. GKlib's malloc interface will enable graceful and clean
|
||||
aborts (i.e., free all internally allocated memory) on fatal errors.
|
||||
This will probably be available in the next pre-release.
|
||||
- Fixed the problems associated with metis.h that were identified by
|
||||
David (flyspray Issue #9).
|
||||
|
@ -1,21 +0,0 @@
|
||||
trunk/b64.c
|
||||
trunk/blas.c
|
||||
trunk/dfkvkselect.c
|
||||
trunk/dlmalloc.c
|
||||
trunk/error.c
|
||||
trunk/fs.c
|
||||
trunk/getopt.c
|
||||
trunk/htable.c
|
||||
trunk/io.c
|
||||
trunk/memory.c
|
||||
trunk/omp.c
|
||||
trunk/pdb.c
|
||||
trunk/pqueue.c
|
||||
trunk/seq.c
|
||||
trunk/sort.c
|
||||
trunk/string.c
|
||||
trunk/timers.c
|
||||
trunk/tokenizer.c
|
||||
trunk/util.c
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libGKlib
|
@ -1 +0,0 @@
|
||||
/*EXE_INC = -Wno-unused-variables*/
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* GKlib.h
|
||||
*
|
||||
* George's library of most frequently used routines
|
||||
*
|
||||
* $Id: GKlib.h 1430 2007-04-07 17:53:07Z karypis $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GKLIB_H_
|
||||
#define _GKLIB_H_ 1
|
||||
|
||||
#define GKMSPACE
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define __MSC__
|
||||
#endif
|
||||
#if defined(__ICC)
|
||||
#define __ICC__
|
||||
#endif
|
||||
|
||||
|
||||
#include <gk_arch.h> /*!< This should be here, prior to the includes */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Header file inclusion section
|
||||
**************************************************************************/
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(__WITHPCRE__)
|
||||
#include <pcreposix.h>
|
||||
#else
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__OPENMP__)
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gk_dlmalloc.h>
|
||||
#include <gk_types.h>
|
||||
#include <gk_struct.h>
|
||||
#include <gk_externs.h>
|
||||
#include <gk_defs.h>
|
||||
#include <gk_macros.h>
|
||||
#include <gk_getopt.h>
|
||||
|
||||
#include <gk_sort.h>
|
||||
#include <gk_blas.h>
|
||||
#include <gk_memory.h>
|
||||
|
||||
#include <gk_proto.h>
|
||||
|
||||
#endif /* GKlib.h */
|
||||
|
||||
|
@ -1,212 +0,0 @@
|
||||
#*************************************************************************
|
||||
# Global flags
|
||||
#*************************************************************************
|
||||
gdb = yes
|
||||
debug = no
|
||||
memdbg = no
|
||||
openmp = no
|
||||
pcre = no
|
||||
x86compiler = gcc
|
||||
|
||||
|
||||
|
||||
#*************************************************************************
|
||||
# System-specific compilation flags
|
||||
#*************************************************************************
|
||||
# Get some basic information about the system that you are working on
|
||||
cputype = $(shell uname -m | sed "s/\\ /_/g")
|
||||
systype = $(shell uname)
|
||||
ifeq ($(findstring CYGWIN, $(systype)),CYGWIN)
|
||||
systype = MSWIN
|
||||
# systype = CYGWIN
|
||||
cputype = x86
|
||||
endif
|
||||
|
||||
|
||||
|
||||
ifeq ($(systype),MSWIN)
|
||||
#-------------------------------------------------------------------
|
||||
# These defs are very much Visual Studio Specific
|
||||
#-------------------------------------------------------------------
|
||||
#Compiler information
|
||||
CC = cl
|
||||
OPTFLAGS = /Ox
|
||||
COPTIONS = -DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS =
|
||||
LD = /cygdrive/c/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/BIN/link
|
||||
|
||||
#Library creation information
|
||||
AR = lib /NODEFAULTLIB:LIBC /OUT:$@
|
||||
RANLIB =
|
||||
|
||||
ifeq ($(openmp),yes)
|
||||
COPTIONS += -D__OPENMP__ /openmp
|
||||
LDOPTIONS += /openmp
|
||||
endif
|
||||
|
||||
#Compile input/output file specification
|
||||
SOURCEFILE = /c $<
|
||||
OUTPUTFILE = /Fo$@
|
||||
|
||||
# Standard file extensions
|
||||
OBJEXT = .obj
|
||||
LIBEXT = .lib
|
||||
EXEEXT = .exe
|
||||
else
|
||||
ifeq ($(systype),Linux)
|
||||
ifeq ($(x86compiler),gcc)
|
||||
#Compiler information
|
||||
CC = gcc
|
||||
OPTFLAGS = -O6
|
||||
COPTIONS = -DLINUX -D_FILE_OFFSET_BITS=64 -Wall -std=c99 -pedantic
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS =
|
||||
LD = gcc
|
||||
else
|
||||
#Compiler information
|
||||
CC = icc
|
||||
OPTFLAGS = -O3
|
||||
COPTIONS = -DLINUX -D_FILE_OFFSET_BITS=64 -std=c99
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS =
|
||||
LD = icc
|
||||
|
||||
ifeq ($(openmp),yes)
|
||||
COPTIONS += -D__OPENMP__ -openmp -openmp-report2
|
||||
LDOPTIONS += -openmp
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(systype),Darwin)
|
||||
#Compiler information
|
||||
CC = gcc
|
||||
OPTFLAGS = -O6
|
||||
COPTIONS = -DDARWIN -D_FILE_OFFSET_BITS=64 -Wall -std=c99 -pedantic
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS =
|
||||
LD = gcc
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS =
|
||||
LD = gcc
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(systype),SunOS)
|
||||
#Compiler information
|
||||
CC = /opt/SUNWspro/bin/cc
|
||||
OPTFLAGS = -xO4
|
||||
COPTIONS = -DSUNOS
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS =
|
||||
LD = /opt/SUNWspro/bin/cc
|
||||
endif
|
||||
|
||||
ifeq ($(systype),CYGWIN)
|
||||
#Compiler information
|
||||
CC = gcc
|
||||
OPTFLAGS = -O6
|
||||
COPTIONS = -DCYGWIN -DWIN32 -D_FILE_OFFSET_BITS=64 -Wall -std=c99 -pedantic -mno-cygwin
|
||||
|
||||
#Linker information
|
||||
LDOPTIONS = -mno-cygwin
|
||||
LD = gcc
|
||||
endif
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# These defs are common among the GNU/GCC based systems
|
||||
#-------------------------------------------------------------------
|
||||
#Library creation information
|
||||
AR = ar crv $@
|
||||
RANLIB = ar -ts $@
|
||||
|
||||
#Compile input/output file specification
|
||||
SOURCEFILE = -c $<
|
||||
OUTPUTFILE = -o $@
|
||||
|
||||
# Standard file extensions
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
endif
|
||||
|
||||
|
||||
#**************************************************************************
|
||||
DMALLOCINC =
|
||||
DMALLOCFLAGS =
|
||||
DEBUGFLAGS =
|
||||
XTRAFLAGS =
|
||||
|
||||
ifeq ($(dmalloc),yes)
|
||||
DMALLOCINC = -I$(HOME)/local/include
|
||||
DMALLOCFLAGS = -DDMALLOC
|
||||
OPTFLAGS = -g
|
||||
endif
|
||||
|
||||
ifeq ($(debug),yes)
|
||||
DEBUGFLAGS = -DDEBUG
|
||||
OPTFLAGS = -g
|
||||
endif
|
||||
|
||||
ifeq ($(gdb),yes)
|
||||
OPTFLAGS += -g
|
||||
endif
|
||||
|
||||
ifeq ($(pcre),yes)
|
||||
XTRAFLAGS += -D__WITHPCRE__
|
||||
endif
|
||||
#**************************************************************************
|
||||
|
||||
|
||||
|
||||
#**************************************************************************
|
||||
INCLUDES = -I./ $(INCDIR) $(DMALLOCINC)
|
||||
CFLAGS = $(COPTIONS) $(OPTFLAGS) $(XTRAFLAGS) $(DMALLOCFLAGS) $(DEBUGFLAGS) $(INCLUDES)
|
||||
#**************************************************************************
|
||||
|
||||
|
||||
#**************************************************************************
|
||||
# Create the build directory if it does not exist
|
||||
#**************************************************************************
|
||||
BUILDDIR = ../builds/$(systype)-$(cputype)
|
||||
$(shell mkdir -p $(BUILDDIR))
|
||||
|
||||
OBJS = $(patsubst %.c, $(BUILDDIR)/%$(OBJEXT), $(wildcard *.c))
|
||||
HEADERS = $(wildcard *.h) Makefile
|
||||
|
||||
|
||||
$(BUILDDIR)/libGKlib$(LIBEXT): $(OBJS)
|
||||
$(AR) $(OBJS)
|
||||
$(RANLIB)
|
||||
|
||||
doc:
|
||||
doxygen ../doxygen/Doxyfile
|
||||
|
||||
pubdoc:
|
||||
doxygen ../doxygen/Doxyfile
|
||||
scp -r ../doxygen/html/* dminers.dtc.umn.edu:/var/www/wwwroot/dminers/files/doxy/GKlib
|
||||
ssh dminers.dtc.umn.edu "chmod -R a+rX /var/www/wwwroot/dminers/files/doxy/GKlib"
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
realclean:
|
||||
rm -f $(OBJS) ; rm -f $(BUILDDIR)/libGKlib$(LIBEXT)
|
||||
|
||||
|
||||
$(OBJS) : $(HEADERS) Makefile
|
||||
|
||||
|
||||
$(BUILDDIR)/%$(OBJEXT) : %.c
|
||||
$(CC) $(CFLAGS) $(SOURCEFILE) $(OUTPUTFILE)
|
||||
|
||||
|
@ -1,90 +0,0 @@
|
||||
/*!
|
||||
\file b64.c
|
||||
\brief This file contains some simple 8bit-to-6bit encoding/deconding routines
|
||||
|
||||
Most of these routines are outdated and should be converted using glibc's equivalent
|
||||
routines.
|
||||
|
||||
\date Started 2/22/05
|
||||
\author George
|
||||
\version\verbatim $Id: b64.c 1421 2007-04-06 14:37:41Z karypis $ \endverbatim
|
||||
*/
|
||||
|
||||
|
||||
#include <GKlib.h>
|
||||
|
||||
#define B64OFFSET 48 /* This is the '0' number */
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Encode 3 '8-bit' binary bytes as 4 '6-bit' characters
|
||||
*******************************************************************************/
|
||||
void encodeblock(unsigned char *in, unsigned char *out)
|
||||
{
|
||||
out[0] = (in[0] >> 2);
|
||||
out[1] = (((in[0] & 0x03) << 4) | (in[1] >> 4));
|
||||
out[2] = (((in[1] & 0x0f) << 2) | (in[2] >> 6));
|
||||
out[3] = (in[2] & 0x3f);
|
||||
|
||||
out[0] += B64OFFSET;
|
||||
out[1] += B64OFFSET;
|
||||
out[2] += B64OFFSET;
|
||||
out[3] += B64OFFSET;
|
||||
|
||||
// printf("%c %c %c %c %2x %2x %2x %2x %2x %2x %2x\n", out[0], out[1], out[2], out[3], out[0], out[1], out[2], out[3], in[0], in[1], in[2]);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Decode 4 '6-bit' characters into 3 '8-bit' binary bytes
|
||||
*******************************************************************************/
|
||||
void decodeblock(unsigned char *in, unsigned char *out)
|
||||
{
|
||||
in[0] -= B64OFFSET;
|
||||
in[1] -= B64OFFSET;
|
||||
in[2] -= B64OFFSET;
|
||||
in[3] -= B64OFFSET;
|
||||
|
||||
out[0] = (in[0] << 2 | in[1] >> 4);
|
||||
out[1] = (in[1] << 4 | in[2] >> 2);
|
||||
out[2] = (in[2] << 6 | in[3]);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* This function encodes an input array of bytes into a base64 encoding. Memory
|
||||
* for the output array is assumed to have been allocated by the calling program
|
||||
* and be sufficiently large. The output string is NULL terminated.
|
||||
*******************************************************************************/
|
||||
void GKEncodeBase64(int nbytes, unsigned char *inbuffer, unsigned char *outbuffer)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (nbytes%3 != 0)
|
||||
gk_errexit(SIGERR, "GKEncodeBase64: Input buffer size should be a multiple of 3! (%d)\n", nbytes);
|
||||
|
||||
for (j=0, i=0; i<nbytes; i+=3, j+=4)
|
||||
encodeblock(inbuffer+i, outbuffer+j);
|
||||
|
||||
//printf("%d %d\n", nbytes, j);
|
||||
outbuffer[j] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* This function decodes an input array of base64 characters into their actual
|
||||
* 8-bit codes. Memory * for the output array is assumed to have been allocated
|
||||
* by the calling program and be sufficiently large. The padding is discarded.
|
||||
*******************************************************************************/
|
||||
void GKDecodeBase64(int nbytes, unsigned char *inbuffer, unsigned char *outbuffer)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (nbytes%4 != 0)
|
||||
gk_errexit(SIGERR, "GKDecodeBase64: Input buffer size should be a multiple of 4! (%d)\n", nbytes);
|
||||
|
||||
for (j=0, i=0; i<nbytes; i+=4, j+=3)
|
||||
decodeblock(inbuffer+i, outbuffer+j);
|
||||
}
|
||||
|
@ -1,129 +0,0 @@
|
||||
/*!
|
||||
\file blas.c
|
||||
\brief This file contains GKlib's implementation of BLAS-like routines
|
||||
|
||||
The BLAS routines that are currently implemented are mostly level-one.
|
||||
They follow a naming convention of the type gk_[type][name], where
|
||||
[type] is one of c, i, f, and d, based on C's four standard scalar
|
||||
datatypes of characters, integers, floats, and doubles.
|
||||
|
||||
These routines are implemented using a generic macro template,
|
||||
which is used for code generation.
|
||||
|
||||
\date Started 9/28/95
|
||||
\author George
|
||||
\version\verbatim $Id: blas.c 1421 2007-04-06 14:37:41Z karypis $ \endverbatim
|
||||
*/
|
||||
|
||||
#include <GKlib.h>
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Set the elements of an array to a specified value */
|
||||
/*************************************************************************/
|
||||
GK_SET(gk_cset, char)
|
||||
GK_SET(gk_iset, int)
|
||||
GK_SET(gk_fset, float)
|
||||
GK_SET(gk_dset, double)
|
||||
GK_SET(gk_idxset, gk_idx_t)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Set the elements of an array in increasing order */
|
||||
/*************************************************************************/
|
||||
GK_INCSET(gk_cincset, char)
|
||||
GK_INCSET(gk_iincset, int)
|
||||
GK_INCSET(gk_fincset, float)
|
||||
GK_INCSET(gk_dincset, double)
|
||||
GK_INCSET(gk_idxincset, gk_idx_t)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Return the index of the maximum element in a vector */
|
||||
/*************************************************************************/
|
||||
GK_ARGMAX(gk_cargmax, char)
|
||||
GK_ARGMAX(gk_iargmax, int)
|
||||
GK_ARGMAX(gk_fargmax, float)
|
||||
GK_ARGMAX(gk_dargmax, double)
|
||||
GK_ARGMAX(gk_idxargmax, gk_idx_t)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Return the index of the minimum element in a vector */
|
||||
/*************************************************************************/
|
||||
GK_ARGMIN(gk_cargmin, char)
|
||||
GK_ARGMIN(gk_iargmin, int)
|
||||
GK_ARGMIN(gk_fargmin, float)
|
||||
GK_ARGMIN(gk_dargmin, double)
|
||||
GK_ARGMIN(gk_idxargmin, gk_idx_t)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Return the index of the Kth largest element in a vector */
|
||||
/*************************************************************************/
|
||||
GK_ARGMAX_N(gk_cargmax_n, char, gk_ckv_t, gk_ckvmalloc, gk_dckvsort)
|
||||
GK_ARGMAX_N(gk_iargmax_n, int, gk_ikv_t, gk_ikvmalloc, gk_dikvsort)
|
||||
GK_ARGMAX_N(gk_fargmax_n, float, gk_fkv_t, gk_fkvmalloc, gk_dfkvsort)
|
||||
GK_ARGMAX_N(gk_dargmax_n, double, gk_dkv_t, gk_dkvmalloc, gk_ddkvsort)
|
||||
GK_ARGMAX_N(gk_idxargmax_n, gk_idx_t, gk_idxkv_t, gk_idxkvmalloc, gk_didxkvsort)
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Sums the entries of an array */
|
||||
/*************************************************************************/
|
||||
GK_SUM(gk_csum, char, intmax_t)
|
||||
GK_SUM(gk_isum, int, intmax_t)
|
||||
GK_SUM(gk_fsum, float, float)
|
||||
GK_SUM(gk_dsum, double, double)
|
||||
GK_SUM(gk_idxsum, gk_idx_t, intmax_t)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Scales the elements of a vector by a constant */
|
||||
/*************************************************************************/
|
||||
GK_SCALE(gk_cscale, char)
|
||||
GK_SCALE(gk_iscale, int)
|
||||
GK_SCALE(gk_fscale, float)
|
||||
GK_SCALE(gk_dscale, double)
|
||||
GK_SCALE(gk_idxscale, gk_idx_t)
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Computes the 2-norm of a vector */
|
||||
/*************************************************************************/
|
||||
GK_NORM2(gk_cnorm2, char, intmax_t)
|
||||
GK_NORM2(gk_inorm2, int, intmax_t)
|
||||
GK_NORM2(gk_fnorm2, float, float)
|
||||
GK_NORM2(gk_dnorm2, double, double)
|
||||
GK_NORM2(gk_idxnorm2, gk_idx_t, intmax_t)
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Computes the dot-product of two vectors */
|
||||
/*************************************************************************/
|
||||
GK_DOT(gk_cdot, char, intmax_t)
|
||||
GK_DOT(gk_idot, int, intmax_t)
|
||||
GK_DOT(gk_fdot, float, float)
|
||||
GK_DOT(gk_ddot, double, double)
|
||||
GK_DOT(gk_idxdot, gk_idx_t, intmax_t)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*! Computes y = ax+y */
|
||||
/*************************************************************************/
|
||||
GK_AXPY(gk_caxpy, char)
|
||||
GK_AXPY(gk_iaxpy, int)
|
||||
GK_AXPY(gk_faxpy, float)
|
||||
GK_AXPY(gk_daxpy, double)
|
||||
GK_AXPY(gk_idxaxpy, gk_idx_t)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user