Commit 765e7b75 authored by Robert Maynard's avatar Robert Maynard

Moving over more readers to the bridge.

parent 984adad8
......@@ -47,7 +47,7 @@ ${VISIT_SOURCE_DIR}/visit_vtk/lightweight
${VTK_INCLUDE_DIRS}
)
ADD_LIBRARY(vtkVisItAVTAlgorithms ${Kit_SRCS})
TARGET_LINK_LIBRARIES(vtkVisItAVTAlgorithms visitcommon avtdatabase_ser avtpipeline_ser visit_vtk)
TARGET_LINK_LIBRARIES(vtkVisItAVTAlgorithms visitcommon avtdatabase_ser avtpipeline_ser visit_vtk avtivp)
#Install
#-------------------------------------------------------------------------------------------------
......
......@@ -270,6 +270,7 @@ set(VISITBRIDGE_USE_FILE
${AVT_DBATTS_SOURCE_DIR}/SIL
${VISIT_SOURCE_DIR}/avt/Math
${VISIT_SOURCE_DIR}/avt/VisWindow/VisWindow
${VISIT_SOURCE_DIR}/avt/IVP
${AVT_PIPELINE_SOURCE_DIR}/AbstractFilters
${AVT_PIPELINE_SOURCE_DIR}/Data
${AVT_PIPELINE_SOURCE_DIR}/Pipeline
......
......@@ -42,3 +42,5 @@ ADD_SUBDIRECTORY(Math)
ADD_SUBDIRECTORY(DBAtts)
ADD_SUBDIRECTORY(Pipeline)
ADD_SUBDIRECTORY(Database)
ADD_SUBDIRECTORY(IVP)
#*****************************************************************************
#
# Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
# Produced at the Lawrence Livermore National Laboratory
# LLNL-CODE-400142
# 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.
#
# Modifications:
#
#****************************************************************************/
SET(AVTIVP_SOURCES
avtIVPAdamsBashforth.C
avtIVPDopri5.C
avtIVPSolver.C
avtIVPM3DC1Field.C
avtIVPM3DC1Integrator.C
avtIVPVTKField.C
avtIVPVTKTimeVaryingField.C
avtStreamline.C
MemStream.C
)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${VISIT_COMMON_INCLUDES}
${VISIT_SOURCE_DIR}/avt/Math
${VISIT_SOURCE_DIR}/visit_vtk/full
${VTK_INCLUDE_DIRS}
)
# Add link directories
LINK_DIRECTORIES(${LIBRARY_OUTPUT_DIRECTORY} ${VTK_LIBRARY_DIRS})
ADD_LIBRARY(avtivp ${AVTIVP_SOURCES})
TARGET_LINK_LIBRARIES(avtivp avtmath visitcommon visit_vtk vtkCommon vtkFiltering)
VISIT_INSTALL_TARGETS(avtivp)
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// MemStream.C //
// ************************************************************************* //
#include <MemStream.h>
// ****************************************************************************
// Method: MemStream constructor
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
MemStream::MemStream( size_t sz0 )
{
pos = 0;
len = 0;
maxLen = len;
data = NULL;
CheckSize(sz0);
}
// ****************************************************************************
// Method: MemStream constructor
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
MemStream::MemStream( size_t sz, const unsigned char *buff )
{
pos = 0;
len = sz;
maxLen = len;
data = new unsigned char[len];
memcpy( data, buff, len );
}
// ****************************************************************************
// Method: MemStream destructor
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
MemStream::~MemStream()
{
if ( data )
delete [] data;
pos = 0;
len = 0;
maxLen = 0;
data = NULL;
}
// ****************************************************************************
// Method: MemStream::CheckSize
//
// Purpose:
// Checks to see if the current size is sufficent and changes the size
// of the underlying array if not.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
void
MemStream::CheckSize( size_t sz )
{
size_t reqLen = pos+sz;
if ( reqLen > maxLen )
{
size_t newLen = 2*maxLen; // double current size.
if ( newLen < reqLen )
newLen = reqLen;
unsigned char *newData = new unsigned char[newLen];
if ( data )
{
memcpy( newData, data, len ); // copy existing data to new buffer.
delete [] data;
}
data = newData;
maxLen = newLen;
}
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// MemStream.h //
// ************************************************************************* //
#ifndef MEM_STREAM_H
#define MEM_STREAM_H
#include <ivp_exports.h>
#include <vector>
#include <list>
#include <cstring>
#include <avtVector.h>
#include <vector>
#include <DebugStream.h>
// ****************************************************************************
// Struct: MemStream
//
// Purpose:
// A helper class for serializing a streamline.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// Modifications:
//
// Dave Pugmire, Tue Dec 1 11:50:18 EST 2009
// Switch from avtVec to avtVector.
//
// ****************************************************************************
struct IVP_API MemStream
{
public:
enum Mode {
READ = 0,
WRITE
};
MemStream( size_t sz0= 32 );
MemStream( size_t sz, const unsigned char *buff );
~MemStream();
void rewind() { pos = 0; }
size_t buffLen() const { return len; }
unsigned char *buff() const { return data; }
// General read/write routines.
template <typename T> void io( Mode mode, T *pt, size_t num )
{ return (mode == READ ? read(pt,num) : write(pt,num)); }
template <typename T> void io( Mode mode, T& t )
{ size_t s=1; io( mode, &t, s ); }
template <typename T> void io( Mode mode, std::vector<T> &v )
{ return (mode == READ ? read(v) : write(v)); }
void io( Mode mode, avtVector &v )
{ return (mode == READ ? read(v) : write(v)); }
//template <typename T> void io( Mode mode, std::list<T*> &l )
// { return (mode == READ ? read(l) : write(l)); }
//Read from buffer.
template <typename T> void read( T& t ) { read( &t, 1 ); }
template <typename T> void read( T *pt, const size_t &num )
{
size_t nBytes = sizeof(T)*num;
memcpy( pt, &data[pos], nBytes );
pos += nBytes;
}
void read( avtVector &v )
{
read(v.x);
read(v.y);
read(v.z);
}
template <typename T> void read( std::vector<T> &v )
{
size_t sz;
read(sz);
v.resize(sz);
for ( size_t i = 0; i < sz; i++ )
read(v[i]);
}
/*
template <typename T> void read( std::list<T*> &l )
{
size_t sz;
read(sz);
debug1 << "read( list sz= "<<sz << " );\n";
for ( size_t i = 0; i < sz; i++ )
{
T *x = new T;
read(*x);
debug1 << "x sz= "<<sizeof(x)<<endl;
l.push_back(x);
}
}
*/
//Write to buffer.
template <typename T> void write( const T& t ) { write( &t, 1 ); }
template <typename T> void write( const T *const pt, size_t num )
{
size_t nBytes = sizeof(T)*num;
CheckSize( nBytes );
memcpy(&data[pos], pt, nBytes );
pos += nBytes;
if ( pos > len )
len = pos;
}
template <typename T> void write( const std::vector<T> &v )
{
write( v.size() );
for ( size_t i = 0; i < v.size(); i++ )
write( v[i] );
}
void write( const avtVector &v )
{
write(v.x);
write(v.y);
write(v.z);
}
/*
template <typename T> void write( const std::list<T*> &l )
{
debug1 << "write( list sz= "<<l.size() << " sizeof = " << sizeof(T)<<" );\n";
write( l.size() );
typename list<T*>::const_iterator pos;
for ( pos = l.begin(); pos != l.end(); pos++ )
{
T &x = *(*pos);
write( x );
debug1 << "write( pos sz= " << sizeof(x)<<")\n";
}
}
*/
protected:
void CheckSize( size_t sz );
// data members
unsigned char *data;
size_t len, maxLen, pos;
};
#endif
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtIVPAdamsBashforth.C //
// ************************************************************************* //
#include <avtIVPAdamsBashforth.h>
#include <avtIVPStateHelper.h>
#include <DebugStream.h>
#include <limits>
#include <cmath>
static const double epsilon = std::numeric_limits<double>::epsilon();
// constants for the A-B scheme.
static const double bashforth[] = { 1901.0, -2774.0, 2616.0, -1274.0, 251.0 };
static const double divisor = 1.0 / 720.0;
#define NSTEPS sizeof(bashforth)/sizeof(bashforth[0])
// helper function
// returns a with the same sign as b
static inline double sign( const double& a, const double& b )
{
return (b > 0.0) ? std::abs(a) : -std::abs(a);
}
// ****************************************************************************
// Method: avtIVPAdamsBashforth constructor
//
// Programmer: Dave Pugmire
// Creation: August 5, 2008
//
// Modifications:
// Dave Pugmire, Fri Aug 8 16:05:34 EDT 2008
// Improved version of A-B solver that builds function history from
// initial RK4 steps.
//
// Dave Pugmire, Tue Aug 19, 17:38:03 EDT 2008
// Changed how distanced based termination is computed.
//
// Dave Pugmire, Wed Aug 20, 12:54:44 EDT 2008
// Add a tolerance and counter for handling stiffness detection.
//
// Dave Pugmire, Tue Feb 24 14:35:38 EST 2009
// Remove moulton corrector code, use RK4 at startup, terminate on numSteps.
//
// ****************************************************************************
avtIVPAdamsBashforth::avtIVPAdamsBashforth()
{
// set (somewhat) reasonable defaults
tol = 1e-8;
h = 1e-5;
t = 0.0;
d = 0.0;
numStep = 0;
initialized = 0;
degenerate_iterations = 0;
stiffness_eps = tol / 1000.0;
}
// ****************************************************************************
// Method: avtIVPAdamsBashforth destructor
//
// Programmer: Dave Pugmire
// Creation: August 5, 2008
//
// ****************************************************************************
avtIVPAdamsBashforth::~avtIVPAdamsBashforth()
{
}
// ****************************************************************************
// Method: avtIVPAdamsBashforth::GetCurrentT
//
// Purpose:
// Gets the current T.
//
// Programmer: Dave Pugmire
// Creation: August 5, 2008
//
// ****************************************************************************
double
avtIVPAdamsBashforth::GetCurrentT() const
{
return t;
}
// ****************************************************************************
// Method: avtIVPAdamsBashforth::GetCurrentY
//
// Purpose:
// Gets the current Y.
//
// Programmer: Dave Pugmire
// Creation: August 5, 2008
//
// Modifications:
// Dave Pugmire, Fri Aug 8 16:05:34 EDT 2008
// Improved version of A-B solver that builds function history from
// initial RK4 steps.
//
// Dave Pugmire, Tue Dec 1 11:50:18 EST 2009
// Switch from avtVec to avtVector.
//
// ****************************************************************************
avtVector
avtIVPAdamsBashforth::GetCurrentY() const
{
return yCur;
}
// ****************************************************************************
// Method: avtIVPAdamsBashforth::SetCurrentY
//
// Purpose:
// Sets the current Y.
//
// Programmer: Dave Pugmire
// Creation: August 5, 2008
//
// Modifications:
// Dave Pugmire, Fri Aug 8 16:05:34 EDT 2008
// Improved version of A-B solver that builds function history from
// initial RK4 steps.
//
// Dave Pugmire, Tue Dec 1 11:50:18 EST 2009
// Switch from avtVec to avtVector.
//
// ****************************************************************************
void
avtIVPAdamsBashforth::SetCurrentY(const avtVector &newY)
{
yCur = newY;