diff --git a/applications/test/codeStream/codeStreamDict1 b/applications/test/codeStream/codeStreamDict1
index 8360f3ff4f..a552f5ec68 100644
--- a/applications/test/codeStream/codeStreamDict1
+++ b/applications/test/codeStream/codeStreamDict1
@@ -30,7 +30,8 @@ writeInterval #codeStream
codeOptions
#{
- -I$(LIB_SRC)/finiteVolume/lnInclude
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude
#};
localCode
diff --git a/applications/test/cstring/Make/files b/applications/test/cstring/Make/files
new file mode 100644
index 0000000000..eb7e33dc8b
--- /dev/null
+++ b/applications/test/cstring/Make/files
@@ -0,0 +1,3 @@
+Test-cstring.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-cstring
diff --git a/applications/test/cstring/Make/options b/applications/test/cstring/Make/options
new file mode 100644
index 0000000000..6a9e9810b3
--- /dev/null
+++ b/applications/test/cstring/Make/options
@@ -0,0 +1,2 @@
+/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
+/* EXE_LIBS = -lfiniteVolume */
diff --git a/applications/test/cstring/Test-cstring.C b/applications/test/cstring/Test-cstring.C
new file mode 100644
index 0000000000..fc4605cfa4
--- /dev/null
+++ b/applications/test/cstring/Test-cstring.C
@@ -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 .
+
+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 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 " << findEtcFile("controlDict") << nl
diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C
index 68ae82fa50..a5b217e87e 100644
--- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C
+++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C
@@ -151,7 +151,7 @@ void Foam::helpType::displayDoc
Info<< "Source file: " << classDirectory.c_str() << classFile << nl
<< endl;
- system(docBrowser);
+ Foam::system(docBrowser);
}
else
{
diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
index 3b336287f8..3b671c5b4c 100644
--- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
+++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -23,6 +23,8 @@ License
Application
foamInfoExec
+ To simplify parsing of the output, The normal banner information
+ is suppressed.
Group
grpMiscUtilities
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index 3ac7b6f766..51a3563f5e 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
@@ -1309,7 +1309,7 @@ int main(int argc, char *argv[])
+ "_"
+ procFile.name()
);
- if (system(cmd.c_str()) == -1)
+ if (Foam::system(cmd.c_str()) == -1)
{
WarningInFunction
<< "Could not execute command " << cmd << endl;
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt
index fbaedcfb30..2761e18f43 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt
@@ -47,11 +47,14 @@ QT4_WRAP_CPP(MOC_SRCS pqPVFoamReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPVFoamReaderPanel
- XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
+ XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
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(
PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
@@ -61,7 +64,7 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PVFoamReader.xml
)
-ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+ELSE()
ADD_PARAVIEW_PLUGIN(
PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
@@ -70,7 +73,7 @@ ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
GUI_SOURCES pqPVFoamReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
)
-ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+ENDIF()
TARGET_LINK_LIBRARIES(
PVFoamReader_SM
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml
index aef46449b3..5507293c67 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml
@@ -1,4 +1,5 @@
+
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options
index a78b301d97..a2bd6aa18d 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options
@@ -1,18 +1,12 @@
-/* Note: enable vtkPolyhedron when available */
-
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
- -I../../vtkPVReaders/lnInclude \
- -I../PVFoamReader \
-I$(ParaView_INCLUDE_DIR) \
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
- $(shell \
- test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
- echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
- )
+ -I../../vtkPVReaders/lnInclude \
+ -I../PVFoamReader
LIB_LIBS = \
-lmeshTools \
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C
index c4a52dbc98..1d7b732339 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -275,7 +275,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
// Polyhedral cell - use VTK_POLYHEDRON
const labelList& cFaces = mesh.cells()[cellI];
-#ifdef HAS_VTK_POLYHEDRON
vtkIdType nFaces = cFaces.size();
vtkIdType nLabels = nFaces;
@@ -320,33 +319,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
}
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> 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
{
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
index 2b28dafd1a..78832c5759 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
@@ -46,13 +46,16 @@ QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPVblockMeshReaderPanel
- XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
+ XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
XML_GROUP sources
)
-IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
- ADD_PARAVIEW_PLUGIN(
- PVblockMeshReader_SM "1.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(
+ PVblockMeshReader_SM "1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES ${IFACES}
@@ -60,16 +63,16 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PVblockMeshReader.xml
)
-ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
- ADD_PARAVIEW_PLUGIN(
- PVblockMeshReader_SM "1.0"
+ELSE()
+ ADD_PARAVIEW_PLUGIN(
+ PVblockMeshReader_SM "1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
)
-ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+ENDIF()
# Build the client-side plugin
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
index 18413ee300..9354a13525 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
@@ -1,4 +1,5 @@
+
diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
index 553f9f7f52..3e20143e1b 100644
--- a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
+++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -29,6 +29,8 @@ Group
Description
List times using timeSelector.
+ To simplify parsing of the output, the normal banner information
+ is suppressed.
Usage
diff --git a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
index 11a8becd5a..a8e20b188f 100644
--- a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
+++ b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -191,9 +191,15 @@ void writeRays
str << "l " << vertI-1 << ' ' << vertI << nl;
}
}
- string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
- Pout<< "cmd:" << cmd << endl;
- system(cmd);
+ str.flush();
+
+ DynamicList cmd(3);
+ cmd.append("objToVTK");
+ cmd.append(fName);
+ cmd.append(fName.lessExt() + ".vtk");
+
+ Pout<< "cmd: objToVTK " << fName.c_str() << endl;
+ Foam::system(cmd);
}
diff --git a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
index 3ea27c4f8b..0bc6fb5992 100644
--- a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
+++ b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -29,6 +29,8 @@ Group
Description
Miscellaneous information about surface meshes.
+ To simplify parsing of the output, the normal banner information
+ is suppressed.
Usage
- surfaceMeshInfo surfaceFile [OPTION]
diff --git a/bin/engridFoam b/bin/engridFoam
deleted file mode 100755
index 42acafdb65..0000000000
--- a/bin/engridFoam
+++ /dev/null
@@ -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 .
-#
-# Script
-# engridFoam
-#
-# Description
-# start engrid using the paraview libraries from OpenFOAM
-#
-#------------------------------------------------------------------------------
-usage() {
- exec 1>&2
- while [ "$#" -ge 1 ]; do echo "$1"; shift; done
- cat< specify alternative case directory, default is the cwd
-region specify alternative mesh region
-touch only create the file (eg, .blockMesh, .OpenFOAM, etc)
-touchAll create .blockMesh, .OpenFOAM files (and for all regions)
+ -vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension)
-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
exit 1
@@ -67,10 +68,9 @@ unset regionName optTouch
# already 2010-07)
export LC_ALL=C
-# Reader extension
+# Reader extension and plugin
extension=OpenFOAM
-
-requirePV=1
+plugin=PVFoamReader
# Parse options
while [ "$#" -gt 0 ]
@@ -81,11 +81,12 @@ do
;;
-block | -blockMesh)
extension=blockMesh
+ plugin=PVblockMeshReader
shift
;;
- -builtin)
+ -builtin | -vtk)
extension=foam
- requirePV=0
+ unset plugin
shift
;;
-case)
@@ -100,12 +101,12 @@ do
;;
-touch)
optTouch=true
- requirePV=0
+ unset plugin
shift
;;
-touchAll)
optTouch=all
- requirePV=0
+ unset plugin
shift
;;
--)
@@ -116,26 +117,34 @@ do
break # Stop here, treat this and balance as paraview options
;;
*)
- usage "unknown option/argument: '$*'"
+ usage "unknown option/argument: '$1'"
;;
esac
done
-# Check that reader module has been built
-if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPVFoamReader_SM.so ]
-then
- cat<< BUILDREADER
-
-FATAL ERROR: ParaView reader module libraries do not exist
+# If a reader module is needed, check that it exists
+[ -z "$plugin" -o -f $PV_PLUGIN_PATH/lib${plugin}_SM.so ] || {
+ cat<< BUILDREADER 1>&2
+ERROR: ParaView reader module library ($plugin) does not exist
Please build the reader module before continuing:
-cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
-./Allwclean
-./Allwmake
+
+ cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
+ ./Allwclean
+ ./Allwmake
BUILDREADER
- exit 1
-fi
+
+ # 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
+ fi
+}
+
# Check for --data=... argument
hasDataArg()
@@ -165,7 +174,7 @@ if [ -n "$regionName" ]
then
if [ ! -d constant/$regionName ]
then
- echo "FATAL ERROR: Region $regionName does not exist"
+ echo "FATAL ERROR: Region $regionName does not exist" 1>&2
exit 1
else
caseFile="$caseName{$regionName}.$extension"
@@ -179,10 +188,10 @@ all)
if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
then
touch "$caseName.blockMesh"
- echo "Created '$caseName.blockMesh'"
+ echo "Created '$caseName.blockMesh'" 1>&2
fi
touch "$caseName.$extension"
- echo "Created '$caseName.$extension'"
+ echo "Created '$caseName.$extension'" 1>&2
# Discover probable regions
for region in constant/*
do
@@ -190,14 +199,14 @@ all)
then
regionName=${region##*/}
touch "$caseName{$regionName}.$extension"
- echo "Created '$caseName{$regionName}.$extension'"
+ echo "Created '$caseName{$regionName}.$extension'" 1>&2
fi
done
exit 0
;;
true)
touch "$caseFile"
- echo "Created '$caseFile'"
+ echo "Created '$caseFile'" 1>&2
exit 0
;;
esac
@@ -222,14 +231,14 @@ else
warn="WARN file does not exist:"
case $extension in
blockMesh)
- blockMeshDictDir=system/blockMeshDict
+ blockMeshDict=system/blockMeshDict
if [ -f constant/polyMesh/blockMeshDict ]
then
- blockMeshDictDir=constant/polyMesh/blockMeshDict
+ blockMeshDict=constant/polyMesh/blockMeshDict
fi
for check in \
system/controlDict \
- $blockMeshDictDir \
+ $blockMeshDict \
;
do
[ -s "$parentDir/$check" ] || {
@@ -240,7 +249,7 @@ else
done
;;
- builtin | OpenFOAM)
+ OpenFOAM)
for check in \
system/controlDict \
$fvControls/fvSchemes \
@@ -268,7 +277,7 @@ else
[ -e $caseFile ] || {
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
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?
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index 24ef70ab9d..892f28fa37 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -208,7 +208,7 @@ unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
# Location of compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'"
endif
diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C
index 0b9a541d94..a9d19eecce 100644
--- a/src/OSspecific/POSIX/POSIX.C
+++ b/src/OSspecific/POSIX/POSIX.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -38,6 +38,8 @@ Description
#include "timer.H"
#include "IFstream.H"
#include "DynamicList.H"
+#include "CStringList.H"
+#include "SubList.H"
#include
#include
@@ -49,6 +51,7 @@ Description
#include
#include
#include
+#include
#include
#include
#include
@@ -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())
{
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))
{
return fileName::FILE;
}
+ else if (S_ISLNK(m))
+ {
+ return fileName::LINK;
+ }
else if (S_ISDIR(m))
{
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())
{
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())
{
return fileStatus.status().st_mtime;
@@ -676,7 +695,8 @@ Foam::fileNameList Foam::readDir
(
const fileName& directory,
const fileName::Type type,
- const bool filtergz
+ const bool filtergz,
+ const bool followLink
)
{
// Initial filename list size
@@ -717,10 +737,10 @@ Foam::fileNameList Foam::readDir
{
fileName fName(list->d_name);
- // ignore files begining with ., i.e. '.', '..' and '.*'
+ // ignore files beginning with ., i.e. '.', '..' and '.*'
if (fName.size() && fName[0] != '.')
{
- word fExt = fName.ext();
+ const word fExt = fName.ext();
if
(
@@ -736,7 +756,7 @@ Foam::fileNameList Foam::readDir
)
)
{
- if ((directory/fName).type() == type)
+ if ((directory/fName).type(followLink) == type)
{
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.
if (!exists(src))
@@ -777,7 +797,8 @@ bool Foam::cp(const fileName& src, const fileName& dest)
fileName destFile(dest);
// 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 (destFile.type() == fileName::DIRECTORY)
@@ -817,7 +838,23 @@ bool Foam::cp(const fileName& src, const fileName& dest)
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 (destFile.type() == fileName::DIRECTORY)
@@ -832,7 +869,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
}
// Copy files
- fileNameList contents = readDir(src, fileName::FILE, false);
+ fileNameList contents = readDir(src, fileName::FILE, false, followLink);
forAll(contents, i)
{
if (POSIX::debug)
@@ -843,11 +880,17 @@ bool Foam::cp(const fileName& src, const fileName& dest)
}
// File to file.
- cp(src/contents[i], destFile/contents[i]);
+ cp(src/contents[i], destFile/contents[i], followLink);
}
// Copy sub directories.
- fileNameList subdirs = readDir(src, fileName::DIRECTORY);
+ fileNameList subdirs = readDir
+ (
+ src,
+ fileName::DIRECTORY,
+ false,
+ followLink
+ );
forAll(subdirs, i)
{
if (POSIX::debug)
@@ -858,9 +901,13 @@ bool Foam::cp(const fileName& src, const fileName& dest)
}
// Dir to Dir.
- cp(src/subdirs[i], destFile);
+ cp(src/subdirs[i], destFile, followLink);
}
}
+ else
+ {
+ return false;
+ }
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)
{
@@ -914,7 +961,7 @@ bool Foam::mv(const fileName& src, const fileName& dst)
if
(
dst.type() == fileName::DIRECTORY
- && src.type() != fileName::DIRECTORY
+ && src.type(followLink) != fileName::DIRECTORY
)
{
const fileName dstName(dst/src.name());
@@ -1016,7 +1063,7 @@ bool Foam::rmDir(const fileName& directory)
{
fileName path = directory/fName;
- if (path.type() == fileName::DIRECTORY)
+ if (path.type(false) == fileName::DIRECTORY)
{
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)
{
- 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(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& 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(command, 0));
+ if (argc > 1)
+ {
+ args.reset(SubList(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);
}
diff --git a/src/OSspecific/POSIX/fileStat.C b/src/OSspecific/POSIX/fileStat.C
index 9826983d64..f40192f03b 100644
--- a/src/OSspecific/POSIX/fileStat.C
+++ b/src/OSspecific/POSIX/fileStat.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -29,6 +29,7 @@ License
#include
#include
+#include
// * * * * * * * * * * * * * * * * 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
volatile bool locIsValid = false;
@@ -47,13 +53,13 @@ Foam::fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
if (!timedOut(myTimer))
{
- if (::stat(fName.c_str(), &status_) != 0)
+ if (followLink)
{
- locIsValid = false;
+ locIsValid = (::stat(fName.c_str(), &status_) == 0);
}
else
{
- locIsValid = true;
+ locIsValid = (::lstat(fName.c_str(), &status_) == 0);
}
}
diff --git a/src/OSspecific/POSIX/fileStat.H b/src/OSspecific/POSIX/fileStat.H
index fe16d20470..634d0f59bd 100644
--- a/src/OSspecific/POSIX/fileStat.H
+++ b/src/OSspecific/POSIX/fileStat.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -25,7 +25,7 @@ Class
Foam::fileStat
Description
- Wrapper for stat() system call.
+ Wrapper for stat() and lstat() system calls.
Warning
on Linux (an maybe on others) a stat() of an nfs mounted (remote)
@@ -79,8 +79,21 @@ public:
//- Empty constructor
fileStat();
- //- Construct from components
- fileStat(const fileName& fName, const unsigned int maxTime=0);
+ //- Construct from components.
+ // \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
fileStat(Istream&);
@@ -96,7 +109,7 @@ public:
return status_;
}
- //- Did constructor fail
+ //- Was file-stat successful?
bool isValid() const
{
return isValid_;
diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
index 2480f2dc75..ada7d06b5b 100644
--- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
+++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -2535,16 +2535,6 @@ Foam::labelBits Foam::indexedOctree::findNode
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);
labelBits index = nod.subNodes_[octant];
diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C
index 17aad06a00..e2583450f3 100644
--- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C
+++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -30,6 +30,7 @@ License
#include "dlLibraryTable.H"
#include "PstreamReduceOps.H"
#include "OSspecific.H"
+#include "Ostream.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -42,6 +43,45 @@ namespace Foam
// * * * * * * * * * * * * * 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
(
const fileName& libPath,
@@ -165,8 +205,6 @@ void Foam::codedBase::unloadLibrary
}
-// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
-
void Foam::codedBase::createLibrary
(
dynamicCode& dynCode,
diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H
index 8ac7114ce6..1c03e71c09 100644
--- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H
+++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -43,6 +43,7 @@ namespace Foam
{
// Forward declaration of classes
+class Ostream;
class dynamicCode;
class dynamicCodeContext;
class dlLibraryTable;
@@ -83,14 +84,17 @@ class codedBase
void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
//- Disallow default bitwise copy construct
- codedBase(const codedBase&);
+ codedBase(const codedBase&) = delete;
//- Disallow default bitwise assignment
- void operator=(const codedBase&);
+ void operator=(const codedBase&) = delete;
protected:
+ //- Write code-dictionary contents
+ static void writeCodeDict(Ostream&, const dictionary&);
+
//- Update library as required
void updateLibrary
(
diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
index 04932fceea..19882241e3 100644
--- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
+++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -493,10 +493,17 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
bool Foam::dynamicCode::wmakeLibso() const
{
- const Foam::string wmakeCmd("wmake -s libso " + this->codePath());
- Info<< "Invoking " << wmakeCmd << endl;
+ DynamicList cmd(4);
+ 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;
}
diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C
index d9488544d5..14a62e0024 100644
--- a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C
+++ b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
+ \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -115,7 +115,7 @@ bool Foam::regIOobject::read
}
// Send to my downstairs neighbours
- forAll(myComm.below(), belowI)
+ forAllReverse(myComm.below(), belowI)
{
OPstream toBelow
(
diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C
index f56a8cf1e7..a840d79482 100644
--- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C
+++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -331,55 +331,7 @@ void Foam::codedFixedValuePointPatchField::write(Ostream& os) const
os.writeKeyword("redirectType") << redirectType_
<< token::END_STATEMENT << nl;
- if (dict_.found("codeInclude"))
- {
- 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;
- }
+ codedBase::writeCodeDict(os, dict_);
}
diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index 5d391afaaf..8f489589b0 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -1170,7 +1170,7 @@ void Foam::argList::displayDoc(bool source) const
Info<< "Show documentation: " << docBrowser.c_str() << endl;
- system(docBrowser);
+ Foam::system(docBrowser);
}
else
{
diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H
index d190f67045..e974192cec 100644
--- a/src/OpenFOAM/include/OSspecific.H
+++ b/src/OpenFOAM/include/OSspecific.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -37,6 +37,7 @@ SourceFiles
#define OSspecific_H
#include "fileNameList.H"
+#include "stringList.H"
#include
@@ -132,44 +133,60 @@ bool mkDir(const fileName&, mode_t=0777);
bool chMod(const fileName&, const mode_t);
//- 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
-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?
// 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?
-bool isDir(const fileName&);
+bool isDir(const fileName&, const bool followLink=true);
//- Does the name exist as a FILE in the file system?
// 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
-off_t fileSize(const fileName&);
+off_t fileSize(const fileName&, const bool followLink=true);
//- 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
fileNameList readDir
(
const fileName&,
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
-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.
bool ln(const fileName& src, const fileName& 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
// 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)
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);
+//- Execute the specified command with arguments.
+// Uses vfork/execvp internally
+int system(const UList& command);
+
//- Open a shared library. Return handle to library. Print error message
// if library cannot be loaded (check = true)
void* dlOpen(const fileName& lib, const bool check = true);
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
index adaec0eb8e..b8ada24283 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -1130,6 +1130,21 @@ Foam::tmp Foam::polyMesh::movePoints
geometricD_ = 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(*this);
meshObject::movePoints(*this);
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
index 5432ece12f..22a1e1b0f7 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
@@ -118,6 +118,12 @@ Foam::genericPolyPatch::~genericPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+const Foam::word& Foam::genericPolyPatch::actualType() const
+{
+ return actualTypeName_;
+}
+
+
void Foam::genericPolyPatch::write(Ostream& os) const
{
os.writeKeyword("type") << actualTypeName_ << token::END_STATEMENT << nl;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
index 6a22d8af6f..ac412bcae0 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -25,8 +25,9 @@ Class
Foam::genericPolyPatch
Description
- Substitute for unknown patches. Used for postprocessing when only
- basic polyPatch info is needed.
+ Substitute for unknown patches.
+ Used for postprocessing when only basic polyPatch info is needed
+ or if the real patch type is unavailable.
Note
Storage is not optimal. It stores all face centres and cells on all
@@ -57,7 +58,7 @@ class genericPolyPatch
{
// Private data
- word actualTypeName_;
+ const word actualTypeName_;
dictionary dict_;
public:
@@ -162,6 +163,9 @@ public:
// Member functions
+ //- Return the actual type
+ const word& actualType() const;
+
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index becb5db393..0dd888c737 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -48,9 +48,9 @@ Foam::fileName::fileName(const wordList& lst)
// * * * * * * * * * * * * * * * 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;
src < maxLen;
+ /*nil*/
)
{
char c = operator[](src++);
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H
index 288da061b8..e45844eaeb 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H
@@ -154,8 +154,9 @@ public:
// Interrogation
- //- Return the file type: FILE, DIRECTORY or UNDEFINED
- Type type() const;
+ //- Return the file type: FILE, DIRECTORY, UNDEFINED or
+ // LINK (only if followLink=false)
+ Type type(const bool followLink = true) const;
//- Return true if file name is absolute
bool isAbsolute() const;
diff --git a/src/OpenFOAM/primitives/strings/lists/CStringList.H b/src/OpenFOAM/primitives/strings/lists/CStringList.H
new file mode 100644
index 0000000000..c90ebcb337
--- /dev/null
+++ b/src/OpenFOAM/primitives/strings/lists/CStringList.H
@@ -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 .
+
+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
+ CStringList(const UList& 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
+ void reset(const UList& input);
+
+
+ // Other
+
+ //- Create a list from argc/argv parameters.
+ // A null pointer for argv is permissible when argc is zero.
+ template
+ static List 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
+ static inline List asList(const char * const argv[]);
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "CStringListI.H"
+
+#ifdef NoRepository
+# include "CStringListTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/lists/CStringListI.H b/src/OpenFOAM/primitives/strings/lists/CStringListI.H
new file mode 100644
index 0000000000..d91a9de646
--- /dev/null
+++ b/src/OpenFOAM/primitives/strings/lists/CStringListI.H
@@ -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 .
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * 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_;
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C b/src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C
new file mode 100644
index 0000000000..db0bb2e2ff
--- /dev/null
+++ b/src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C
@@ -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 .
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::CStringList::CStringList
+(
+ const UList& input
+)
+:
+ argc_(0),
+ len_(0),
+ argv_(0),
+ data_(0)
+{
+ reset(input);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+void Foam::CStringList::reset
+(
+ const UList& 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(input[argI]);
+
+ for
+ (
+ std::string::const_iterator iter = str.begin();
+ iter != str.end();
+ ++iter
+ )
+ {
+ *(ptr++) = *iter;
+ }
+ *(ptr++) = '\0';
+ }
+ }
+}
+
+
+template
+Foam::List
+Foam::CStringList::asList(int argc, const char * const argv[])
+{
+ List lst(argc);
+
+ for (int i=0; i < argc; ++i)
+ {
+ lst[i] = argv[i];
+ }
+
+ return lst;
+}
+
+
+template
+Foam::List
+Foam::CStringList::asList(const char * const argv[])
+{
+ return asList(count(argv), argv);
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
index cfd6945420..5771972313 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -329,55 +329,7 @@ void Foam::codedFixedValueFvPatchField::write(Ostream& os) const
os.writeKeyword("redirectType") << redirectType_
<< token::END_STATEMENT << nl;
- if (dict_.found("codeInclude"))
- {
- 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;
- }
+ codedBase::writeCodeDict(os, dict_);
}
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
index d1b53e144d..450aa8b9e6 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -341,55 +341,7 @@ void Foam::codedMixedFvPatchField::write(Ostream& os) const
os.writeKeyword("redirectType") << redirectType_
<< token::END_STATEMENT << nl;
- if (dict_.found("codeInclude"))
- {
- 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;
- }
+ codedBase::writeCodeDict(os, dict_);
}
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
index 874e071159..ccd25cc8c4 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
@@ -55,10 +55,11 @@ Description
jumpTable csvFile;
csvFileCoeffs
{
- hasHeaderLine 1;
+ nHeaderLine 1;
refColumn 0;
componentColumns 1(1);
separator ",";
+ mergeSeparators no;
fileName "$FOAM_CASE/constant/pressureVsU";
}
value uniform 0;
@@ -69,7 +70,7 @@ Description
the jump condition.
Note
- The underlying \c patchType should be set to \c cyclic
+ The underlying \c patchType should be set to \c cyclic
SeeAlso
Foam::Function1Types
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
index b0df476fe0..59646f3ad8 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
@@ -848,7 +848,7 @@ turbulentDFSEMInletFvPatchVectorField
eddy::debug = debug;
// Set UMean as patch area average value
- UMean_ = gSum(U_*patch().magSf())/gSum(patch().magSf());
+ UMean_ = gSum(U_*patch().magSf())/(gSum(patch().magSf()) + ROOTVSMALL);
}
diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
index 374aa5eac6..5237887644 100644
--- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
+++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
@@ -764,6 +764,13 @@ Foam::genericFvPatchField::gradientBoundaryCoeffs() const
}
+template
+const Foam::word& Foam::genericFvPatchField::actualType() const
+{
+ return actualTypeName_;
+}
+
+
template
void Foam::genericFvPatchField::write(Ostream& os) const
{
diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H
index ec3be385b4..88091b90bb 100644
--- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H
+++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H
@@ -59,7 +59,7 @@ class genericFvPatchField
{
// Private data
- word actualTypeName_;
+ const word actualTypeName_;
dictionary dict_;
HashPtrTable scalarFields_;
@@ -179,6 +179,9 @@ public:
tmp> gradientBoundaryCoeffs() const;
+ //- Return the actual type
+ const word& actualType() const;
+
//- Write
virtual void write(Ostream&) const;
};
diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
index 8f4970855f..c1d1dd42ec 100644
--- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
+++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -557,6 +557,13 @@ void Foam::genericPointPatchField::rmap
}
+template
+const Foam::word& Foam::genericPointPatchField::actualType() const
+{
+ return actualTypeName_;
+}
+
+
template
void Foam::genericPointPatchField::write(Ostream& os) const
{
diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H
index e68ce631b1..33880fd723 100644
--- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H
+++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -55,7 +55,7 @@ class genericPointPatchField
{
// Private data
- word actualTypeName_;
+ const word actualTypeName_;
dictionary dict_;
HashPtrTable scalarFields_;
@@ -151,6 +151,9 @@ public:
);
+ //- Return the actual type
+ const word& actualType() const;
+
//- Write
virtual void write(Ostream&) const;
};
diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H
index 6560a084a0..cdaee88232 100644
--- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H
+++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H
@@ -25,12 +25,17 @@ Class
Foam::EulerCoordinateRotation
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
http://mathworld.wolfram.com/EulerAngles.html
+ and
+ https://en.wikipedia.org/wiki/Euler_angles#Conventions
+
Note, however, that it is the reverse transformation
(local->global) that is defined here.
diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C
index 40f60a7c86..9d163da19d 100644
--- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C
+++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C
@@ -43,6 +43,7 @@ License
#include "vtkSphereSource.h"
#include "vtkTextActor.h"
#include "vtkTextProperty.h"
+#include "vtkCellDataToPointData.h"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@@ -151,6 +152,9 @@ void Foam::fieldVisualisationBase::addScalarBar
const vector textColour = colours_["text"]->value(position);
// 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 titleActor =
vtkSmartPointer::New();
sbar->SetTitle(" ");
@@ -170,19 +174,18 @@ void Foam::fieldVisualisationBase::addScalarBar
titleActor->GetPositionCoordinate()->
SetCoordinateSystemToNormalizedViewport();
-/*
- sbar->SetTitle(scalarBar_.title_.c_str());
- sbar->GetTitleTextProperty()->SetColor
- (
- textColour[0],
- textColour[1],
- textColour[2]
- );
- sbar->GetTitleTextProperty()->SetFontSize(scalarBar_.fontSize_);
- sbar->GetTitleTextProperty()->ShadowOff();
- sbar->GetTitleTextProperty()->BoldOn();
- sbar->GetTitleTextProperty()->ItalicOff();
-*/
+ // How to use the standard scalar bar text
+ // sbar->SetTitle(scalarBar_.title_.c_str());
+ // sbar->GetTitleTextProperty()->SetColor
+ // (
+ // textColour[0],
+ // textColour[1],
+ // textColour[2]
+ // );
+ // sbar->GetTitleTextProperty()->SetFontSize(scalarBar_.fontSize_);
+ // sbar->GetTitleTextProperty()->ShadowOff();
+ // sbar->GetTitleTextProperty()->BoldOn();
+ // sbar->GetTitleTextProperty()->ItalicOff();
sbar->GetLabelTextProperty()->SetColor
(
@@ -217,8 +220,8 @@ void Foam::fieldVisualisationBase::addScalarBar
sbar->SetWidth(0.75);
sbar->SetHeight(0.07);
sbar->SetBarRatio(0.5);
-// sbar->SetHeight(0.1);
-// sbar->SetTitleRatio(0.01);
+ // sbar->SetHeight(0.1);
+ // sbar->SetTitleRatio(0.01);
sbar->SetTextPositionToPrecedeScalarBar();
}
@@ -228,10 +231,10 @@ void Foam::fieldVisualisationBase::addScalarBar
scalarBar_.position_.second() + sbar->GetHeight()
);
-// sbar->DrawFrameOn();
-// sbar->DrawBackgroundOn();
-// sbar->UseOpacityOff();
-// sbar->VisibilityOff();
+ // sbar->DrawFrameOn();
+ // sbar->DrawBackgroundOn();
+ // sbar->UseOpacityOff();
+ // sbar->VisibilityOff();
sbar->VisibilityOn();
renderer->AddActor(sbar);
@@ -268,25 +271,7 @@ void Foam::fieldVisualisationBase::setField
// Configure the mapper
mapper->SelectColorArray(colourFieldName.c_str());
mapper->SetScalarRange(range_.first(), range_.second());
-
- // 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->SetScalarModeToDefault(); // try points, then cells
mapper->SetColorModeToMapScalars();
mapper->SetLookupTable(lut);
mapper->ScalarVisibilityOn();
@@ -322,9 +307,37 @@ void Foam::fieldVisualisationBase::addGlyphs
glyph->ScalingOn();
bool ok = true;
- label nComponents =
- data->GetPointData()->GetArray(scaleFieldName.c_str())
- ->GetNumberOfComponents();
+ // Determine whether we have scalar or vector data
+ label nComponents = -1;
+ const char* scaleFieldNameChar = scaleFieldName.c_str();
+ if (data->GetPointData()->HasArray(scaleFieldNameChar) == 1)
+ {
+ nComponents =
+ data->GetPointData()->GetArray(scaleFieldNameChar)
+ ->GetNumberOfComponents();
+ }
+ else if (data->GetCellData()->HasArray(scaleFieldNameChar) == 1)
+ {
+ // Need to convert cell data to point data
+ vtkSmartPointer cellToPoint =
+ vtkSmartPointer::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)
{
@@ -332,9 +345,10 @@ void Foam::fieldVisualisationBase::addGlyphs
vtkSmartPointer::New();
sphere->SetCenter(0, 0, 0);
sphere->SetRadius(0.5);
-// Setting higher resolution slows the rendering significantly
-// sphere->SetPhiResolution(20);
-// sphere->SetThetaResolution(20);
+
+ // Setting higher resolution slows the rendering significantly
+ // sphere->SetPhiResolution(20);
+ // sphere->SetThetaResolution(20);
glyph->SetSourceConnection(sphere->GetOutputPort());
@@ -342,18 +356,18 @@ void Foam::fieldVisualisationBase::addGlyphs
{
double range[2];
-// Can use values to find range
-// vtkDataArray* values =
-// data->GetPointData()->GetScalars(scaleFieldName.c_str());
-// values->GetRange(range);
+ // Can use values to find range
+ // vtkDataArray* values =
+ // data->GetPointData()->GetScalars(scaleFieldNameChar);
+ // values->GetRange(range);
- // set range accoding to user-supplied limits
+ // Set range accoding to user-supplied limits
range[0] = range_.first();
range[1] = range_.second();
glyph->ClampingOn();
glyph->SetRange(range);
- // if range[0] != min(value), maxGlyphLength behaviour will not
+ // If range[0] != min(value), maxGlyphLength behaviour will not
// be correct...
glyph->SetScaleFactor(maxGlyphLength);
}
@@ -370,7 +384,7 @@ void Foam::fieldVisualisationBase::addGlyphs
0,
0,
vtkDataObject::FIELD_ASSOCIATION_POINTS,
- scaleFieldName.c_str()
+ scaleFieldNameChar
);
}
else if (nComponents == 3)
@@ -388,21 +402,21 @@ void Foam::fieldVisualisationBase::addGlyphs
if (maxGlyphLength > 0)
{
vtkDataArray* values =
- data->GetPointData()->GetVectors(scaleFieldName.c_str());
+ data->GetPointData()->GetVectors(scaleFieldNameChar);
+
double range[6];
values->GetRange(range);
-/*
// Attempt to set range for vectors...
- scalar x0 = sqrt(sqr(range_.first())/3.0);
- scalar x1 = sqrt(sqr(range_.second())/3.0);
- range[0] = x0;
- range[1] = x0;
- range[2] = x0;
- range[3] = x1;
- range[4] = x1;
- range[5] = x1;
-*/
+ // scalar x0 = sqrt(sqr(range_.first())/3.0);
+ // scalar x1 = sqrt(sqr(range_.second())/3.0);
+ // range[0] = x0;
+ // range[1] = x0;
+ // range[2] = x0;
+ // range[3] = x1;
+ // range[4] = x1;
+ // range[5] = x1;
+
glyph->ClampingOn();
glyph->SetRange(range);
glyph->SetScaleFactor(maxGlyphLength);
@@ -421,7 +435,7 @@ void Foam::fieldVisualisationBase::addGlyphs
0,
0,
vtkDataObject::FIELD_ASSOCIATION_POINTS,
- scaleFieldName.c_str()
+ scaleFieldNameChar
);
}
else
diff --git a/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C b/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C
index 46d44f65a3..66f11a9038 100644
--- a/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C
+++ b/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -770,7 +770,7 @@ void Foam::externalCoupledFunctionObject::initialise()
// Wait for initial data to be made available
wait();
- // Eead data passed back from external source
+ // Read data passed back from external source
readData();
}
diff --git a/src/postProcessing/functionObjects/systemCall/controlDict b/src/postProcessing/functionObjects/systemCall/controlDict
index ff192e197c..124c5406b9 100644
--- a/src/postProcessing/functionObjects/systemCall/controlDict
+++ b/src/postProcessing/functionObjects/systemCall/controlDict
@@ -62,14 +62,15 @@ functions
// called at the end of the run
endCalls
(
- "echo \*\*\* writing .bashrc \*\*\*"
- "cat ~/.bashrc"
- "echo \*\*\* done \*\*\*"
+ // Note: single quotes to avoid shell expansion
+ "echo '*** listing ~/.bashrc ***'"
+ "cat ~/.bashrc; echo '*** done ***'"
);
- // called every ouput time
+ // called every output time
writeCalls
(
+ // Note: can also backslash to escape shell meta-characters
"echo \*\*\* writing data \*\*\*"
);
}
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H b/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H
index 80c2ebe119..9343616cfe 100644
--- a/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H
@@ -122,6 +122,13 @@ class mapFieldsFO
//- Helper function to create the mesh-to-mesh interpolation
void createInterpolation(const dictionary& dict);
+ //- Helper function to evaluate constraint patches after mapping
+ template
+ void evaluateConstraintTypes
+ (
+ GeometricField& fld
+ ) const;
+
//- Helper function to interpolate and write the fied
template
bool writeFieldType() const;
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C
index de269ea867..dd1086049b 100644
--- a/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C
@@ -25,6 +25,91 @@ License
#include "meshToMesh.H"
+template
+void Foam::mapFieldsFO::evaluateConstraintTypes
+(
+ GeometricField& fld
+) const
+{
+ typename GeometricField::
+ GeometricBoundaryField& fldBf = fld.boundaryField();
+
+ if
+ (
+ Pstream::defaultCommsType == Pstream::blocking
+ || Pstream::defaultCommsType == Pstream::nonBlocking
+ )
+ {
+ label nReq = Pstream::nRequests();
+
+ forAll(fldBf, patchi)
+ {
+ fvPatchField& 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& 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& 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
bool Foam::mapFieldsFO::writeFieldType() const
{
@@ -53,6 +138,9 @@ bool Foam::mapFieldsFO::writeFieldType() const
if (log_) Info<< ": interpolated";
FieldType fieldMapRegion(mapRegionIO, tfieldMapRegion);
+
+ evaluateConstraintTypes(fieldMapRegion);
+
fieldMapRegion.write();
if (log_) Info<< " and written" << nl;
diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C
index 6188b29468..d162635f34 100644
--- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C
+++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -62,9 +62,15 @@ void Foam::faceShading::writeRays
vertI++;
str << "l " << vertI-1 << ' ' << vertI << nl;
}
- string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
- Pout<< "cmd:" << cmd << endl;
- system(cmd);
+ str.flush();
+
+ DynamicList cmd(3);
+ cmd.append("objToVTK");
+ cmd.append(fName);
+ cmd.append(fName.lessExt() + ".vtk");
+
+ Pout<< "cmd: objToVTK " << fName.c_str() << endl;
+ Foam::system(cmd);
}
diff --git a/wmake/rules/General/general b/wmake/rules/General/general
index b3f20b48e8..4ebb18312d 100644
--- a/wmake/rules/General/general
+++ b/wmake/rules/General/general
@@ -1,4 +1,5 @@
#-------------------------------*- makefile -*---------------------------------
+WM_VERSION = OPENFOAM_PLUS=1606
AR = ar
ARFLAGS = cr
@@ -6,7 +7,7 @@ RANLIB = ranlib
CPP = cpp
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)
GINC =
GLIBS = -lm
diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
index c23e63d33e..81195a6bac 100755
--- a/wmake/wmakePrintBuild
+++ b/wmake/wmakePrintBuild
@@ -3,8 +3,8 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
-# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
-# \\/ M anipulation |
+# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@@ -72,7 +72,6 @@ do
;;
-c | -check)
checkOnly=true
- shift
;;
-major)
echo ${WM_PROJECT_VERSION:-unknown}
@@ -80,27 +79,26 @@ do
;;
-u | -update)
update=true
- shift
;;
-pkg | -package)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
# Mark empty as 'none', disallow '!' in string
package=$(echo "${2:-none}" | sed -e 's/!//g')
- shift 2
+ shift
;;
-short)
shortOpt=true
- shift
;;
-v | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
version="$2"
- shift 2
+ shift
;;
*)
- usage "unknown option/argument: '$*'"
+ usage "unknown option/argument: '$1'"
;;
esac
+ shift
done
#------------------------------------------------------------------------------
@@ -146,12 +144,12 @@ then
# Specified a version - no error possible
rc=0
else
- # Get the head SHA1 when building under git
- # if there are multiple values (eg, HEAD, origin/HEAD, ...)
+ # Get the head SHA1 (first 12 chars) when building under git.
+ # If there are multiple values (eg, HEAD, origin/HEAD, ...)
# only take the first one, which is 'HEAD'
version=$(
- cd $WM_PROJECT_DIR 2>/dev/null && \
- git show-ref --hash=12 --head HEAD 2>/dev/null | head -1
+ git --git-dir=$WM_PROJECT_DIR/.git show-ref --head HEAD 2>/dev/null |\
+ sed -ne '1s@^\(.\{12\}\).*$@\1@p'
)
if [ -n "$version" ]
@@ -205,10 +203,11 @@ then
else
echo "version changed from previous build" 1>&2
fi
+ exit $rc
else
echo "no git description found" 1>&2
+ exit 0
fi
- exit $rc
fi