Commit 848d87f4 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

writers: remove writer files

ParaView only uses visit for the readers.
parent e999ac1f
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.
*
*****************************************************************************/
// ************************************************************************* //
// avtBOVWriter.h //
// ************************************************************************* //
#ifndef AVT_BOV_WRITER_H
#define AVT_BOV_WRITER_H
#include <avtDatabaseWriter.h>
#include <string>
// ****************************************************************************
// Class: avtBOVWriter
//
// Purpose:
// A module that writes out BOV files.
//
// Programmer: Hank Childs
// Creation: September 11, 2004
//
// Modifications:
//
// Hank Childs, Tue Sep 27 10:21:36 PDT 2005
// Use virtual inheritance.
//
// Jeremy Meredith/Hank Childs, Tue Mar 27 17:03:47 EDT 2007
// Added numblocks to the OpenFile interface.
//
// ****************************************************************************
class
avtBOVWriter : public virtual avtDatabaseWriter
{
public:
avtBOVWriter() {;};
virtual ~avtBOVWriter() {;};
protected:
std::string stem;
int nblocks;
virtual void OpenFile(const std::string &, int);
virtual void WriteHeaders(const avtDatabaseMetaData *,
std::vector<std::string> &,
std::vector<std::string> &,
std::vector<std::string> &);
virtual void WriteChunk(vtkDataSet *, int);
virtual void CloseFile(void);
virtual bool SupportsTargetChunks(void) { return true; };
virtual bool SupportsTargetZones(void) { return true; };
virtual bool SupportsOutputZonal(void) { return true; };
// Doing material interface reconstruction does nothing for us.
// So we may as well report that we can already do it, so the MIR
// doesn't execute unnecessarily.
virtual bool CanHandleMaterials(void) { return true; };
};
#endif
/*****************************************************************************
*
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtCurve2DWriter.C //
// ************************************************************************* //
#include <avtCurve2DWriter.h>
#include <vector>
#include <vtkCellData.h>
#include <vtkDataArray.h>
#include <vtkPointData.h>
#include <vtkRectilinearGrid.h>
#include <avtDatabaseMetaData.h>
#include <StringHelpers.h>
using std::string;
using std::vector;
// ****************************************************************************
// Method: avtCurve2DWriter constructor
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 26 16:32:43 PST 2012
//
// ****************************************************************************
avtCurve2DWriter::avtCurve2DWriter(void)
{
nBlocks = 0;
}
// ****************************************************************************
// Method: avtCurve2DWriter::OpenFile
//
// Purpose:
// Does no actual work. Just records the stem name for the files.
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 26 16:32:43 PST 2012
//
// ****************************************************************************
void
avtCurve2DWriter::OpenFile(const string &stemname, int numblocks)
{
stem = stemname;
nBlocks = numblocks;
}
// ****************************************************************************
// Method: avtCurve2DWriter::WriteHeaders
//
// Purpose:
// Writes out a VisIt file to tie the Curve2D files together.
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 26 16:32:43 PST 2012
//
// ****************************************************************************
void
avtCurve2DWriter::WriteHeaders(const avtDatabaseMetaData *md,
vector<string> &scalars, vector<string> &vectors,
vector<string> &materials)
{
}
// ****************************************************************************
// Method: avtCurve2DWriter::SanitizeName
//
// Purpose:
// Sanitize the variable name.
//
// Arguments:
//
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Jul 27 11:14:10 PDT 2012
//
// Modifications:
//
// ****************************************************************************
std::string
avtCurve2DWriter::SanitizeName(const std::string &name) const
{
std::string retval(name);
if(name.find("operators/") != std::string::npos)
{
std::vector<std::string> tokens = StringHelpers::split(retval, '/');
if(!tokens.empty())
retval = tokens[tokens.size()-1];
}
return retval;
}
// ****************************************************************************
// Method: avtCurve2DWriter::WriteChunk
//
// Purpose:
// This writes out one chunk of an avtDataset.
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 26 16:32:43 PST 2012
//
// ****************************************************************************
void
avtCurve2DWriter::WriteChunk(vtkDataSet *ds, int chunk)
{
char name[1024];
if (nBlocks == 1)
SNPRINTF(name, 1024, "%s.curve", stem.c_str());
else
SNPRINTF(name, 1024, "%s.%03d.curve", stem.c_str(), chunk);
ofstream ofile(name);
if (ofile.fail())
EXCEPTION0(ImproperUseException);
avtDataAttributes &atts = GetInput()->GetInfo().GetAttributes();
if(atts.CycleIsAccurate())
ofile << "# CYCLE " << atts.GetCycle() << endl;
if(atts.TimeIsAccurate())
ofile << "# TIME " << atts.GetTime() << endl;
bool isCurve = false;
vtkRectilinearGrid *rgrid = vtkRectilinearGrid::SafeDownCast(ds);
int dims[3] = {0,0,0};
if(rgrid != NULL)
{
rgrid->GetDimensions(dims);
isCurve = (dims[1] <= 1 && dims[2] <= 1 && rgrid->GetXCoordinates() != NULL);
}
if(isCurve)
{
vtkDataArray *xc = rgrid->GetXCoordinates();
for(int i = 0; i < rgrid->GetPointData()->GetNumberOfArrays(); ++i)
{
vtkDataArray *arr = rgrid->GetPointData()->GetArray(i);
ofile << "# " << SanitizeName(arr->GetName()) << endl;
for(vtkIdType j = 0; j < arr->GetNumberOfTuples(); ++j)
ofile << xc->GetTuple1(j) << " " << arr->GetTuple1(j) << endl;
}
for(int i = 0; i < rgrid->GetCellData()->GetNumberOfArrays(); ++i)
{
vtkDataArray *arr = rgrid->GetCellData()->GetArray(i);
ofile << "# " << SanitizeName(arr->GetName()) << endl;
for(vtkIdType j = 0; j < arr->GetNumberOfTuples(); ++j)
ofile << j << " " << arr->GetTuple1(j) << endl;
}
}
else
{
for(int i = 0; i < ds->GetPointData()->GetNumberOfArrays(); ++i)
{
vtkDataArray *arr = ds->GetPointData()->GetArray(i);
ofile << "# " << SanitizeName(arr->GetName()) << endl;
for(vtkIdType j = 0; j < arr->GetNumberOfTuples(); ++j)
ofile << j << " " << arr->GetTuple1(j) << endl;
}
for(int i = 0; i < ds->GetCellData()->GetNumberOfArrays(); ++i)
{
vtkDataArray *arr = ds->GetCellData()->GetArray(i);
ofile << "# " << SanitizeName(arr->GetName()) << endl;
for(vtkIdType j = 0; j < arr->GetNumberOfTuples(); ++j)
ofile << j << " " << arr->GetTuple1(j) << endl;
}
}
}
// ****************************************************************************
// Method: avtCurve2DWriter::CloseFile
//
// Purpose:
// Closes the file. This does nothing in this case.
//
// Programmer: Brad Whitlock
// Creation: Thu Jul 26 16:32:43 PST 2012
//
// ****************************************************************************
void
avtCurve2DWriter::CloseFile(void)
{
// CLOSE FILES
}
/*****************************************************************************
*
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtCurve2DWriter.h //
// ************************************************************************* //
#ifndef AVT_CURVE2D_WRITER_H
#define AVT_CURVE2D_WRITER_H
#include <avtDatabaseWriter.h>
#include <string>
// ****************************************************************************
// Class: avtCurve2DWriter
//
// Purpose:
// A module that writes out Curve2D files.
//
// Programmer: whitlock2 -- generated by xml2avt
// Creation: Thu Jul 26 16:32:43 PST 2012
//
// ****************************************************************************
class
avtCurve2DWriter : public avtDatabaseWriter
{
public:
avtCurve2DWriter();
virtual ~avtCurve2DWriter() {;};
protected:
std::string stem;
int nBlocks;
virtual void OpenFile(const std::string &, int nb);
virtual void WriteHeaders(const avtDatabaseMetaData *,
std::vector<std::string> &,
std::vector<std::string> &,
std::vector<std::string> &);
virtual void WriteChunk(vtkDataSet *, int);
virtual void CloseFile(void);
std::string SanitizeName(const std::string &name) const;
};
#endif
/*****************************************************************************
*
* 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 aRAWe copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the aRAWe 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtRAWWriter.C //
// ************************************************************************* //
#include <avtRAWWriter.h>
#include <vtkCellArray.h>
#include <vtkDataArray.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkRectilinearGrid.h>
#include <vtkStructuredGrid.h>
#include <vtkUnstructuredGrid.h>
#ifndef MDSERVER
#include <vtkRectilinearGridFacelistFilter.h>
#include <vtkStructuredGridFacelistFilter.h>
#include <vtkUnstructuredGridFacelistFilter.h>
#endif
#include <avtCallback.h>
#include <avtDatabaseMetaData.h>
#include <snprintf.h>
#include <InvalidDBTypeException.h>
#include <DebugStream.h>
// ****************************************************************************
// Method: avtRAWWriter::avtRAWWriter
//
// Purpose:
// Constructor.
//
// Programmer: Brad Whitlock
// Creation: Sat Sep 29 16:05:37 PST 2007
//
// Modifications:
//
// ****************************************************************************
avtRAWWriter::avtRAWWriter()
{
file = 0;
nDomains = 0;
}
// ****************************************************************************
// Method: avtRAWWriter::~avtRAWWriter
//
// Purpose:
// Destructor.
//
// Programmer: Brad Whitlock
// Creation: Sat Sep 29 16:05:37 PST 2007
//
// Modifications:
//
// ****************************************************************************
avtRAWWriter::~avtRAWWriter()
{
CloseFile();
}
// ****************************************************************************
// Method: avtRAWWriter::OpenFile
//
// Purpose:
// Does no actual work. Just records the stem name for the files.
//
// Programmer: Brad Whitlock
// Creation: September 28, 2007
//
// Modifications:
//
// ****************************************************************************
void
avtRAWWriter::OpenFile(const std::string &stemname, int nb)
{
#ifndef MDSERVER
char filename[1024];
SNPRINTF(filename, 1024, "%s.raw", stemname.c_str());
file = fopen(filename, "wt");
if(file == 0)
{
EXCEPTION1(InvalidDBTypeException,
"The RAW writer could not open the output file.");
}
nDomains = nb;
#endif
}
// ****************************************************************************
// Method: avtRAWWriter::WriteHeaders
//
// Purpose:
// Writes out the RAW header file.
//
// Programmer: Brad Whitlock
// Creation: September 28, 2007
//
// Modifications:
//
// ****************************************************************************
void
avtRAWWriter::WriteHeaders(const avtDatabaseMetaData *md,
std::vector<std::string> &scalars, std::vector<std::string> &vectors,
std::vector<std::string> &materials)
{
#ifndef MDSERVER
bool warn = (scalars.size() > 0) || (vectors.size() > 0) || (materials.size() > 0);
if(warn)
{
avtCallback::IssueWarning("The RAW writer can only save the mesh. Any "
"scalars, vector, or materials will not be exported");
}
#endif
}
// ****************************************************************************
// Method: avtRAWWriter::WriteChunk
//
// Purpose:
// This writes out one chunk of an avtDataset.
//
// Programmer: Brad Whitlock
// Creation: September 28, 2007
//
// Modifications:
//
// ****************************************************************************
void
avtRAWWriter::WriteChunk(vtkDataSet *ds, int chunk)
{
#ifndef MDSERVER
const char *mName = "avtRAWWriter::WriteChunk: ";
// Convert non polydata into polydata faces.
vtkPolyData *pd = 0;
if(ds->GetDataObjectType() == VTK_POLY_DATA)
{
pd = (vtkPolyData *)ds;
pd->Register(NULL);
}
else if(ds->GetDataObjectType() == VTK_RECTILINEAR_GRID)
{
vtkRectilinearGridFacelistFilter *flf =
vtkRectilinearGridFacelistFilter::New();
flf->SetInputData((vtkRectilinearGrid *)ds);
flf->Update();
pd = flf->GetOutput();
pd->Register(NULL);
flf->Delete();
}
else if(ds->GetDataObjectType() == VTK_STRUCTURED_GRID)
{
vtkStructuredGridFacelistFilter *flf =
vtkStructuredGridFacelistFilter::New();
flf->SetInputData((vtkStructuredGrid *)ds);
flf->Update();