Commit 9687533b authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: improve direct use of cmake (issue #5)

- allows cmake override of the default output library directory,
  which is normally $FOAM_LIBBIN

ENH: additional debug verbosity

- extra information (in parallel) when debug level > 1, which can help
  when isolating problems.
parent 2f033c58
......@@ -56,12 +56,12 @@ else()
endif()
# Set output library destination to OpenFOAM library directory
set(LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN}
set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
CACHE INTERNAL
""
)
file(GLOB SOURCE_FILES
catalystCoprocess.C
catalystTools.C
......@@ -85,12 +85,12 @@ file(GLOB SOURCE_FILES
set(OPENFOAM_LIBRARIES
OpenFOAM
Pstream
finiteArea
finiteVolume
fileFormats
conversion
Pstream
meshTools
conversion
lagrangian
overset
)
......
#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
# Fail immediately if not using an out-of-source build
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR
"In-source builds are not supported. Please create a build directory "
"separate from the source directory")
endif()
project(catalyst)
# Set policy for CMP0002 needed for cmake > 3
cmake_policy(SET CMP0002 OLD)
#------------------------------------------------------------------------------
# Simple sanity checks
if (NOT EXISTS "$ENV{WM_PROJECT_DIR}")
message(FATAL_ERROR "WM_PROJECT_DIR not set")
endif()
if (EXISTS "$ENV{ParaView_DIR}")
message("Building with Paraview from $ENV{ParaView_DIR}")
find_package(ParaView REQUIRED COMPONENTS vtkPVPythonCatalyst)
if (NOT PARAVIEW_USE_MPI)
message(WARNING "==== Recommended to build using ParaView Catalyst with MPI ====")
endif()
else()
message (FATAL_ERROR "ParaView_DIR not set")
message(FATAL_ERROR "ParaView_DIR not set")
endif()
include(CMakeLists-Common.txt)
#------------------------------------------------------------------------------
# Installation locations (not much)
# - default install into FOAM_LIBBIN
if ((NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) OR
("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "default"))
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $ENV{FOAM_LIBBIN})
endif()
#-----------------------------------------------------------------------------
# All messages
message("================")
message("Using OpenFOAM = $ENV{WM_PROJECT_DIR}")
message("Using ParaView = $ENV{ParaView_DIR}")
if (NOT PARAVIEW_USE_MPI)
message(WARNING "==== Recommended to build using ParaView Catalyst with MPI ====")
endif()
message("install libdir = ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message("================")
#-----------------------------------------------------------------------------
include(CMakeLists-Common.txt)
#-----------------------------------------------------------------------------
......@@ -292,12 +292,24 @@ bool Foam::functionObjects::catalystFunctionObject::execute()
if (nChannels)
{
if (catalyst::coprocess::debug > 1)
{
Pout<< type() << ": query catalyst for " << nChannels
<< " channels" << nl;
}
nChannels = adaptor_().query(dataq);
}
if (catalyst::coprocess::debug)
if (catalyst::coprocess::debug > 1)
{
Pout<< type() << ": query catalyst for " << nChannels
<< " channels" << nl;
}
else if (catalyst::coprocess::debug)
{
Info<< type() << ": expecting data for " << nChannels << nl;
Info<< type() << ": expecting data for " << nChannels
<< " channels" << nl;
}
if (!nChannels)
......@@ -307,11 +319,22 @@ bool Foam::functionObjects::catalystFunctionObject::execute()
catalyst::outputChannels outputs;
if (catalyst::coprocess::debug > 1)
{
Pout<< type() << ": converting input" << nl;
}
for (auto& inp : inputs_)
{
inp.convert(dataq, outputs);
}
if (catalyst::coprocess::debug > 1)
{
Pout<< type() << ": sending data for" << outputs.size()
<< " outputs" << nl;
}
if (outputs.size())
{
Log << type() << ": send data" << nl;
......@@ -320,6 +343,12 @@ bool Foam::functionObjects::catalystFunctionObject::execute()
}
if (catalyst::coprocess::debug > 1)
{
Pout<< type() << ": done step" << nl;
}
// Avoid compiler complaint about unused variable.
// - manually restore old SIGFPE state
sigFpeHandling.restore();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment