Commit 6539c1d3 authored by Andrew Heather's avatar Andrew Heather
Browse files

Merge branch 'develop'

parents 143800ab b2722eb6
......@@ -30,7 +30,8 @@ writeInterval #codeStream
codeOptions
#{
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
#};
localCode
......
Test-cstring.C
EXE = $(FOAM_USER_APPBIN)/Test-cstring
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
/* EXE_LIBS = -lfiniteVolume */
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -34,6 +34,7 @@ Description
#include "IOobject.H"
#include "IOstreams.H"
#include "OSspecific.H"
#include "POSIX.H"
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
Info<< "\n\nfindEtcFile tests:" << nl
<< " controlDict => " << findEtcFile("controlDict") << nl
......
......@@ -151,7 +151,7 @@ void Foam::helpType::displayDoc
Info<< "Source file: " << classDirectory.c_str() << classFile << nl
<< endl;
system(docBrowser);
Foam::system(docBrowser);
}
else
{
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
<ParaViewReaders>
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
<Reader name="PVFoamReader"
extensions="OpenFOAM"
file_description="OpenFOAM Reader">
......
/* 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 \
......
......@@ -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<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
{
......
......@@ -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
......
<ParaViewReaders>
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
<Reader name="PVblockMeshReader"
extensions="blockMesh"
file_description="OpenFOAM blockMesh reader">
......
......@@ -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
......
......@@ -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<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
\\ / 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]
......
#!/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 $@ &"
#------------------------------------------------------------------------------
......@@ -4,7 +4,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.
......@@ -40,17 +40,18 @@ usage() {
Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
options:
-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
-region <name> 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</