Commit 8e6bce9d authored by Ben Boeckel's avatar Ben Boeckel
Browse files

cgns: remove support

ParaView now has CGNS support itself.
parent ab58ccea
#
# Find the native CGNS includes and library
#
# CGNS_INCLUDE_DIR - where to find cgns.h, etc.
# CGNS_LIBRARIES - List of fully qualified libraries to link against when using CGNS.
# CGNS_FOUND - Do not attempt to use CGNS if "no" or undefined.
FIND_PATH(CGNS_INCLUDE_DIR cgnslib.h
/usr/local/include
/usr/include
)
FIND_LIBRARY(CGNS_LIBRARY cgns
/usr/local/lib
/usr/lib
)
SET( CGNS_FOUND "NO" )
IF(CGNS_INCLUDE_DIR)
IF(CGNS_LIBRARY)
SET( CGNS_LIBRARIES ${CGNS_LIBRARY} )
SET( CGNS_FOUND "YES" )
ENDIF(CGNS_LIBRARY)
ENDIF(CGNS_INCLUDE_DIR)
IF(CGNS_FIND_REQUIRED AND NOT CGNS_FOUND)
message(SEND_ERROR "Unable to find the requested CGNS libraries.")
ENDIF(CGNS_FIND_REQUIRED AND NOT CGNS_FOUND)
# handle the QUIETLY and REQUIRED arguments and set CGNS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CGNS DEFAULT_MSG CGNS_LIBRARY CGNS_INCLUDE_DIR)
MARK_AS_ADVANCED(
CGNS_INCLUDE_DIR
CGNS_LIBRARY
)
\ No newline at end of file
......@@ -582,12 +582,6 @@ if(SILO_FOUND)
set(HAVE_LIBSILO ${SILO_FOUND})
endif(SILO_FOUND)
# Setup CGNS
find_package(CGNS QUIET)
if(CGNS_FOUND)
set(HAVE_LIBCGNS ${CGNS_FOUND})
endif(CGNS_FOUND)
# Setup Mili
find_package(Mili QUIET)
if(Mili_FOUND)
......
SET(HAVE_LIBSILO "@HAVE_LIBSILO@")
SET(HAVE_LIBCGNS "@HAVE_LIBCGNS@")
SET(HAVE_LIBMILI "@HAVE_LIBMILI@")
#Setup the use file for VisIt
......
......@@ -32,7 +32,6 @@ This depends largely on how VisIt is built because databases only are built if t
* AUXFile
* BOV
* CEAucd
* CGNS
* Chombo
* Claw
* CMAT
......@@ -105,16 +104,6 @@ To enable Silo readers you will need to set:
SILO_LIBRARY
```
CGNS Support
---------------
To enable CGNS readers you will need to set:
```
VISIT_BUILD_READER_CGNS
CGNS_INCLUDE_DIR
CGNS_LIBRARY
```
Mili Support
---------------
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ****************************************************************************
// Function: PrintDataType
//
// Purpose:
// Prints the name of the data type to debug4.
//
// Arguments:
// dt : The data type.
//
// Programmer: Brad Whitlock
// Creation: Wed Aug 31 09:33:43 PDT 2005
//
// Modifications:
//
// ****************************************************************************
static void
PrintDataType(DataType_t dt)
{
switch(dt)
{
case DataTypeNull:
debug4 << "DataTypeNull";
break;
case DataTypeUserDefined:
debug4 << "DataTypeUserDefined";
break;
case Integer:
debug4 << "Integer";
break;
case RealSingle:
debug4 << "RealSingle";
break;
case RealDouble:
debug4 << "RealDouble";
break;
case Character:
debug4 << "Character";
break;
}
}
// ****************************************************************************
// Function: PrintElementType
//
// Purpose:
// Prints the name of the element type to debug4.
//
// Arguments:
// et : The element type.
//
// Programmer: Brad Whitlock
// Creation: Wed Aug 31 09:33:43 PDT 2005
//
// Modifications:
//
// ****************************************************************************
static void
PrintElementType(ElementType_t et)
{
if(et == ElementTypeNull) debug4 << "ElementTypeNull";
else if(et == ElementTypeUserDefined) debug4 << "ElementTypeUserDefined";
else if(et == NODE) debug4 << "NODE";
else if(et == BAR_2) debug4 << "BAR_2";
else if(et == BAR_3) debug4 << "BAR_3";
else if(et == TRI_3) debug4 << "TRI_3";
else if(et == TRI_6) debug4 << "TRI_6";
else if(et == QUAD_4) debug4 << "QUAD_4";
else if(et == QUAD_8) debug4 << "QUAD_8";
else if(et == QUAD_9) debug4 << "QUAD_9";
else if(et == TETRA_4) debug4 << "TETRA_4";
else if(et == TETRA_10) debug4 << "TETRA_10";
else if(et == PYRA_5) debug4 << "PYRA_5";
else if(et == PYRA_14) debug4 << "PYRA_14";
else if(et == PENTA_6) debug4 << "PENTA_6";
else if(et == PENTA_15) debug4 << "PENTA_15";
else if(et == PENTA_18) debug4 << "PENTA_18";
else if(et == HEXA_8) debug4 << "HEXA_8";
else if(et == HEXA_20) debug4 << "HEXA_20";
else if(et == HEXA_27) debug4 << "HEXA_27";
else if(et == MIXED) debug4 << "MIXED";
else if(et == NGON_n) debug4 << "NGON_n";
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#define CGNSUnitsStackMaxDepth 10
static const char *MassUnitsNames[] = {
"MassUnitsNull", "MassUnitsUserDefined",
"Kilogram", "Gram", "Slug", "PoundMass"
};
static const char *LengthUnitsNames[] = {
"LengthUnitsNull", "LengthUnitsUserDefined",
"Meter", "Centimeter", "Millimeter", "Foot", "Inch"
};
static const char *TimeUnitsNames[] = {
"TimeUnitsNull", "TimeUnitsUserDefined", "Second"
};
static const char *TemperatureUnitsNames[] = {
"TemperatureUnitsNull", "TemperatureUnitsUserDefined",
"Kelvin", "Celcius", "Rankine", "Fahrenheit"
};
static const char *AngleUnitsNames[] = {
"AngleUnitsNull", "AngleUnitsUserDefined", "Degree", "Radian"
};
// ****************************************************************************
// Class: CGNSUnitsStack
//
// Purpose:
// Keeps track of the units to use for fields as we traverse the CGNS
// tree.
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 1 17:11:13 PST 2005
//
// Modifications:
// Jeremy Meredith, Thu Aug 7 14:13:01 EDT 2008
// Added default case for switch.
//
// ****************************************************************************
class CGNSUnitsStack
{
public:
CGNSUnitsStack()
{
top = -1;
for(int i = 0; i < CGNSUnitsStackMaxDepth; ++i)
{
massU[i] = MassUnitsNull;
lengthU[i] = LengthUnitsNull;
timeU[i] = TimeUnitsNull;
tempU[i] = TemperatureUnitsNull;
angleU[i] = AngleUnitsNull;
}
}
~CGNSUnitsStack()
{
}
bool PushUnits(int fn, int base)
{
bool err = true;
if(cg_goto(fn, base, "end") == CG_OK)
err = ReadUnits();
return !err;
}
bool PushUnits(int fn, int base, int zone)
{
bool err = true;
if(cg_goto(fn, base, "Zone_t", zone, "end") == CG_OK)
err = ReadUnits();
return !err;
}
bool PushUnits(int fn, int base, int zone, int sol)
{
bool err = true;
if(cg_goto(fn, base, "Zone_t", zone, "FlowSolution_t",
sol, "end") == CG_OK)
err = ReadUnits();
return !err;
}
bool PushUnits(int fn, int base, int zone, int sol, int field)
{
bool err = true;
if(cg_goto(fn, base, "Zone_t", zone, "FlowSolution_t",
sol, "DataArray_t", field, "end") == CG_OK)
err = ReadUnits();
return !err;
}
bool PopUnits()
{
bool retval;
if((retval = top >= 0) == true)
--top;
return retval;
}
bool GetUnits(std::string &units)
{
bool err = true;
if(top >= 0)
{
int numexp = 0;
DataType_t dt;
if(cg_nexponents(&numexp) == CG_OK &&
cg_exponents_info(&dt) == CG_OK &&
numexp > 0)
{
stringVector N, D;
char tmp[100];
#define MY_ABS(V, Z) (((V)<(Z)) ? -(V) : (V))
#define CHAR_ABS(V, Z) (int)(((V)<(Z)) ? -(V) : (V))
#define POPULATE_UNITS(T, Z, ONE, ABS_FUNC, FORMATSTR) \
{\
T *arr = new T[numexp];\
if(cg_exponents_read((void *)arr) == CG_OK)\
{\
for(int idx = 0; idx < 5; ++idx)\
{\
const char *uname = 0;\
if(idx == 0)\
uname = MassUnitsNames[int(massU[top])];\
else if(idx == 1)\
uname = LengthUnitsNames[int(lengthU[top])];\
else if(idx == 2)\
uname = TimeUnitsNames[int(timeU[top])];\
else if(idx == 3)\
uname = TemperatureUnitsNames[int(tempU[top])];\
else\
uname = AngleUnitsNames[int(angleU[top])];\
if(arr[idx] != Z)\
{\
if(arr[idx] == ONE)\
SNPRINTF(tmp,100,"%s",uname);\
else\
SNPRINTF(tmp, 100, FORMATSTR, uname,\
ABS_FUNC(arr[idx], Z));\
char *c = strchr(tmp, '^');\
if(c != 0 && strcmp(c, "^1") == 0)\
c[0] = '\0';\
if(arr[idx] < Z)\
D.push_back(tmp);\
else\
N.push_back(tmp);\
}\
}\
}\
delete [] arr;\
}
switch(dt)
{
case RealSingle:
POPULATE_UNITS(float, 0.f, 1.f, MY_ABS, "%s^%g")
break;
case RealDouble:
POPULATE_UNITS(double, 0., 1., MY_ABS, "%s^%g")
break;
case Integer:
POPULATE_UNITS(int, 0, 1, MY_ABS, "%s^%d")
break;
case Character:
POPULATE_UNITS(char, 0, 1, CHAR_ABS, "%s^%d")
break;
default:
break;
}
// Create the numerator string.
std::string NS, DS;
if(N.size() == 1)
NS = N[0];
else if(N.size() > 1)
{
NS = "(";
for(size_t u = 0; u < N.size(); ++u)
{
if(u > 0)
NS += " * ";
NS += N[u];
}
NS += ")";
}
// Create the denominator string.
if(D.size() == 1)
DS = D[0];
else if(D.size() > 1)
{
DS = "(";
for(size_t u = 0; u < D.size(); ++u)
{
if(u > 0)
DS += " * ";
DS += D[u];
}
DS += ")";
}
// Assemble the units.
if(NS.size() == 0 && DS.size() == 0)
{
units = "";
}
else if(NS.size() == 0 && DS.size() > 0)
{
units = std::string("1 / ") + DS;
}
else if(NS.size() > 0 && DS.size() == 0)
{
units = NS;
}
else if(NS.size() > 1 && DS.size() > 1)
{
units = (NS + " / ") + DS;
}
err = false;
}
}
return !err;
}
protected:
bool ReadUnits()
{
bool err = true;
int i = top + 1;
if(i < CGNSUnitsStackMaxDepth &&
cg_units_read(&massU[i], &lengthU[i], &timeU[i],
&tempU[i], &angleU[i]) == CG_OK)
{
++top;
err = false;
}
return err;
}
int top;
MassUnits_t massU[CGNSUnitsStackMaxDepth];
LengthUnits_t lengthU[CGNSUnitsStackMaxDepth];
TimeUnits_t timeU[CGNSUnitsStackMaxDepth];
TemperatureUnits_t tempU[CGNSUnitsStackMaxDepth];
AngleUnits_t angleU[CGNSUnitsStackMaxDepth];
};
SET(SOURCES
avtCGNSFileFormat.C
)
#cgns
ADD_VISIT_READER(VisItCGNSReader "1.0"
VISIT_READER_TYPE "MTMD"
VISIT_READER_NAME "avtCGNSFileFormat"
SERVER_SOURCES ${SOURCES}
)
This diff is collapsed.
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ************************************************************************* //
// avtCGNSFileFormat.h //
// ************************************************************************* //
#ifndef AVT_CGNS_FILE_FORMAT_H
#define AVT_CGNS_FILE_FORMAT_H
#include <avtMTMDFileFormat.h>
#include <cgnslib.h>
#if CGNS_VERSION <= 3000
#define cgsize_t int
#else
#include <cgnstypes.h>
#endif
#include <vector>
#include <vectortypes.h>
#include <map>
// ****************************************************************************
// Class: avtCGNSFileFormat
//
// Purpose:
// Reads in CGNS files as a plugin to VisIt.
//
// Programmer: Brad Whitlock
// Creation: Tue Aug 30 16:08:44 PST 2005
//
// Modifications:
// Brad Whitlock, Tue Apr 15 10:20:10 PDT 2008
// Added methods that help us inspect the file contents.
//
// Brad Whitlock, Thu Oct 13 11:14:18 PDT 2011
// I added InitializeMaps so we can call it from GetMesh, GetVar to ensure
// the file grouping works.
//
// ****************************************************************************
class avtCGNSFileFormat : public avtMTMDFileFormat
{
public:
avtCGNSFileFormat(const char *);
virtual ~avtCGNSFileFormat();
//
// This is used to return unconvention data -- ranging from material
// information to information about block connectivity.
//
// virtual void *GetAuxiliaryData(const char *var, const char *type,
// int timestep, int domain,void *args,
// DestructorFunction &);
//
//
// If you know the times and cycle numbers, overload this function.
// Otherwise, VisIt will make up some reasonable ones for you.
//
virtual void GetCycles(std::vector<int> &);
virtual void GetTimes(std::vector<double> &);
virtual int GetNTimesteps(void);
virtual const char *GetType(void) { return "CGNS"; };
virtual void FreeUpResources(void);
virtual vtkDataSet *GetMesh(int, int, const char *);
virtual vtkDataArray *GetVar(int, int, const char *);
virtual vtkDataArray *GetVectorVar(int, int, const char *);