Merge branch 'master' of develop.openfoam.com:Development/OpenFOAM-plus
This commit is contained in:
commit
466a2631c7
@ -30,7 +30,8 @@ writeInterval #codeStream
|
|||||||
|
|
||||||
codeOptions
|
codeOptions
|
||||||
#{
|
#{
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
#};
|
#};
|
||||||
|
|
||||||
localCode
|
localCode
|
||||||
|
3
applications/test/cstring/Make/files
Normal file
3
applications/test/cstring/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-cstring.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-cstring
|
2
applications/test/cstring/Make/options
Normal file
2
applications/test/cstring/Make/options
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
|
||||||
|
/* EXE_LIBS = -lfiniteVolume */
|
99
applications/test/cstring/Test-cstring.C
Normal file
99
applications/test/cstring/Test-cstring.C
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Test some string functionality
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "CStringList.H"
|
||||||
|
#include "DynamicList.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "fileNameList.H"
|
||||||
|
#include "stringList.H"
|
||||||
|
#include "wordList.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int print(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
Info<< "argc=" << argc << endl;
|
||||||
|
for (int i=0; i<argc; ++i)
|
||||||
|
{
|
||||||
|
Info<< " argv[" << i << "] = \"" << argv[i] << "\"" << endl;
|
||||||
|
}
|
||||||
|
return argc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int print(const CStringList& cstrLst)
|
||||||
|
{
|
||||||
|
return print(cstrLst.size(), cstrLst.strings());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DynamicList<string> dynlst;
|
||||||
|
dynlst.reserve(16);
|
||||||
|
|
||||||
|
dynlst.append("string1 with content");
|
||||||
|
dynlst.append("string2 other content");
|
||||||
|
dynlst.append("string3 done");
|
||||||
|
|
||||||
|
{
|
||||||
|
CStringList inC(dynlst);
|
||||||
|
|
||||||
|
Info<< "input: " << dynlst << endl;
|
||||||
|
print(inC);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<<"command-line with " << CStringList::count(argv) << " items"<< endl;
|
||||||
|
|
||||||
|
print(argc, argv);
|
||||||
|
{
|
||||||
|
dynlst.clear();
|
||||||
|
for (int i=0; i<argc; ++i)
|
||||||
|
{
|
||||||
|
dynlst.append(argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "input: " << dynlst << endl;
|
||||||
|
CStringList inC(dynlst);
|
||||||
|
inC.reset(dynlst);
|
||||||
|
|
||||||
|
print(inC);
|
||||||
|
Info<< "length: " << inC.length() << endl;
|
||||||
|
std::cout.write(inC.data(), inC.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,6 +34,7 @@ Description
|
|||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
#include "POSIX.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -99,6 +100,98 @@ int main()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Test some copying and deletion
|
||||||
|
{
|
||||||
|
const fileName dirA("dirA");
|
||||||
|
const fileName lnA("lnA");
|
||||||
|
const fileName lnB("lnB");
|
||||||
|
const fileName dirB("dirB");
|
||||||
|
|
||||||
|
Foam::rmDir(dirA);
|
||||||
|
Foam::rm(lnA);
|
||||||
|
Foam::rm(lnB);
|
||||||
|
Foam::rmDir(dirB);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Creating directory " << dirA << endl;
|
||||||
|
Foam::mkDir(dirA);
|
||||||
|
|
||||||
|
|
||||||
|
const int oldPosix = POSIX::debug;
|
||||||
|
POSIX::debug = 1;
|
||||||
|
|
||||||
|
|
||||||
|
// Create link and test it
|
||||||
|
Info<< "Creating softlink " << lnA << endl;
|
||||||
|
Foam::ln(dirA, lnA);
|
||||||
|
|
||||||
|
fileName::Type lnAType = lnA.type(false);
|
||||||
|
|
||||||
|
if (lnAType != fileName::LINK)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Test-fileName") << "Type of softlink " << lnA
|
||||||
|
<< " should be " << fileName::LINK
|
||||||
|
<< " but is " << lnAType << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileName::Type dirAType = lnA.type(true);
|
||||||
|
|
||||||
|
if (dirAType != fileName::DIRECTORY)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Test-fileName") << "Type of what softlink " << lnA
|
||||||
|
<< " points to should be " << fileName::DIRECTORY
|
||||||
|
<< " but is " << dirAType << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy link only
|
||||||
|
{
|
||||||
|
Info<< "Copying (non-follow) softlink " << lnA << " to " << lnB
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
Foam::cp(lnA, lnB, false);
|
||||||
|
if (lnB.type(false) != fileName::LINK)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||||
|
<< " should be " << fileName::LINK
|
||||||
|
<< " but is " << lnB.type(false) << exit(FatalError);
|
||||||
|
}
|
||||||
|
if (lnB.type(true) != fileName::DIRECTORY)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||||
|
<< " should be " << fileName::DIRECTORY
|
||||||
|
<< " but is " << lnB.type(true) << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
|
Foam::rm(lnB);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy contents of link
|
||||||
|
{
|
||||||
|
Info<< "Copying (contents of) softlink " << lnA << " to " << lnB
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
Foam::cp(lnA, lnB, true);
|
||||||
|
if (lnB.type(false) != fileName::DIRECTORY)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||||
|
<< " should be " << fileName::DIRECTORY
|
||||||
|
<< " but is " << lnB.type(false) << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
|
Foam::rm(lnB);
|
||||||
|
}
|
||||||
|
|
||||||
|
POSIX::debug = oldPosix;
|
||||||
|
|
||||||
|
Foam::rmDir(dirA);
|
||||||
|
Foam::rm(lnA);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// test findEtcFile
|
// test findEtcFile
|
||||||
Info<< "\n\nfindEtcFile tests:" << nl
|
Info<< "\n\nfindEtcFile tests:" << nl
|
||||||
<< " controlDict => " << findEtcFile("controlDict") << nl
|
<< " controlDict => " << findEtcFile("controlDict") << nl
|
||||||
|
@ -151,7 +151,7 @@ void Foam::helpType::displayDoc
|
|||||||
Info<< "Source file: " << classDirectory.c_str() << classFile << nl
|
Info<< "Source file: " << classDirectory.c_str() << classFile << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
system(docBrowser);
|
Foam::system(docBrowser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -23,6 +23,8 @@ License
|
|||||||
|
|
||||||
Application
|
Application
|
||||||
foamInfoExec
|
foamInfoExec
|
||||||
|
To simplify parsing of the output, The normal banner information
|
||||||
|
is suppressed.
|
||||||
|
|
||||||
Group
|
Group
|
||||||
grpMiscUtilities
|
grpMiscUtilities
|
||||||
|
@ -1309,7 +1309,7 @@ int main(int argc, char *argv[])
|
|||||||
+ "_"
|
+ "_"
|
||||||
+ procFile.name()
|
+ procFile.name()
|
||||||
);
|
);
|
||||||
if (system(cmd.c_str()) == -1)
|
if (Foam::system(cmd.c_str()) == -1)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Could not execute command " << cmd << endl;
|
<< "Could not execute command " << cmd << endl;
|
||||||
|
@ -51,7 +51,10 @@ ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
|||||||
XML_GROUP sources
|
XML_GROUP sources
|
||||||
)
|
)
|
||||||
|
|
||||||
IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
||||||
|
# so check if version < 4.4
|
||||||
|
|
||||||
|
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
||||||
ADD_PARAVIEW_PLUGIN(
|
ADD_PARAVIEW_PLUGIN(
|
||||||
PVFoamReader_SM "1.0"
|
PVFoamReader_SM "1.0"
|
||||||
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
||||||
@ -61,7 +64,7 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
|||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||||
GUI_RESOURCE_FILES PVFoamReader.xml
|
GUI_RESOURCE_FILES PVFoamReader.xml
|
||||||
)
|
)
|
||||||
ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
ELSE()
|
||||||
ADD_PARAVIEW_PLUGIN(
|
ADD_PARAVIEW_PLUGIN(
|
||||||
PVFoamReader_SM "1.0"
|
PVFoamReader_SM "1.0"
|
||||||
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
||||||
@ -70,7 +73,7 @@ ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
|||||||
GUI_SOURCES pqPVFoamReaderPanel.cxx
|
GUI_SOURCES pqPVFoamReaderPanel.cxx
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||||
)
|
)
|
||||||
ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
ENDIF()
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
TARGET_LINK_LIBRARIES(
|
||||||
PVFoamReader_SM
|
PVFoamReader_SM
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<ParaViewReaders>
|
<ParaViewReaders>
|
||||||
|
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
||||||
<Reader name="PVFoamReader"
|
<Reader name="PVFoamReader"
|
||||||
extensions="OpenFOAM"
|
extensions="OpenFOAM"
|
||||||
file_description="OpenFOAM Reader">
|
file_description="OpenFOAM Reader">
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
/* Note: enable vtkPolyhedron when available */
|
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I../../vtkPVReaders/lnInclude \
|
|
||||||
-I../PVFoamReader \
|
|
||||||
-I$(ParaView_INCLUDE_DIR) \
|
-I$(ParaView_INCLUDE_DIR) \
|
||||||
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
||||||
$(shell \
|
-I../../vtkPVReaders/lnInclude \
|
||||||
test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
|
-I../PVFoamReader
|
||||||
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
|
|
||||||
)
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -275,7 +275,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
// Polyhedral cell - use VTK_POLYHEDRON
|
// Polyhedral cell - use VTK_POLYHEDRON
|
||||||
const labelList& cFaces = mesh.cells()[cellI];
|
const labelList& cFaces = mesh.cells()[cellI];
|
||||||
|
|
||||||
#ifdef HAS_VTK_POLYHEDRON
|
|
||||||
vtkIdType nFaces = cFaces.size();
|
vtkIdType nFaces = cFaces.size();
|
||||||
vtkIdType nLabels = nFaces;
|
vtkIdType nLabels = nFaces;
|
||||||
|
|
||||||
@ -320,33 +319,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
|
vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
|
||||||
#else
|
|
||||||
// this is a horrible substitute
|
|
||||||
// but avoids crashes when there is no vtkPolyhedron support
|
|
||||||
|
|
||||||
// establish unique node ids used
|
|
||||||
HashSet<vtkIdType, Hash<label>> hashUniqId(2*256);
|
|
||||||
|
|
||||||
forAll(cFaces, cFaceI)
|
|
||||||
{
|
|
||||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
|
||||||
|
|
||||||
forAll(f, fp)
|
|
||||||
{
|
|
||||||
hashUniqId.insert(f[fp]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// use face stream to store unique node ids:
|
|
||||||
faceStream = hashUniqId.sortedToc();
|
|
||||||
|
|
||||||
vtkmesh->InsertNextCell
|
|
||||||
(
|
|
||||||
VTK_CONVEX_POINT_SET,
|
|
||||||
vtkIdType(faceStream.size()),
|
|
||||||
faceStream.data()
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,10 @@ ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
|||||||
XML_GROUP sources
|
XML_GROUP sources
|
||||||
)
|
)
|
||||||
|
|
||||||
IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
||||||
|
# so check if version < 4.4
|
||||||
|
|
||||||
|
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
||||||
ADD_PARAVIEW_PLUGIN(
|
ADD_PARAVIEW_PLUGIN(
|
||||||
PVblockMeshReader_SM "1.0"
|
PVblockMeshReader_SM "1.0"
|
||||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
||||||
@ -60,7 +63,7 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
|||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||||
GUI_RESOURCE_FILES PVblockMeshReader.xml
|
GUI_RESOURCE_FILES PVblockMeshReader.xml
|
||||||
)
|
)
|
||||||
ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
ELSE()
|
||||||
ADD_PARAVIEW_PLUGIN(
|
ADD_PARAVIEW_PLUGIN(
|
||||||
PVblockMeshReader_SM "1.0"
|
PVblockMeshReader_SM "1.0"
|
||||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
||||||
@ -69,7 +72,7 @@ ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
|||||||
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
|
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||||
)
|
)
|
||||||
ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
ENDIF()
|
||||||
|
|
||||||
# Build the client-side plugin
|
# Build the client-side plugin
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<ParaViewReaders>
|
<ParaViewReaders>
|
||||||
|
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
||||||
<Reader name="PVblockMeshReader"
|
<Reader name="PVblockMeshReader"
|
||||||
extensions="blockMesh"
|
extensions="blockMesh"
|
||||||
file_description="OpenFOAM blockMesh reader">
|
file_description="OpenFOAM blockMesh reader">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,6 +29,8 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
List times using timeSelector.
|
List times using timeSelector.
|
||||||
|
To simplify parsing of the output, the normal banner information
|
||||||
|
is suppressed.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -191,9 +191,15 @@ void writeRays
|
|||||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
|
str.flush();
|
||||||
Pout<< "cmd:" << cmd << endl;
|
|
||||||
system(cmd);
|
DynamicList<string> cmd(3);
|
||||||
|
cmd.append("objToVTK");
|
||||||
|
cmd.append(fName);
|
||||||
|
cmd.append(fName.lessExt() + ".vtk");
|
||||||
|
|
||||||
|
Pout<< "cmd: objToVTK " << fName.c_str() << endl;
|
||||||
|
Foam::system(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,6 +29,8 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Miscellaneous information about surface meshes.
|
Miscellaneous information about surface meshes.
|
||||||
|
To simplify parsing of the output, the normal banner information
|
||||||
|
is suppressed.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
- surfaceMeshInfo surfaceFile [OPTION]
|
- surfaceMeshInfo surfaceFile [OPTION]
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# ========= |
|
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
# \\ / O peration |
|
|
||||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
# \\/ M anipulation |
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# License
|
|
||||||
# This file is part of OpenFOAM.
|
|
||||||
#
|
|
||||||
# OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
# for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# Script
|
|
||||||
# engridFoam
|
|
||||||
#
|
|
||||||
# Description
|
|
||||||
# start engrid using the paraview libraries from OpenFOAM
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
usage() {
|
|
||||||
exec 1>&2
|
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
||||||
cat<<USAGE
|
|
||||||
|
|
||||||
Usage: ${0##*/} [OPTION]
|
|
||||||
options:
|
|
||||||
-help
|
|
||||||
|
|
||||||
* start engrid using the paraview-$ParaView_MAJOR libraries
|
|
||||||
passes through engrid options unmodified
|
|
||||||
|
|
||||||
USAGE
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# report usage
|
|
||||||
[ "$1" = "-h" -o "$1" = "-help" ] && usage
|
|
||||||
|
|
||||||
bindir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/engrid
|
|
||||||
libdir="$ParaView_DIR/lib/paraview-${ParaView_MAJOR:-unknown}"
|
|
||||||
|
|
||||||
[ -x $bindir/engrid ] || usage "engrid executable not found in $bindir"
|
|
||||||
[ -d $libdir ] || usage "paraview libraries not found"
|
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
|
|
||||||
echo "starting $bindir/engrid $@"
|
|
||||||
eval "exec $bindir/engrid $@ &"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
73
bin/paraFoam
73
bin/paraFoam
@ -4,7 +4,7 @@
|
|||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM.
|
||||||
@ -40,17 +40,18 @@ usage() {
|
|||||||
Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
|
Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
|
||||||
options:
|
options:
|
||||||
-block use blockMesh reader (uses .blockMesh extension)
|
-block use blockMesh reader (uses .blockMesh extension)
|
||||||
-builtin use VTK builtin OpenFOAM reader (uses .foam extension)
|
|
||||||
-case <dir> specify alternative case directory, default is the cwd
|
-case <dir> specify alternative case directory, default is the cwd
|
||||||
-region <name> specify alternative mesh region
|
-region <name> specify alternative mesh region
|
||||||
-touch only create the file (eg, .blockMesh, .OpenFOAM, etc)
|
-touch only create the file (eg, .blockMesh, .OpenFOAM, etc)
|
||||||
-touchAll create .blockMesh, .OpenFOAM files (and for all regions)
|
-touchAll create .blockMesh, .OpenFOAM files (and for all regions)
|
||||||
|
-vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension)
|
||||||
-help print the usage
|
-help print the usage
|
||||||
|
|
||||||
|
Paraview options start with a double dashes.
|
||||||
|
|
||||||
paraview options start with a double dashes
|
* start paraview with the OpenFOAM libraries
|
||||||
|
|
||||||
* start paraview $ParaView_VERSION with the OpenFOAM libraries
|
paraview=$(command -v paraview)
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
@ -67,10 +68,9 @@ unset regionName optTouch
|
|||||||
# already 2010-07)
|
# already 2010-07)
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
# Reader extension
|
# Reader extension and plugin
|
||||||
extension=OpenFOAM
|
extension=OpenFOAM
|
||||||
|
plugin=PVFoamReader
|
||||||
requirePV=1
|
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
@ -81,11 +81,12 @@ do
|
|||||||
;;
|
;;
|
||||||
-block | -blockMesh)
|
-block | -blockMesh)
|
||||||
extension=blockMesh
|
extension=blockMesh
|
||||||
|
plugin=PVblockMeshReader
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-builtin)
|
-builtin | -vtk)
|
||||||
extension=foam
|
extension=foam
|
||||||
requirePV=0
|
unset plugin
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-case)
|
-case)
|
||||||
@ -100,12 +101,12 @@ do
|
|||||||
;;
|
;;
|
||||||
-touch)
|
-touch)
|
||||||
optTouch=true
|
optTouch=true
|
||||||
requirePV=0
|
unset plugin
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-touchAll)
|
-touchAll)
|
||||||
optTouch=all
|
optTouch=all
|
||||||
requirePV=0
|
unset plugin
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
@ -116,26 +117,34 @@ do
|
|||||||
break # Stop here, treat this and balance as paraview options
|
break # Stop here, treat this and balance as paraview options
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown option/argument: '$*'"
|
usage "unknown option/argument: '$1'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check that reader module has been built
|
# If a reader module is needed, check that it exists
|
||||||
if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPVFoamReader_SM.so ]
|
[ -z "$plugin" -o -f $PV_PLUGIN_PATH/lib${plugin}_SM.so ] || {
|
||||||
then
|
cat<< BUILDREADER 1>&2
|
||||||
cat<< BUILDREADER
|
|
||||||
|
|
||||||
FATAL ERROR: ParaView reader module libraries do not exist
|
|
||||||
|
|
||||||
|
ERROR: ParaView reader module library ($plugin) does not exist
|
||||||
Please build the reader module before continuing:
|
Please build the reader module before continuing:
|
||||||
cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
|
|
||||||
./Allwclean
|
cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
|
||||||
./Allwmake
|
./Allwclean
|
||||||
|
./Allwmake
|
||||||
|
|
||||||
BUILDREADER
|
BUILDREADER
|
||||||
|
|
||||||
|
# Fallback to native reader, if possible
|
||||||
|
if [ "$extension" = OpenFOAM ]
|
||||||
|
then
|
||||||
|
extension=foam
|
||||||
|
echo "Using the native VTK/OpenFOAM reader instead" 1>&2
|
||||||
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Check for --data=... argument
|
# Check for --data=... argument
|
||||||
hasDataArg()
|
hasDataArg()
|
||||||
@ -165,7 +174,7 @@ if [ -n "$regionName" ]
|
|||||||
then
|
then
|
||||||
if [ ! -d constant/$regionName ]
|
if [ ! -d constant/$regionName ]
|
||||||
then
|
then
|
||||||
echo "FATAL ERROR: Region $regionName does not exist"
|
echo "FATAL ERROR: Region $regionName does not exist" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
caseFile="$caseName{$regionName}.$extension"
|
caseFile="$caseName{$regionName}.$extension"
|
||||||
@ -179,10 +188,10 @@ all)
|
|||||||
if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
|
if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
|
||||||
then
|
then
|
||||||
touch "$caseName.blockMesh"
|
touch "$caseName.blockMesh"
|
||||||
echo "Created '$caseName.blockMesh'"
|
echo "Created '$caseName.blockMesh'" 1>&2
|
||||||
fi
|
fi
|
||||||
touch "$caseName.$extension"
|
touch "$caseName.$extension"
|
||||||
echo "Created '$caseName.$extension'"
|
echo "Created '$caseName.$extension'" 1>&2
|
||||||
# Discover probable regions
|
# Discover probable regions
|
||||||
for region in constant/*
|
for region in constant/*
|
||||||
do
|
do
|
||||||
@ -190,14 +199,14 @@ all)
|
|||||||
then
|
then
|
||||||
regionName=${region##*/}
|
regionName=${region##*/}
|
||||||
touch "$caseName{$regionName}.$extension"
|
touch "$caseName{$regionName}.$extension"
|
||||||
echo "Created '$caseName{$regionName}.$extension'"
|
echo "Created '$caseName{$regionName}.$extension'" 1>&2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
true)
|
true)
|
||||||
touch "$caseFile"
|
touch "$caseFile"
|
||||||
echo "Created '$caseFile'"
|
echo "Created '$caseFile'" 1>&2
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -222,14 +231,14 @@ else
|
|||||||
warn="WARN file does not exist:"
|
warn="WARN file does not exist:"
|
||||||
case $extension in
|
case $extension in
|
||||||
blockMesh)
|
blockMesh)
|
||||||
blockMeshDictDir=system/blockMeshDict
|
blockMeshDict=system/blockMeshDict
|
||||||
if [ -f constant/polyMesh/blockMeshDict ]
|
if [ -f constant/polyMesh/blockMeshDict ]
|
||||||
then
|
then
|
||||||
blockMeshDictDir=constant/polyMesh/blockMeshDict
|
blockMeshDict=constant/polyMesh/blockMeshDict
|
||||||
fi
|
fi
|
||||||
for check in \
|
for check in \
|
||||||
system/controlDict \
|
system/controlDict \
|
||||||
$blockMeshDictDir \
|
$blockMeshDict \
|
||||||
;
|
;
|
||||||
do
|
do
|
||||||
[ -s "$parentDir/$check" ] || {
|
[ -s "$parentDir/$check" ] || {
|
||||||
@ -240,7 +249,7 @@ else
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
builtin | OpenFOAM)
|
OpenFOAM)
|
||||||
for check in \
|
for check in \
|
||||||
system/controlDict \
|
system/controlDict \
|
||||||
$fvControls/fvSchemes \
|
$fvControls/fvSchemes \
|
||||||
@ -268,7 +277,7 @@ else
|
|||||||
[ -e $caseFile ] || {
|
[ -e $caseFile ] || {
|
||||||
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
||||||
touch "$caseFile"
|
touch "$caseFile"
|
||||||
echo "Created temporary '$caseFile'"
|
echo "Created temporary '$caseFile'" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# For now filter out any ld.so errors. Caused by non-system compiler?
|
# For now filter out any ld.so errors. Caused by non-system compiler?
|
||||||
|
@ -208,7 +208,7 @@ unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
|
|||||||
# Location of compiler installation
|
# Location of compiler installation
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
if ( ! $?WM_COMPILER_TYPE ) then
|
if ( ! $?WM_COMPILER_TYPE ) then
|
||||||
set WM_COMPILER_TYPE=system
|
setenv WM_COMPILER_TYPE system
|
||||||
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
|
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
|
||||||
echo " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'"
|
echo " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'"
|
||||||
endif
|
endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,6 +38,8 @@ Description
|
|||||||
#include "timer.H"
|
#include "timer.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
|
#include "CStringList.H"
|
||||||
|
#include "SubList.H"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -49,6 +51,7 @@ Description
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -593,9 +596,9 @@ bool Foam::chMod(const fileName& name, const mode_t m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mode_t Foam::mode(const fileName& name)
|
mode_t Foam::mode(const fileName& name, const bool followLink)
|
||||||
{
|
{
|
||||||
fileStat fileStatus(name);
|
fileStat fileStatus(name, followLink);
|
||||||
if (fileStatus.isValid())
|
if (fileStatus.isValid())
|
||||||
{
|
{
|
||||||
return fileStatus.status().st_mode;
|
return fileStatus.status().st_mode;
|
||||||
@ -607,14 +610,18 @@ mode_t Foam::mode(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName::Type Foam::type(const fileName& name)
|
Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
|
||||||
{
|
{
|
||||||
mode_t m = mode(name);
|
mode_t m = mode(name, followLink);
|
||||||
|
|
||||||
if (S_ISREG(m))
|
if (S_ISREG(m))
|
||||||
{
|
{
|
||||||
return fileName::FILE;
|
return fileName::FILE;
|
||||||
}
|
}
|
||||||
|
else if (S_ISLNK(m))
|
||||||
|
{
|
||||||
|
return fileName::LINK;
|
||||||
|
}
|
||||||
else if (S_ISDIR(m))
|
else if (S_ISDIR(m))
|
||||||
{
|
{
|
||||||
return fileName::DIRECTORY;
|
return fileName::DIRECTORY;
|
||||||
@ -626,27 +633,39 @@ Foam::fileName::Type Foam::type(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::exists(const fileName& name, const bool checkGzip)
|
bool Foam::exists
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const bool checkGzip,
|
||||||
|
const bool followLink
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return mode(name) || isFile(name, checkGzip);
|
return mode(name, followLink) || isFile(name, checkGzip, followLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::isDir(const fileName& name)
|
bool Foam::isDir(const fileName& name, const bool followLink)
|
||||||
{
|
{
|
||||||
return S_ISDIR(mode(name));
|
return S_ISDIR(mode(name, followLink));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::isFile(const fileName& name, const bool checkGzip)
|
bool Foam::isFile
|
||||||
|
(
|
||||||
|
const fileName& name,
|
||||||
|
const bool checkGzip,
|
||||||
|
const bool followLink
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz")));
|
return
|
||||||
|
S_ISREG(mode(name, followLink))
|
||||||
|
|| (checkGzip && S_ISREG(mode(name + ".gz", followLink)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
off_t Foam::fileSize(const fileName& name)
|
off_t Foam::fileSize(const fileName& name, const bool followLink)
|
||||||
{
|
{
|
||||||
fileStat fileStatus(name);
|
fileStat fileStatus(name, followLink);
|
||||||
if (fileStatus.isValid())
|
if (fileStatus.isValid())
|
||||||
{
|
{
|
||||||
return fileStatus.status().st_size;
|
return fileStatus.status().st_size;
|
||||||
@ -658,9 +677,9 @@ off_t Foam::fileSize(const fileName& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
time_t Foam::lastModified(const fileName& name)
|
time_t Foam::lastModified(const fileName& name, const bool followLink)
|
||||||
{
|
{
|
||||||
fileStat fileStatus(name);
|
fileStat fileStatus(name, followLink);
|
||||||
if (fileStatus.isValid())
|
if (fileStatus.isValid())
|
||||||
{
|
{
|
||||||
return fileStatus.status().st_mtime;
|
return fileStatus.status().st_mtime;
|
||||||
@ -676,7 +695,8 @@ Foam::fileNameList Foam::readDir
|
|||||||
(
|
(
|
||||||
const fileName& directory,
|
const fileName& directory,
|
||||||
const fileName::Type type,
|
const fileName::Type type,
|
||||||
const bool filtergz
|
const bool filtergz,
|
||||||
|
const bool followLink
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Initial filename list size
|
// Initial filename list size
|
||||||
@ -717,10 +737,10 @@ Foam::fileNameList Foam::readDir
|
|||||||
{
|
{
|
||||||
fileName fName(list->d_name);
|
fileName fName(list->d_name);
|
||||||
|
|
||||||
// ignore files begining with ., i.e. '.', '..' and '.*'
|
// ignore files beginning with ., i.e. '.', '..' and '.*'
|
||||||
if (fName.size() && fName[0] != '.')
|
if (fName.size() && fName[0] != '.')
|
||||||
{
|
{
|
||||||
word fExt = fName.ext();
|
const word fExt = fName.ext();
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -736,7 +756,7 @@ Foam::fileNameList Foam::readDir
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ((directory/fName).type() == type)
|
if ((directory/fName).type(followLink) == type)
|
||||||
{
|
{
|
||||||
if (nEntries >= dirEntries.size())
|
if (nEntries >= dirEntries.size())
|
||||||
{
|
{
|
||||||
@ -766,7 +786,7 @@ Foam::fileNameList Foam::readDir
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::cp(const fileName& src, const fileName& dest)
|
bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
|
||||||
{
|
{
|
||||||
// Make sure source exists.
|
// Make sure source exists.
|
||||||
if (!exists(src))
|
if (!exists(src))
|
||||||
@ -777,7 +797,8 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
|||||||
fileName destFile(dest);
|
fileName destFile(dest);
|
||||||
|
|
||||||
// Check type of source file.
|
// Check type of source file.
|
||||||
if (src.type() == fileName::FILE)
|
const fileName::Type srcType = src.type(followLink);
|
||||||
|
if (srcType == fileName::FILE)
|
||||||
{
|
{
|
||||||
// If dest is a directory, create the destination file name.
|
// If dest is a directory, create the destination file name.
|
||||||
if (destFile.type() == fileName::DIRECTORY)
|
if (destFile.type() == fileName::DIRECTORY)
|
||||||
@ -817,7 +838,23 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (src.type() == fileName::DIRECTORY)
|
else if (srcType == fileName::LINK)
|
||||||
|
{
|
||||||
|
// If dest is a directory, create the destination file name.
|
||||||
|
if (destFile.type() == fileName::DIRECTORY)
|
||||||
|
{
|
||||||
|
destFile = destFile/src.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the destination directory exists.
|
||||||
|
if (!isDir(destFile.path()) && !mkDir(destFile.path()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ln(src, destFile);
|
||||||
|
}
|
||||||
|
else if (srcType == fileName::DIRECTORY)
|
||||||
{
|
{
|
||||||
// If dest is a directory, create the destination file name.
|
// If dest is a directory, create the destination file name.
|
||||||
if (destFile.type() == fileName::DIRECTORY)
|
if (destFile.type() == fileName::DIRECTORY)
|
||||||
@ -832,7 +869,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy files
|
// Copy files
|
||||||
fileNameList contents = readDir(src, fileName::FILE, false);
|
fileNameList contents = readDir(src, fileName::FILE, false, followLink);
|
||||||
forAll(contents, i)
|
forAll(contents, i)
|
||||||
{
|
{
|
||||||
if (POSIX::debug)
|
if (POSIX::debug)
|
||||||
@ -843,11 +880,17 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// File to file.
|
// File to file.
|
||||||
cp(src/contents[i], destFile/contents[i]);
|
cp(src/contents[i], destFile/contents[i], followLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy sub directories.
|
// Copy sub directories.
|
||||||
fileNameList subdirs = readDir(src, fileName::DIRECTORY);
|
fileNameList subdirs = readDir
|
||||||
|
(
|
||||||
|
src,
|
||||||
|
fileName::DIRECTORY,
|
||||||
|
false,
|
||||||
|
followLink
|
||||||
|
);
|
||||||
forAll(subdirs, i)
|
forAll(subdirs, i)
|
||||||
{
|
{
|
||||||
if (POSIX::debug)
|
if (POSIX::debug)
|
||||||
@ -858,9 +901,13 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dir to Dir.
|
// Dir to Dir.
|
||||||
cp(src/subdirs[i], destFile);
|
cp(src/subdirs[i], destFile, followLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -903,7 +950,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::mv(const fileName& src, const fileName& dst)
|
bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink)
|
||||||
{
|
{
|
||||||
if (POSIX::debug)
|
if (POSIX::debug)
|
||||||
{
|
{
|
||||||
@ -914,7 +961,7 @@ bool Foam::mv(const fileName& src, const fileName& dst)
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
dst.type() == fileName::DIRECTORY
|
dst.type() == fileName::DIRECTORY
|
||||||
&& src.type() != fileName::DIRECTORY
|
&& src.type(followLink) != fileName::DIRECTORY
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fileName dstName(dst/src.name());
|
const fileName dstName(dst/src.name());
|
||||||
@ -1016,7 +1063,7 @@ bool Foam::rmDir(const fileName& directory)
|
|||||||
{
|
{
|
||||||
fileName path = directory/fName;
|
fileName path = directory/fName;
|
||||||
|
|
||||||
if (path.type() == fileName::DIRECTORY)
|
if (path.type(false) == fileName::DIRECTORY)
|
||||||
{
|
{
|
||||||
if (!rmDir(path))
|
if (!rmDir(path))
|
||||||
{
|
{
|
||||||
@ -1166,9 +1213,153 @@ bool Foam::ping(const string& hostname, const label timeOut)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
//! \cond fileScope
|
||||||
|
static int waitpid(const pid_t pid)
|
||||||
|
{
|
||||||
|
// child status, return code from the exec etc.
|
||||||
|
int status = 0;
|
||||||
|
|
||||||
|
// in parent - blocking wait
|
||||||
|
// modest treatment of signals (in child)
|
||||||
|
// treat 'stopped' like exit (suspend/continue)
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
pid_t wpid = ::waitpid(pid, &status, WUNTRACED);
|
||||||
|
|
||||||
|
if (wpid == -1)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "some error occurred in child"
|
||||||
|
<< exit(FatalError);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WIFEXITED(status))
|
||||||
|
{
|
||||||
|
// child exited, get its return status
|
||||||
|
return WEXITSTATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WIFSIGNALED(status))
|
||||||
|
{
|
||||||
|
// child terminated by some signal
|
||||||
|
return WTERMSIG(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WIFSTOPPED(status))
|
||||||
|
{
|
||||||
|
// child stopped by some signal
|
||||||
|
return WSTOPSIG(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "programming error, status from waitpid() not handled: "
|
||||||
|
<< status
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1; // should not happen
|
||||||
|
}
|
||||||
|
//! \endcond
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Foam::system(const std::string& command)
|
int Foam::system(const std::string& command)
|
||||||
{
|
{
|
||||||
return ::system(command.c_str());
|
if (command.empty())
|
||||||
|
{
|
||||||
|
// Treat an empty command as a successful no-op.
|
||||||
|
// From 'man sh' POSIX (man sh):
|
||||||
|
// "If the command_string operand is an empty string,
|
||||||
|
// sh shall exit with a zero exit status."
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pid_t child_pid = ::vfork(); // NB: vfork, not fork!
|
||||||
|
if (child_pid == -1)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "vfork() failed for system command " << command
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child_pid == 0)
|
||||||
|
{
|
||||||
|
// in child
|
||||||
|
|
||||||
|
// execl uses the current environ
|
||||||
|
(void) ::execl
|
||||||
|
(
|
||||||
|
"/bin/sh", // Path of the shell
|
||||||
|
"sh", // Command-name (name for the shell)
|
||||||
|
"-c", // Read commands from the command_string operand.
|
||||||
|
command.c_str(), // Command string
|
||||||
|
reinterpret_cast<char *>(0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// obviously failed, since exec should not return at all
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "exec failed: " << command
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// in parent - blocking wait
|
||||||
|
return waitpid(child_pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Foam::system(const Foam::UList<Foam::string>& command)
|
||||||
|
{
|
||||||
|
const int argc = command.size();
|
||||||
|
|
||||||
|
if (!argc)
|
||||||
|
{
|
||||||
|
// Treat an empty command as a successful no-op.
|
||||||
|
// For consistency with POSIX (man sh) behaviour for (sh -c command),
|
||||||
|
// which is what is mostly being replicated here.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NB: use vfork, not fork!
|
||||||
|
// vfork behaves more like a thread and avoids copy-on-write problems
|
||||||
|
// triggered by fork.
|
||||||
|
// The normal system() command has a fork buried in it that causes
|
||||||
|
// issues with infiniband and openmpi etc.
|
||||||
|
pid_t child_pid = ::vfork();
|
||||||
|
if (child_pid == -1)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "vfork() failed for system command " << command[0]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child_pid == 0)
|
||||||
|
{
|
||||||
|
// in child:
|
||||||
|
// Need command and arguments separately.
|
||||||
|
// args is a NULL-terminated list of c-strings
|
||||||
|
|
||||||
|
CStringList args(SubList<string>(command, 0));
|
||||||
|
if (argc > 1)
|
||||||
|
{
|
||||||
|
args.reset(SubList<string>(command, argc-1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// execvp uses the current environ
|
||||||
|
(void) ::execvp(command[0].c_str(), args.strings());
|
||||||
|
|
||||||
|
// obviously failed, since exec should not return at all
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "exec(" << command[0] << ", ...) failed"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// in parent - blocking wait
|
||||||
|
return waitpid(child_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,6 +29,7 @@ License
|
|||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -38,7 +39,12 @@ Foam::fileStat::fileStat()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
|
Foam::fileStat::fileStat
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const bool followLink,
|
||||||
|
const unsigned int maxTime
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Work on volatile
|
// Work on volatile
|
||||||
volatile bool locIsValid = false;
|
volatile bool locIsValid = false;
|
||||||
@ -47,13 +53,13 @@ Foam::fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
|
|||||||
|
|
||||||
if (!timedOut(myTimer))
|
if (!timedOut(myTimer))
|
||||||
{
|
{
|
||||||
if (::stat(fName.c_str(), &status_) != 0)
|
if (followLink)
|
||||||
{
|
{
|
||||||
locIsValid = false;
|
locIsValid = (::stat(fName.c_str(), &status_) == 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
locIsValid = true;
|
locIsValid = (::lstat(fName.c_str(), &status_) == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,7 +25,7 @@ Class
|
|||||||
Foam::fileStat
|
Foam::fileStat
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Wrapper for stat() system call.
|
Wrapper for stat() and lstat() system calls.
|
||||||
|
|
||||||
Warning
|
Warning
|
||||||
on Linux (an maybe on others) a stat() of an nfs mounted (remote)
|
on Linux (an maybe on others) a stat() of an nfs mounted (remote)
|
||||||
@ -79,8 +79,21 @@ public:
|
|||||||
//- Empty constructor
|
//- Empty constructor
|
||||||
fileStat();
|
fileStat();
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components.
|
||||||
fileStat(const fileName& fName, const unsigned int maxTime=0);
|
// \param fName \n
|
||||||
|
// The file name or directory name to stat.
|
||||||
|
//
|
||||||
|
// \param followLink \n
|
||||||
|
// If it is a link, get the status of the source file/directory.
|
||||||
|
//
|
||||||
|
// \param maxTime \n
|
||||||
|
// The timeout value.
|
||||||
|
fileStat
|
||||||
|
(
|
||||||
|
const fileName& fName,
|
||||||
|
const bool followLink = true,
|
||||||
|
const unsigned int maxTime = 0
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
fileStat(Istream&);
|
fileStat(Istream&);
|
||||||
@ -96,7 +109,7 @@ public:
|
|||||||
return status_;
|
return status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Did constructor fail
|
//- Was file-stat successful?
|
||||||
bool isValid() const
|
bool isValid() const
|
||||||
{
|
{
|
||||||
return isValid_;
|
return isValid_;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -2535,16 +2535,6 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
|
|||||||
|
|
||||||
const node& nod = nodes_[nodeI];
|
const node& nod = nodes_[nodeI];
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
if (!nod.bb_.contains(sample))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Cannot find " << sample << " in node " << nodeI
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
direction octant = nod.bb_.subOctant(sample);
|
direction octant = nod.bb_.subOctant(sample);
|
||||||
|
|
||||||
labelBits index = nod.subNodes_[octant];
|
labelBits index = nod.subNodes_[octant];
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "dlLibraryTable.H"
|
#include "dlLibraryTable.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
#include "Ostream.H"
|
||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -42,6 +43,45 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
//! \cond fileScope
|
||||||
|
static inline void writeEntryIfPresent
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const dictionary& dict,
|
||||||
|
const word& key
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// non-recursive like dictionary::found, but no pattern-match either
|
||||||
|
const entry* ptr = dict.lookupEntryPtr(key, false, false);
|
||||||
|
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
os.writeKeyword(key)
|
||||||
|
<< token::HASH << token::BEGIN_BLOCK;
|
||||||
|
|
||||||
|
os.writeQuoted(string(ptr->stream()), false)
|
||||||
|
<< token::HASH << token::END_BLOCK
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//! \endcond
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::codedBase::writeCodeDict(Ostream& os, const dictionary& dict)
|
||||||
|
{
|
||||||
|
writeEntryIfPresent(os, dict, "codeInclude");
|
||||||
|
writeEntryIfPresent(os, dict, "localCode");
|
||||||
|
writeEntryIfPresent(os, dict, "code");
|
||||||
|
writeEntryIfPresent(os, dict, "codeOptions");
|
||||||
|
writeEntryIfPresent(os, dict, "codeLibs");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void* Foam::codedBase::loadLibrary
|
void* Foam::codedBase::loadLibrary
|
||||||
(
|
(
|
||||||
const fileName& libPath,
|
const fileName& libPath,
|
||||||
@ -165,8 +205,6 @@ void Foam::codedBase::unloadLibrary
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::codedBase::createLibrary
|
void Foam::codedBase::createLibrary
|
||||||
(
|
(
|
||||||
dynamicCode& dynCode,
|
dynamicCode& dynCode,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,6 +43,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
|
class Ostream;
|
||||||
class dynamicCode;
|
class dynamicCode;
|
||||||
class dynamicCodeContext;
|
class dynamicCodeContext;
|
||||||
class dlLibraryTable;
|
class dlLibraryTable;
|
||||||
@ -83,14 +84,17 @@ class codedBase
|
|||||||
void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
|
void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
codedBase(const codedBase&);
|
codedBase(const codedBase&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const codedBase&);
|
void operator=(const codedBase&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
//- Write code-dictionary contents
|
||||||
|
static void writeCodeDict(Ostream&, const dictionary&);
|
||||||
|
|
||||||
//- Update library as required
|
//- Update library as required
|
||||||
void updateLibrary
|
void updateLibrary
|
||||||
(
|
(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -493,10 +493,17 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
|
|||||||
|
|
||||||
bool Foam::dynamicCode::wmakeLibso() const
|
bool Foam::dynamicCode::wmakeLibso() const
|
||||||
{
|
{
|
||||||
const Foam::string wmakeCmd("wmake -s libso " + this->codePath());
|
DynamicList<string> cmd(4);
|
||||||
Info<< "Invoking " << wmakeCmd << endl;
|
cmd.append("wmake");
|
||||||
|
cmd.append("-s");
|
||||||
|
cmd.append("libso");
|
||||||
|
cmd.append(this->codePath());
|
||||||
|
|
||||||
if (Foam::system(wmakeCmd))
|
// NOTE: could also resolve wmake command explicitly
|
||||||
|
// cmd[0] = stringOps::expand("$WM_PROJECT_DIR/wmake/wmake");
|
||||||
|
|
||||||
|
Info<< "Invoking wmake libso " << this->codePath().c_str() << endl;
|
||||||
|
if (Foam::system(cmd))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -115,7 +115,7 @@ bool Foam::regIOobject::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send to my downstairs neighbours
|
// Send to my downstairs neighbours
|
||||||
forAll(myComm.below(), belowI)
|
forAllReverse(myComm.below(), belowI)
|
||||||
{
|
{
|
||||||
OPstream toBelow
|
OPstream toBelow
|
||||||
(
|
(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -331,55 +331,7 @@ void Foam::codedFixedValuePointPatchField<Type>::write(Ostream& os) const
|
|||||||
os.writeKeyword("redirectType") << redirectType_
|
os.writeKeyword("redirectType") << redirectType_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (dict_.found("codeInclude"))
|
codedBase::writeCodeDict(os, dict_);
|
||||||
{
|
|
||||||
os.writeKeyword("codeInclude")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeInclude"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("localCode"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("localCode")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["localCode"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("code"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("code")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["code"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("codeOptions"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("codeOptions")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeOptions"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("codeLibs"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("codeLibs")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeLibs"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ void Foam::argList::displayDoc(bool source) const
|
|||||||
|
|
||||||
Info<< "Show documentation: " << docBrowser.c_str() << endl;
|
Info<< "Show documentation: " << docBrowser.c_str() << endl;
|
||||||
|
|
||||||
system(docBrowser);
|
Foam::system(docBrowser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define OSspecific_H
|
#define OSspecific_H
|
||||||
|
|
||||||
#include "fileNameList.H"
|
#include "fileNameList.H"
|
||||||
|
#include "stringList.H"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
@ -132,44 +133,60 @@ bool mkDir(const fileName&, mode_t=0777);
|
|||||||
bool chMod(const fileName&, const mode_t);
|
bool chMod(const fileName&, const mode_t);
|
||||||
|
|
||||||
//- Return the file mode
|
//- Return the file mode
|
||||||
mode_t mode(const fileName&);
|
mode_t mode(const fileName&, const bool followLink=true);
|
||||||
|
|
||||||
//- Return the file type: DIRECTORY or FILE
|
//- Return the file type: DIRECTORY or FILE
|
||||||
fileName::Type type(const fileName&);
|
fileName::Type type(const fileName&, const bool followLink=true);
|
||||||
|
|
||||||
//- Does the name exist (as DIRECTORY or FILE) in the file system?
|
//- Does the name exist (as DIRECTORY or FILE) in the file system?
|
||||||
// Optionally enable/disable check for gzip file.
|
// Optionally enable/disable check for gzip file.
|
||||||
bool exists(const fileName&, const bool checkGzip=true);
|
bool exists
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const bool checkGzip=true,
|
||||||
|
const bool followLink=true
|
||||||
|
);
|
||||||
|
|
||||||
//- Does the name exist as a DIRECTORY in the file system?
|
//- Does the name exist as a DIRECTORY in the file system?
|
||||||
bool isDir(const fileName&);
|
bool isDir(const fileName&, const bool followLink=true);
|
||||||
|
|
||||||
//- Does the name exist as a FILE in the file system?
|
//- Does the name exist as a FILE in the file system?
|
||||||
// Optionally enable/disable check for gzip file.
|
// Optionally enable/disable check for gzip file.
|
||||||
bool isFile(const fileName&, const bool checkGzip=true);
|
bool isFile
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const bool checkGzip=true,
|
||||||
|
const bool followLink=true
|
||||||
|
);
|
||||||
|
|
||||||
//- Return size of file
|
//- Return size of file
|
||||||
off_t fileSize(const fileName&);
|
off_t fileSize(const fileName&, const bool followLink=true);
|
||||||
|
|
||||||
//- Return time of last file modification
|
//- Return time of last file modification
|
||||||
time_t lastModified(const fileName&);
|
time_t lastModified(const fileName&, const bool followLink=true);
|
||||||
|
|
||||||
//- Read a directory and return the entries as a string list
|
//- Read a directory and return the entries as a string list
|
||||||
fileNameList readDir
|
fileNameList readDir
|
||||||
(
|
(
|
||||||
const fileName&,
|
const fileName&,
|
||||||
const fileName::Type=fileName::FILE,
|
const fileName::Type=fileName::FILE,
|
||||||
const bool filtergz=true
|
const bool filtergz=true,
|
||||||
|
const bool followLink=true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy, recursively if necessary, the source to the destination
|
//- Copy, recursively if necessary, the source to the destination
|
||||||
bool cp(const fileName& src, const fileName& dst);
|
bool cp(const fileName& src, const fileName& dst, const bool followLink=true);
|
||||||
|
|
||||||
//- Create a softlink. dst should not exist. Returns true if successful.
|
//- Create a softlink. dst should not exist. Returns true if successful.
|
||||||
bool ln(const fileName& src, const fileName& dst);
|
bool ln(const fileName& src, const fileName& dst);
|
||||||
|
|
||||||
//- Rename src to dst
|
//- Rename src to dst
|
||||||
bool mv(const fileName& src, const fileName& dst);
|
bool mv
|
||||||
|
(
|
||||||
|
const fileName& src,
|
||||||
|
const fileName& dst,
|
||||||
|
const bool followLink=false
|
||||||
|
);
|
||||||
|
|
||||||
//- Rename to a corresponding backup file
|
//- Rename to a corresponding backup file
|
||||||
// If the backup file already exists, attempt with "01" .. "99" suffix
|
// If the backup file already exists, attempt with "01" .. "99" suffix
|
||||||
@ -193,9 +210,15 @@ bool ping(const string&, const label port, const label timeOut);
|
|||||||
//- Check if machine is up by pinging port 22 (ssh) and 222 (rsh)
|
//- Check if machine is up by pinging port 22 (ssh) and 222 (rsh)
|
||||||
bool ping(const string&, const label timeOut=10);
|
bool ping(const string&, const label timeOut=10);
|
||||||
|
|
||||||
//- Execute the specified command
|
//- Execute the specified command via the shell.
|
||||||
|
// Uses vfork/execl internally.
|
||||||
|
// Where possible, use the list version instead.
|
||||||
int system(const std::string& command);
|
int system(const std::string& command);
|
||||||
|
|
||||||
|
//- Execute the specified command with arguments.
|
||||||
|
// Uses vfork/execvp internally
|
||||||
|
int system(const UList<string>& command);
|
||||||
|
|
||||||
//- Open a shared library. Return handle to library. Print error message
|
//- Open a shared library. Return handle to library. Print error message
|
||||||
// if library cannot be loaded (check = true)
|
// if library cannot be loaded (check = true)
|
||||||
void* dlOpen(const fileName& lib, const bool check = true);
|
void* dlOpen(const fileName& lib, const bool check = true);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1130,6 +1130,21 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
|
|||||||
geometricD_ = Zero;
|
geometricD_ = Zero;
|
||||||
solutionD_ = Zero;
|
solutionD_ = Zero;
|
||||||
|
|
||||||
|
// Reset cell tree - it gets built from mesh geometry so might have
|
||||||
|
// wrong boxes. It is correct as long as none of the cells leaves
|
||||||
|
// the boxes it is in which most likely is almost never the case except
|
||||||
|
// for tiny displacements. An alternative is to check the displacements
|
||||||
|
// to see if they are tiny - imagine a big windtunnel with a small rotating
|
||||||
|
// object. In this case the processors without the rotating object wouldn't
|
||||||
|
// have to clear any geometry. However your critical path still stays the
|
||||||
|
// same so no time would be gained (unless the decomposition gets weighted).
|
||||||
|
// Small benefit for lots of scope for problems so not done.
|
||||||
|
cellTreePtr_.clear();
|
||||||
|
|
||||||
|
// Note: tet-base decomposition does not get cleared. Ideally your face
|
||||||
|
// decomposition should not change during mesh motion ...
|
||||||
|
|
||||||
|
|
||||||
meshObject::movePoints<polyMesh>(*this);
|
meshObject::movePoints<polyMesh>(*this);
|
||||||
meshObject::movePoints<pointMesh>(*this);
|
meshObject::movePoints<pointMesh>(*this);
|
||||||
|
|
||||||
|
@ -118,6 +118,12 @@ Foam::genericPolyPatch::~genericPolyPatch()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::word& Foam::genericPolyPatch::actualType() const
|
||||||
|
{
|
||||||
|
return actualTypeName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::genericPolyPatch::write(Ostream& os) const
|
void Foam::genericPolyPatch::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
os.writeKeyword("type") << actualTypeName_ << token::END_STATEMENT << nl;
|
os.writeKeyword("type") << actualTypeName_ << token::END_STATEMENT << nl;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,8 +25,9 @@ Class
|
|||||||
Foam::genericPolyPatch
|
Foam::genericPolyPatch
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Substitute for unknown patches. Used for postprocessing when only
|
Substitute for unknown patches.
|
||||||
basic polyPatch info is needed.
|
Used for postprocessing when only basic polyPatch info is needed
|
||||||
|
or if the real patch type is unavailable.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
Storage is not optimal. It stores all face centres and cells on all
|
Storage is not optimal. It stores all face centres and cells on all
|
||||||
@ -57,7 +58,7 @@ class genericPolyPatch
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
word actualTypeName_;
|
const word actualTypeName_;
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -162,6 +163,9 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
|
//- Return the actual type
|
||||||
|
const word& actualType() const;
|
||||||
|
|
||||||
//- Write the polyPatch data as a dictionary
|
//- Write the polyPatch data as a dictionary
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,9 +48,9 @@ Foam::fileName::fileName(const wordList& lst)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileName::Type Foam::fileName::type() const
|
Foam::fileName::Type Foam::fileName::type(const bool followLink) const
|
||||||
{
|
{
|
||||||
return ::Foam::type(*this);
|
return ::Foam::type(*this, followLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -94,6 +94,7 @@ bool Foam::fileName::clean()
|
|||||||
(
|
(
|
||||||
string::size_type src = nChar;
|
string::size_type src = nChar;
|
||||||
src < maxLen;
|
src < maxLen;
|
||||||
|
/*nil*/
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
char c = operator[](src++);
|
char c = operator[](src++);
|
||||||
|
@ -154,8 +154,9 @@ public:
|
|||||||
|
|
||||||
// Interrogation
|
// Interrogation
|
||||||
|
|
||||||
//- Return the file type: FILE, DIRECTORY or UNDEFINED
|
//- Return the file type: FILE, DIRECTORY, UNDEFINED or
|
||||||
Type type() const;
|
// LINK (only if followLink=false)
|
||||||
|
Type type(const bool followLink = true) const;
|
||||||
|
|
||||||
//- Return true if file name is absolute
|
//- Return true if file name is absolute
|
||||||
bool isAbsolute() const;
|
bool isAbsolute() const;
|
||||||
|
175
src/OpenFOAM/primitives/strings/lists/CStringList.H
Normal file
175
src/OpenFOAM/primitives/strings/lists/CStringList.H
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::CStringList
|
||||||
|
|
||||||
|
Description
|
||||||
|
An adapter for copying a list of C++ strings into a list of C-style
|
||||||
|
strings for passing to C code that expects argc/argv parameters.
|
||||||
|
|
||||||
|
In addition to providing a C-compatible list of C-strings,
|
||||||
|
the string lists are flattened into a single string of data that can be
|
||||||
|
also be passed en mass.
|
||||||
|
|
||||||
|
Example use:
|
||||||
|
\code
|
||||||
|
wordList myStrings; ...
|
||||||
|
CStringList cstr(myStrings);
|
||||||
|
|
||||||
|
// pass as argc, argv:
|
||||||
|
someMain(cstr.size(), cstr.strings());
|
||||||
|
|
||||||
|
// access the raw characters:
|
||||||
|
os.write(cstr.data(), cstr.length());
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef CStringList_H
|
||||||
|
#define CStringList_H
|
||||||
|
|
||||||
|
#include "fileNameList.H"
|
||||||
|
#include "stringList.H"
|
||||||
|
#include "wordList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class CStringList Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class CStringList
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Number of strings
|
||||||
|
int argc_;
|
||||||
|
|
||||||
|
//- Overall length of the raw content
|
||||||
|
// Does not include the final nul-character
|
||||||
|
size_t len_;
|
||||||
|
|
||||||
|
//- List of strings, including trailing NULL pointer
|
||||||
|
char** argv_;
|
||||||
|
|
||||||
|
//- Flattened content with interspersed nul-characters
|
||||||
|
char* data_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
CStringList(const CStringList&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const CStringList&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct empty, adding content later (via reset).
|
||||||
|
inline CStringList();
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct from a list of strings
|
||||||
|
// Copies the input characters.
|
||||||
|
template<class StringType>
|
||||||
|
CStringList(const UList<StringType>& input);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
inline ~CStringList();
|
||||||
|
|
||||||
|
|
||||||
|
// Public Members
|
||||||
|
|
||||||
|
//- Count the number of parameters until the first NULL pointer.
|
||||||
|
// Return 0 if argv is NULL.
|
||||||
|
static inline int count(const char * const argv[]);
|
||||||
|
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the number of C-strings (ie, argc)
|
||||||
|
inline int size() const;
|
||||||
|
|
||||||
|
//- Return the list of C-strings (ie, argv)
|
||||||
|
// The position at argc is a NULL pointer
|
||||||
|
inline char** strings() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Overall length of the flattened character (data) content
|
||||||
|
inline size_t length() const;
|
||||||
|
|
||||||
|
//- The flattened character content, with interspersed nul-chars
|
||||||
|
inline char* data() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Clear contents and free memory
|
||||||
|
inline void clear();
|
||||||
|
|
||||||
|
//- Copy the input list of strings.
|
||||||
|
template<class StringType>
|
||||||
|
void reset(const UList<StringType>& input);
|
||||||
|
|
||||||
|
|
||||||
|
// Other
|
||||||
|
|
||||||
|
//- Create a list from argc/argv parameters.
|
||||||
|
// A null pointer for argv is permissible when argc is zero.
|
||||||
|
template<class StringType>
|
||||||
|
static List<StringType> asList(int argc, const char * const argv[]);
|
||||||
|
|
||||||
|
//- Create a list from a NULL-terminated list of argv parameters.
|
||||||
|
// A null pointer for argv is permissible.
|
||||||
|
template<class StringType>
|
||||||
|
static inline List<StringType> asList(const char * const argv[]);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "CStringListI.H"
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "CStringListTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
106
src/OpenFOAM/primitives/strings/lists/CStringListI.H
Normal file
106
src/OpenFOAM/primitives/strings/lists/CStringListI.H
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline int Foam::CStringList::count(const char * const argv[])
|
||||||
|
{
|
||||||
|
int nElem = 0;
|
||||||
|
if (argv)
|
||||||
|
{
|
||||||
|
while (argv[nElem])
|
||||||
|
{
|
||||||
|
++nElem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nElem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::CStringList::CStringList()
|
||||||
|
:
|
||||||
|
argc_(0),
|
||||||
|
len_(0),
|
||||||
|
argv_(0),
|
||||||
|
data_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::CStringList::~CStringList()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline void Foam::CStringList::clear()
|
||||||
|
{
|
||||||
|
argc_ = 0;
|
||||||
|
len_ = 0;
|
||||||
|
|
||||||
|
if (data_)
|
||||||
|
{
|
||||||
|
delete[] data_;
|
||||||
|
data_ = 0;
|
||||||
|
}
|
||||||
|
if (argv_)
|
||||||
|
{
|
||||||
|
delete[] argv_;
|
||||||
|
argv_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int Foam::CStringList::size() const
|
||||||
|
{
|
||||||
|
return argc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t Foam::CStringList::length() const
|
||||||
|
{
|
||||||
|
return len_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline char** Foam::CStringList::strings() const
|
||||||
|
{
|
||||||
|
return argv_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline char* Foam::CStringList::data() const
|
||||||
|
{
|
||||||
|
return data_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
115
src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C
Normal file
115
src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class StringType>
|
||||||
|
Foam::CStringList::CStringList
|
||||||
|
(
|
||||||
|
const UList<StringType>& input
|
||||||
|
)
|
||||||
|
:
|
||||||
|
argc_(0),
|
||||||
|
len_(0),
|
||||||
|
argv_(0),
|
||||||
|
data_(0)
|
||||||
|
{
|
||||||
|
reset(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class StringType>
|
||||||
|
void Foam::CStringList::reset
|
||||||
|
(
|
||||||
|
const UList<StringType>& input
|
||||||
|
)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
|
argc_ = input.size();
|
||||||
|
forAll(input, argI)
|
||||||
|
{
|
||||||
|
len_ += input[argI].size();
|
||||||
|
++len_; // nul terminator for C-strings
|
||||||
|
}
|
||||||
|
|
||||||
|
argv_ = new char*[argc_+1];
|
||||||
|
argv_[argc_] = NULL; // extra terminator
|
||||||
|
|
||||||
|
if (argc_ > 0)
|
||||||
|
{
|
||||||
|
// allocation includes final nul terminator,
|
||||||
|
// but overall count does not
|
||||||
|
data_ = new char[len_--];
|
||||||
|
|
||||||
|
char* ptr = data_;
|
||||||
|
forAll(input, argI)
|
||||||
|
{
|
||||||
|
argv_[argI] = ptr;
|
||||||
|
|
||||||
|
const std::string& str =
|
||||||
|
static_cast<const std::string&>(input[argI]);
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
std::string::const_iterator iter = str.begin();
|
||||||
|
iter != str.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
*(ptr++) = *iter;
|
||||||
|
}
|
||||||
|
*(ptr++) = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StringType>
|
||||||
|
Foam::List<StringType>
|
||||||
|
Foam::CStringList::asList(int argc, const char * const argv[])
|
||||||
|
{
|
||||||
|
List<StringType> lst(argc);
|
||||||
|
|
||||||
|
for (int i=0; i < argc; ++i)
|
||||||
|
{
|
||||||
|
lst[i] = argv[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StringType>
|
||||||
|
Foam::List<StringType>
|
||||||
|
Foam::CStringList::asList(const char * const argv[])
|
||||||
|
{
|
||||||
|
return asList<StringType>(count(argv), argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -329,55 +329,7 @@ void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
|||||||
os.writeKeyword("redirectType") << redirectType_
|
os.writeKeyword("redirectType") << redirectType_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (dict_.found("codeInclude"))
|
codedBase::writeCodeDict(os, dict_);
|
||||||
{
|
|
||||||
os.writeKeyword("codeInclude")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeInclude"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("localCode"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("localCode")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["localCode"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("code"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("code")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["code"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("codeOptions"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("codeOptions")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeOptions"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("codeLibs"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("codeLibs")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeLibs"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -341,55 +341,7 @@ void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
|
|||||||
os.writeKeyword("redirectType") << redirectType_
|
os.writeKeyword("redirectType") << redirectType_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (dict_.found("codeInclude"))
|
codedBase::writeCodeDict(os, dict_);
|
||||||
{
|
|
||||||
os.writeKeyword("codeInclude")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeInclude"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("localCode"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("localCode")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["localCode"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("code"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("code")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["code"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("codeOptions"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("codeOptions")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeOptions"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict_.found("codeLibs"))
|
|
||||||
{
|
|
||||||
os.writeKeyword("codeLibs")
|
|
||||||
<< token::HASH << token::BEGIN_BLOCK;
|
|
||||||
|
|
||||||
os.writeQuoted(string(dict_["codeLibs"]), false)
|
|
||||||
<< token::HASH << token::END_BLOCK
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,10 +55,11 @@ Description
|
|||||||
jumpTable csvFile;
|
jumpTable csvFile;
|
||||||
csvFileCoeffs
|
csvFileCoeffs
|
||||||
{
|
{
|
||||||
hasHeaderLine 1;
|
nHeaderLine 1;
|
||||||
refColumn 0;
|
refColumn 0;
|
||||||
componentColumns 1(1);
|
componentColumns 1(1);
|
||||||
separator ",";
|
separator ",";
|
||||||
|
mergeSeparators no;
|
||||||
fileName "$FOAM_CASE/constant/pressureVsU";
|
fileName "$FOAM_CASE/constant/pressureVsU";
|
||||||
}
|
}
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
|
@ -848,7 +848,7 @@ turbulentDFSEMInletFvPatchVectorField
|
|||||||
eddy::debug = debug;
|
eddy::debug = debug;
|
||||||
|
|
||||||
// Set UMean as patch area average value
|
// Set UMean as patch area average value
|
||||||
UMean_ = gSum(U_*patch().magSf())/gSum(patch().magSf());
|
UMean_ = gSum(U_*patch().magSf())/(gSum(patch().magSf()) + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -764,6 +764,13 @@ Foam::genericFvPatchField<Type>::gradientBoundaryCoeffs() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::word& Foam::genericFvPatchField<Type>::actualType() const
|
||||||
|
{
|
||||||
|
return actualTypeName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::genericFvPatchField<Type>::write(Ostream& os) const
|
void Foam::genericFvPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ class genericFvPatchField
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
word actualTypeName_;
|
const word actualTypeName_;
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
|
|
||||||
HashPtrTable<scalarField> scalarFields_;
|
HashPtrTable<scalarField> scalarFields_;
|
||||||
@ -179,6 +179,9 @@ public:
|
|||||||
tmp<Field<Type>> gradientBoundaryCoeffs() const;
|
tmp<Field<Type>> gradientBoundaryCoeffs() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the actual type
|
||||||
|
const word& actualType() const;
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -557,6 +557,13 @@ void Foam::genericPointPatchField<Type>::rmap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::word& Foam::genericPointPatchField<Type>::actualType() const
|
||||||
|
{
|
||||||
|
return actualTypeName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::genericPointPatchField<Type>::write(Ostream& os) const
|
void Foam::genericPointPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -55,7 +55,7 @@ class genericPointPatchField
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
word actualTypeName_;
|
const word actualTypeName_;
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
|
|
||||||
HashPtrTable<scalarField> scalarFields_;
|
HashPtrTable<scalarField> scalarFields_;
|
||||||
@ -151,6 +151,9 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the actual type
|
||||||
|
const word& actualType() const;
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
@ -25,12 +25,17 @@ Class
|
|||||||
Foam::EulerCoordinateRotation
|
Foam::EulerCoordinateRotation
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A coordinateRotation defined in the z-x-y Euler convention.
|
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
|
||||||
|
|
||||||
|
The 3 rotations are defined in the Euler intrinsic convention
|
||||||
|
(around Z, around X' and around Z'').
|
||||||
|
The order of the parameter arguments matches this rotation order.
|
||||||
|
|
||||||
The 3 rotations are defined in the Euler convention
|
|
||||||
(around Z, around X' and around Z').
|
|
||||||
For reference and illustration, see
|
For reference and illustration, see
|
||||||
http://mathworld.wolfram.com/EulerAngles.html
|
http://mathworld.wolfram.com/EulerAngles.html
|
||||||
|
and
|
||||||
|
https://en.wikipedia.org/wiki/Euler_angles#Conventions
|
||||||
|
|
||||||
Note, however, that it is the reverse transformation
|
Note, however, that it is the reverse transformation
|
||||||
(local->global) that is defined here.
|
(local->global) that is defined here.
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ License
|
|||||||
#include "vtkSphereSource.h"
|
#include "vtkSphereSource.h"
|
||||||
#include "vtkTextActor.h"
|
#include "vtkTextActor.h"
|
||||||
#include "vtkTextProperty.h"
|
#include "vtkTextProperty.h"
|
||||||
|
#include "vtkCellDataToPointData.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -151,6 +152,9 @@ void Foam::fieldVisualisationBase::addScalarBar
|
|||||||
const vector textColour = colours_["text"]->value(position);
|
const vector textColour = colours_["text"]->value(position);
|
||||||
|
|
||||||
// Work-around to supply our own scalarbar title
|
// Work-around to supply our own scalarbar title
|
||||||
|
// - Default scalar bar title text is scales by the scalar bar box
|
||||||
|
// dimensions so if the title is a long string, the text is shrunk to fit
|
||||||
|
// Instead, suppress title and set the title using a vtkTextActor
|
||||||
vtkSmartPointer<vtkTextActor> titleActor =
|
vtkSmartPointer<vtkTextActor> titleActor =
|
||||||
vtkSmartPointer<vtkTextActor>::New();
|
vtkSmartPointer<vtkTextActor>::New();
|
||||||
sbar->SetTitle(" ");
|
sbar->SetTitle(" ");
|
||||||
@ -170,19 +174,18 @@ void Foam::fieldVisualisationBase::addScalarBar
|
|||||||
titleActor->GetPositionCoordinate()->
|
titleActor->GetPositionCoordinate()->
|
||||||
SetCoordinateSystemToNormalizedViewport();
|
SetCoordinateSystemToNormalizedViewport();
|
||||||
|
|
||||||
/*
|
// How to use the standard scalar bar text
|
||||||
sbar->SetTitle(scalarBar_.title_.c_str());
|
// sbar->SetTitle(scalarBar_.title_.c_str());
|
||||||
sbar->GetTitleTextProperty()->SetColor
|
// sbar->GetTitleTextProperty()->SetColor
|
||||||
(
|
// (
|
||||||
textColour[0],
|
// textColour[0],
|
||||||
textColour[1],
|
// textColour[1],
|
||||||
textColour[2]
|
// textColour[2]
|
||||||
);
|
// );
|
||||||
sbar->GetTitleTextProperty()->SetFontSize(scalarBar_.fontSize_);
|
// sbar->GetTitleTextProperty()->SetFontSize(scalarBar_.fontSize_);
|
||||||
sbar->GetTitleTextProperty()->ShadowOff();
|
// sbar->GetTitleTextProperty()->ShadowOff();
|
||||||
sbar->GetTitleTextProperty()->BoldOn();
|
// sbar->GetTitleTextProperty()->BoldOn();
|
||||||
sbar->GetTitleTextProperty()->ItalicOff();
|
// sbar->GetTitleTextProperty()->ItalicOff();
|
||||||
*/
|
|
||||||
|
|
||||||
sbar->GetLabelTextProperty()->SetColor
|
sbar->GetLabelTextProperty()->SetColor
|
||||||
(
|
(
|
||||||
@ -217,8 +220,8 @@ void Foam::fieldVisualisationBase::addScalarBar
|
|||||||
sbar->SetWidth(0.75);
|
sbar->SetWidth(0.75);
|
||||||
sbar->SetHeight(0.07);
|
sbar->SetHeight(0.07);
|
||||||
sbar->SetBarRatio(0.5);
|
sbar->SetBarRatio(0.5);
|
||||||
// sbar->SetHeight(0.1);
|
// sbar->SetHeight(0.1);
|
||||||
// sbar->SetTitleRatio(0.01);
|
// sbar->SetTitleRatio(0.01);
|
||||||
sbar->SetTextPositionToPrecedeScalarBar();
|
sbar->SetTextPositionToPrecedeScalarBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,10 +231,10 @@ void Foam::fieldVisualisationBase::addScalarBar
|
|||||||
scalarBar_.position_.second() + sbar->GetHeight()
|
scalarBar_.position_.second() + sbar->GetHeight()
|
||||||
);
|
);
|
||||||
|
|
||||||
// sbar->DrawFrameOn();
|
// sbar->DrawFrameOn();
|
||||||
// sbar->DrawBackgroundOn();
|
// sbar->DrawBackgroundOn();
|
||||||
// sbar->UseOpacityOff();
|
// sbar->UseOpacityOff();
|
||||||
// sbar->VisibilityOff();
|
// sbar->VisibilityOff();
|
||||||
sbar->VisibilityOn();
|
sbar->VisibilityOn();
|
||||||
|
|
||||||
renderer->AddActor(sbar);
|
renderer->AddActor(sbar);
|
||||||
@ -268,25 +271,7 @@ void Foam::fieldVisualisationBase::setField
|
|||||||
// Configure the mapper
|
// Configure the mapper
|
||||||
mapper->SelectColorArray(colourFieldName.c_str());
|
mapper->SelectColorArray(colourFieldName.c_str());
|
||||||
mapper->SetScalarRange(range_.first(), range_.second());
|
mapper->SetScalarRange(range_.first(), range_.second());
|
||||||
|
mapper->SetScalarModeToDefault(); // try points, then cells
|
||||||
// Set to use either cell or point data
|
|
||||||
const char* fieldName = colourFieldName.c_str();
|
|
||||||
if (pData->GetCellData()->HasArray(fieldName) == 1)
|
|
||||||
{
|
|
||||||
mapper->SetScalarModeToUseCellFieldData();
|
|
||||||
}
|
|
||||||
else if (pData->GetPointData()->HasArray(fieldName) == 1)
|
|
||||||
{
|
|
||||||
mapper->SetScalarModeToUsePointFieldData();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Unable to determine cell or point data type "
|
|
||||||
<< "- assuming point data";
|
|
||||||
mapper->SetScalarModeToUsePointFieldData();
|
|
||||||
}
|
|
||||||
|
|
||||||
mapper->SetColorModeToMapScalars();
|
mapper->SetColorModeToMapScalars();
|
||||||
mapper->SetLookupTable(lut);
|
mapper->SetLookupTable(lut);
|
||||||
mapper->ScalarVisibilityOn();
|
mapper->ScalarVisibilityOn();
|
||||||
@ -322,9 +307,37 @@ void Foam::fieldVisualisationBase::addGlyphs
|
|||||||
glyph->ScalingOn();
|
glyph->ScalingOn();
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
label nComponents =
|
// Determine whether we have scalar or vector data
|
||||||
data->GetPointData()->GetArray(scaleFieldName.c_str())
|
label nComponents = -1;
|
||||||
|
const char* scaleFieldNameChar = scaleFieldName.c_str();
|
||||||
|
if (data->GetPointData()->HasArray(scaleFieldNameChar) == 1)
|
||||||
|
{
|
||||||
|
nComponents =
|
||||||
|
data->GetPointData()->GetArray(scaleFieldNameChar)
|
||||||
->GetNumberOfComponents();
|
->GetNumberOfComponents();
|
||||||
|
}
|
||||||
|
else if (data->GetCellData()->HasArray(scaleFieldNameChar) == 1)
|
||||||
|
{
|
||||||
|
// Need to convert cell data to point data
|
||||||
|
vtkSmartPointer<vtkCellDataToPointData> cellToPoint =
|
||||||
|
vtkSmartPointer<vtkCellDataToPointData>::New();
|
||||||
|
cellToPoint->SetInputData(data);
|
||||||
|
cellToPoint->Update();
|
||||||
|
vtkDataSet* pds = cellToPoint->GetOutput();
|
||||||
|
vtkDataArray* pData = pds->GetPointData()->GetArray(scaleFieldNameChar);
|
||||||
|
|
||||||
|
// Store in main vtkPolyData
|
||||||
|
data->GetPointData()->AddArray(pData);
|
||||||
|
|
||||||
|
nComponents = pData->GetNumberOfComponents();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Glyphs can only be added to scalar or vector data. "
|
||||||
|
<< "Unable to process field " << scaleFieldName << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (nComponents == 1)
|
if (nComponents == 1)
|
||||||
{
|
{
|
||||||
@ -332,9 +345,10 @@ void Foam::fieldVisualisationBase::addGlyphs
|
|||||||
vtkSmartPointer<vtkSphereSource>::New();
|
vtkSmartPointer<vtkSphereSource>::New();
|
||||||
sphere->SetCenter(0, 0, 0);
|
sphere->SetCenter(0, 0, 0);
|
||||||
sphere->SetRadius(0.5);
|
sphere->SetRadius(0.5);
|
||||||
// Setting higher resolution slows the rendering significantly
|
|
||||||
// sphere->SetPhiResolution(20);
|
// Setting higher resolution slows the rendering significantly
|
||||||
// sphere->SetThetaResolution(20);
|
// sphere->SetPhiResolution(20);
|
||||||
|
// sphere->SetThetaResolution(20);
|
||||||
|
|
||||||
glyph->SetSourceConnection(sphere->GetOutputPort());
|
glyph->SetSourceConnection(sphere->GetOutputPort());
|
||||||
|
|
||||||
@ -342,18 +356,18 @@ void Foam::fieldVisualisationBase::addGlyphs
|
|||||||
{
|
{
|
||||||
double range[2];
|
double range[2];
|
||||||
|
|
||||||
// Can use values to find range
|
// Can use values to find range
|
||||||
// vtkDataArray* values =
|
// vtkDataArray* values =
|
||||||
// data->GetPointData()->GetScalars(scaleFieldName.c_str());
|
// data->GetPointData()->GetScalars(scaleFieldNameChar);
|
||||||
// values->GetRange(range);
|
// values->GetRange(range);
|
||||||
|
|
||||||
// set range accoding to user-supplied limits
|
// Set range accoding to user-supplied limits
|
||||||
range[0] = range_.first();
|
range[0] = range_.first();
|
||||||
range[1] = range_.second();
|
range[1] = range_.second();
|
||||||
glyph->ClampingOn();
|
glyph->ClampingOn();
|
||||||
glyph->SetRange(range);
|
glyph->SetRange(range);
|
||||||
|
|
||||||
// if range[0] != min(value), maxGlyphLength behaviour will not
|
// If range[0] != min(value), maxGlyphLength behaviour will not
|
||||||
// be correct...
|
// be correct...
|
||||||
glyph->SetScaleFactor(maxGlyphLength);
|
glyph->SetScaleFactor(maxGlyphLength);
|
||||||
}
|
}
|
||||||
@ -370,7 +384,7 @@ void Foam::fieldVisualisationBase::addGlyphs
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
vtkDataObject::FIELD_ASSOCIATION_POINTS,
|
vtkDataObject::FIELD_ASSOCIATION_POINTS,
|
||||||
scaleFieldName.c_str()
|
scaleFieldNameChar
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (nComponents == 3)
|
else if (nComponents == 3)
|
||||||
@ -388,21 +402,21 @@ void Foam::fieldVisualisationBase::addGlyphs
|
|||||||
if (maxGlyphLength > 0)
|
if (maxGlyphLength > 0)
|
||||||
{
|
{
|
||||||
vtkDataArray* values =
|
vtkDataArray* values =
|
||||||
data->GetPointData()->GetVectors(scaleFieldName.c_str());
|
data->GetPointData()->GetVectors(scaleFieldNameChar);
|
||||||
|
|
||||||
double range[6];
|
double range[6];
|
||||||
values->GetRange(range);
|
values->GetRange(range);
|
||||||
|
|
||||||
/*
|
|
||||||
// Attempt to set range for vectors...
|
// Attempt to set range for vectors...
|
||||||
scalar x0 = sqrt(sqr(range_.first())/3.0);
|
// scalar x0 = sqrt(sqr(range_.first())/3.0);
|
||||||
scalar x1 = sqrt(sqr(range_.second())/3.0);
|
// scalar x1 = sqrt(sqr(range_.second())/3.0);
|
||||||
range[0] = x0;
|
// range[0] = x0;
|
||||||
range[1] = x0;
|
// range[1] = x0;
|
||||||
range[2] = x0;
|
// range[2] = x0;
|
||||||
range[3] = x1;
|
// range[3] = x1;
|
||||||
range[4] = x1;
|
// range[4] = x1;
|
||||||
range[5] = x1;
|
// range[5] = x1;
|
||||||
*/
|
|
||||||
glyph->ClampingOn();
|
glyph->ClampingOn();
|
||||||
glyph->SetRange(range);
|
glyph->SetRange(range);
|
||||||
glyph->SetScaleFactor(maxGlyphLength);
|
glyph->SetScaleFactor(maxGlyphLength);
|
||||||
@ -421,7 +435,7 @@ void Foam::fieldVisualisationBase::addGlyphs
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
vtkDataObject::FIELD_ASSOCIATION_POINTS,
|
vtkDataObject::FIELD_ASSOCIATION_POINTS,
|
||||||
scaleFieldName.c_str()
|
scaleFieldNameChar
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -770,7 +770,7 @@ void Foam::externalCoupledFunctionObject::initialise()
|
|||||||
// Wait for initial data to be made available
|
// Wait for initial data to be made available
|
||||||
wait();
|
wait();
|
||||||
|
|
||||||
// Eead data passed back from external source
|
// Read data passed back from external source
|
||||||
readData();
|
readData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,14 +62,15 @@ functions
|
|||||||
// called at the end of the run
|
// called at the end of the run
|
||||||
endCalls
|
endCalls
|
||||||
(
|
(
|
||||||
"echo \*\*\* writing .bashrc \*\*\*"
|
// Note: single quotes to avoid shell expansion
|
||||||
"cat ~/.bashrc"
|
"echo '*** listing ~/.bashrc ***'"
|
||||||
"echo \*\*\* done \*\*\*"
|
"cat ~/.bashrc; echo '*** done ***'"
|
||||||
);
|
);
|
||||||
|
|
||||||
// called every ouput time
|
// called every output time
|
||||||
writeCalls
|
writeCalls
|
||||||
(
|
(
|
||||||
|
// Note: can also backslash to escape shell meta-characters
|
||||||
"echo \*\*\* writing data \*\*\*"
|
"echo \*\*\* writing data \*\*\*"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,13 @@ class mapFieldsFO
|
|||||||
//- Helper function to create the mesh-to-mesh interpolation
|
//- Helper function to create the mesh-to-mesh interpolation
|
||||||
void createInterpolation(const dictionary& dict);
|
void createInterpolation(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Helper function to evaluate constraint patches after mapping
|
||||||
|
template<class Type>
|
||||||
|
void evaluateConstraintTypes
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Helper function to interpolate and write the fied
|
//- Helper function to interpolate and write the fied
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool writeFieldType() const;
|
bool writeFieldType() const;
|
||||||
|
@ -25,6 +25,91 @@ License
|
|||||||
|
|
||||||
#include "meshToMesh.H"
|
#include "meshToMesh.H"
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mapFieldsFO::evaluateConstraintTypes
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typename GeometricField<Type, fvPatchField, volMesh>::
|
||||||
|
GeometricBoundaryField& fldBf = fld.boundaryField();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType == Pstream::blocking
|
||||||
|
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label nReq = Pstream::nRequests();
|
||||||
|
|
||||||
|
forAll(fldBf, patchi)
|
||||||
|
{
|
||||||
|
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tgtField.type() == tgtField.patch().patch().type()
|
||||||
|
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tgtField.initEvaluate(Pstream::defaultCommsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block for any outstanding requests
|
||||||
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& Pstream::defaultCommsType == Pstream::nonBlocking
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Pstream::waitRequests(nReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(fldBf, patchi)
|
||||||
|
{
|
||||||
|
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tgtField.type() == tgtField.patch().patch().type()
|
||||||
|
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tgtField.evaluate(Pstream::defaultCommsType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||||
|
{
|
||||||
|
const lduSchedule& patchSchedule =
|
||||||
|
fld.mesh().globalData().patchSchedule();
|
||||||
|
|
||||||
|
forAll(patchSchedule, patchEvali)
|
||||||
|
{
|
||||||
|
label patchi = patchSchedule[patchEvali].patch;
|
||||||
|
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
tgtField.type() == tgtField.patch().patch().type()
|
||||||
|
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (patchSchedule[patchEvali].init)
|
||||||
|
{
|
||||||
|
tgtField.initEvaluate(Pstream::scheduled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tgtField.evaluate(Pstream::scheduled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::mapFieldsFO::writeFieldType() const
|
bool Foam::mapFieldsFO::writeFieldType() const
|
||||||
{
|
{
|
||||||
@ -53,6 +138,9 @@ bool Foam::mapFieldsFO::writeFieldType() const
|
|||||||
if (log_) Info<< ": interpolated";
|
if (log_) Info<< ": interpolated";
|
||||||
|
|
||||||
FieldType fieldMapRegion(mapRegionIO, tfieldMapRegion);
|
FieldType fieldMapRegion(mapRegionIO, tfieldMapRegion);
|
||||||
|
|
||||||
|
evaluateConstraintTypes(fieldMapRegion);
|
||||||
|
|
||||||
fieldMapRegion.write();
|
fieldMapRegion.write();
|
||||||
|
|
||||||
if (log_) Info<< " and written" << nl;
|
if (log_) Info<< " and written" << nl;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,9 +62,15 @@ void Foam::faceShading::writeRays
|
|||||||
vertI++;
|
vertI++;
|
||||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
}
|
}
|
||||||
string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
|
str.flush();
|
||||||
Pout<< "cmd:" << cmd << endl;
|
|
||||||
system(cmd);
|
DynamicList<string> cmd(3);
|
||||||
|
cmd.append("objToVTK");
|
||||||
|
cmd.append(fName);
|
||||||
|
cmd.append(fName.lessExt() + ".vtk");
|
||||||
|
|
||||||
|
Pout<< "cmd: objToVTK " << fName.c_str() << endl;
|
||||||
|
Foam::system(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#-------------------------------*- makefile -*---------------------------------
|
#-------------------------------*- makefile -*---------------------------------
|
||||||
|
WM_VERSION = OPENFOAM_PLUS=1606
|
||||||
|
|
||||||
AR = ar
|
AR = ar
|
||||||
ARFLAGS = cr
|
ARFLAGS = cr
|
||||||
@ -6,7 +7,7 @@ RANLIB = ranlib
|
|||||||
CPP = cpp
|
CPP = cpp
|
||||||
LD = ld
|
LD = ld
|
||||||
|
|
||||||
GFLAGS = -D$(WM_ARCH) -DWM_ARCH_OPTION=$(WM_ARCH_OPTION) \
|
GFLAGS = -D$(WM_VERSION) -D$(WM_ARCH) -DWM_ARCH_OPTION=$(WM_ARCH_OPTION) \
|
||||||
-DWM_$(WM_PRECISION_OPTION) -DWM_LABEL_SIZE=$(WM_LABEL_SIZE)
|
-DWM_$(WM_PRECISION_OPTION) -DWM_LABEL_SIZE=$(WM_LABEL_SIZE)
|
||||||
GINC =
|
GINC =
|
||||||
GLIBS = -lm
|
GLIBS = -lm
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM.
|
||||||
@ -72,7 +72,6 @@ do
|
|||||||
;;
|
;;
|
||||||
-c | -check)
|
-c | -check)
|
||||||
checkOnly=true
|
checkOnly=true
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
-major)
|
-major)
|
||||||
echo ${WM_PROJECT_VERSION:-unknown}
|
echo ${WM_PROJECT_VERSION:-unknown}
|
||||||
@ -80,27 +79,26 @@ do
|
|||||||
;;
|
;;
|
||||||
-u | -update)
|
-u | -update)
|
||||||
update=true
|
update=true
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
-pkg | -package)
|
-pkg | -package)
|
||||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||||
# Mark empty as 'none', disallow '!' in string
|
# Mark empty as 'none', disallow '!' in string
|
||||||
package=$(echo "${2:-none}" | sed -e 's/!//g')
|
package=$(echo "${2:-none}" | sed -e 's/!//g')
|
||||||
shift 2
|
shift
|
||||||
;;
|
;;
|
||||||
-short)
|
-short)
|
||||||
shortOpt=true
|
shortOpt=true
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
-v | -version)
|
-v | -version)
|
||||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||||
version="$2"
|
version="$2"
|
||||||
shift 2
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown option/argument: '$*'"
|
usage "unknown option/argument: '$1'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -146,12 +144,12 @@ then
|
|||||||
# Specified a version - no error possible
|
# Specified a version - no error possible
|
||||||
rc=0
|
rc=0
|
||||||
else
|
else
|
||||||
# Get the head SHA1 when building under git
|
# Get the head SHA1 (first 12 chars) when building under git.
|
||||||
# if there are multiple values (eg, HEAD, origin/HEAD, ...)
|
# If there are multiple values (eg, HEAD, origin/HEAD, ...)
|
||||||
# only take the first one, which is 'HEAD'
|
# only take the first one, which is 'HEAD'
|
||||||
version=$(
|
version=$(
|
||||||
cd $WM_PROJECT_DIR 2>/dev/null && \
|
git --git-dir=$WM_PROJECT_DIR/.git show-ref --head HEAD 2>/dev/null |\
|
||||||
git show-ref --hash=12 --head HEAD 2>/dev/null | head -1
|
sed -ne '1s@^\(.\{12\}\).*$@\1@p'
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ -n "$version" ]
|
if [ -n "$version" ]
|
||||||
@ -205,10 +203,11 @@ then
|
|||||||
else
|
else
|
||||||
echo "version changed from previous build" 1>&2
|
echo "version changed from previous build" 1>&2
|
||||||
fi
|
fi
|
||||||
|
exit $rc
|
||||||
else
|
else
|
||||||
echo "no git description found" 1>&2
|
echo "no git description found" 1>&2
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
exit $rc
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user