Commit bafe9f1b authored by hrchilds's avatar hrchilds
Browse files

Add ToroidalPoloidal projection operator, implemented by Hari.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@16570 18c085ea-50e0-402c-830e-de6fd14e8384
parent f420188a
......@@ -50,6 +50,10 @@
#
# Marc Durant, Tue Sep 6 2011
# Added the FFT operator
#
# Hank Childs, Mon Oct 31 09:38:27 PDT 2011
# Add ToroidalPoloidalProjection on behalf of Hari Krishnan.
#
#****************************************************************************/
IF(NOT WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${VISIT_PLUGIN_DIR}/operators)
......@@ -103,6 +107,7 @@ SphereSlice
SurfaceNormal
ThreeSlice
Threshold
ToroidalPoloidalProjection
Transform
TriangulateRegularPoints
Tube
......
# DO NOT EDIT THIS FILE! THIS FILE IS AUTOMATICALLY GENERATED BY xml2cmake
PROJECT(ToroidalPoloidalProjection)
INCLUDE(${VISIT_SOURCE_DIR}/CMake/PluginMacros.cmake)
SET(COMMON_SOURCES
ToroidalPoloidalProjectionPluginInfo.C
ToroidalPoloidalProjectionCommonPluginInfo.C
ToroidalPoloidalProjection.C
)
SET(LIBI_SOURCES
ToroidalPoloidalProjectionPluginInfo.C
)
SET(LIBG_SOURCES
ToroidalPoloidalProjectionGUIPluginInfo.C
QvisToroidalPoloidalProjectionWindow.C
${COMMON_SOURCES}
)
SET(LIBG_MOC_SOURCES
QvisToroidalPoloidalProjectionWindow.h
)
QT_WRAP_CPP(GToroidalPoloidalProjectionOperator LIBG_SOURCES ${LIBG_MOC_SOURCES})
SET(LIBV_SOURCES
ToroidalPoloidalProjectionViewerPluginInfo.C
${COMMON_SOURCES}
)
SET(LIBE_SOURCES
ToroidalPoloidalProjectionEnginePluginInfo.C
avtToroidalPoloidalProjectionFilter.C
${COMMON_SOURCES}
)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${VISIT_COMMON_INCLUDES}
${VISIT_INCLUDE_DIR}/avt/DBAtts/MetaData
${VISIT_INCLUDE_DIR}/avt/DBAtts/SIL
${VISIT_INCLUDE_DIR}/avt/Database/Database
${VISIT_INCLUDE_DIR}/avt/Expressions/Abstract
${VISIT_INCLUDE_DIR}/avt/Expressions/CMFE
${VISIT_INCLUDE_DIR}/avt/Expressions/Conditional
${VISIT_INCLUDE_DIR}/avt/Expressions/Derivations
${VISIT_INCLUDE_DIR}/avt/Expressions/General
${VISIT_INCLUDE_DIR}/avt/Expressions/ImageProcessing
${VISIT_INCLUDE_DIR}/avt/Expressions/Management
${VISIT_INCLUDE_DIR}/avt/Expressions/Math
${VISIT_INCLUDE_DIR}/avt/Expressions/MeshQuality
${VISIT_INCLUDE_DIR}/avt/FileWriter
${VISIT_INCLUDE_DIR}/avt/Filters
${VISIT_INCLUDE_DIR}/avt/IVP
${VISIT_INCLUDE_DIR}/avt/Math
${VISIT_INCLUDE_DIR}/avt/Pipeline/AbstractFilters
${VISIT_INCLUDE_DIR}/avt/Pipeline/Data
${VISIT_INCLUDE_DIR}/avt/Pipeline/Pipeline
${VISIT_INCLUDE_DIR}/avt/Pipeline/Sinks
${VISIT_INCLUDE_DIR}/avt/Pipeline/Sources
${VISIT_INCLUDE_DIR}/avt/Plotter
${VISIT_INCLUDE_DIR}/avt/QtVisWindow
${VISIT_INCLUDE_DIR}/avt/View
${VISIT_INCLUDE_DIR}/avt/VisWindow/Colleagues
${VISIT_INCLUDE_DIR}/avt/VisWindow/Interactors
${VISIT_INCLUDE_DIR}/avt/VisWindow/Proxies
${VISIT_INCLUDE_DIR}/avt/VisWindow/Tools
${VISIT_INCLUDE_DIR}/avt/VisWindow/VisWindow
${VISIT_INCLUDE_DIR}/gui
${VISIT_INCLUDE_DIR}/mdserver/proxy
${VISIT_INCLUDE_DIR}/mdserver/rpc
${VISIT_INCLUDE_DIR}/viewer/main
${VISIT_INCLUDE_DIR}/viewer/proxy
${VISIT_INCLUDE_DIR}/viewer/rpc
${VISIT_INCLUDE_DIR}/winutil
${VISIT_INCLUDE_DIR}/visit_vtk/full
${VISIT_INCLUDE_DIR}/visit_vtk/lightweight
${QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${PYTHON_INCLUDE_PATH}
${VISIT_INCLUDE_DIR}/visitpy/visitpy
)
LINK_DIRECTORIES(${VISIT_LIBRARY_DIR} ${QT_LIBRARY_DIR} ${GLEW_LIBRARY_DIR} ${VTK_LIBRARY_DIRS} )
ADD_LIBRARY(IToroidalPoloidalProjectionOperator ${LIBI_SOURCES})
TARGET_LINK_LIBRARIES(IToroidalPoloidalProjectionOperator visitcommon)
SET(INSTALLTARGETS IToroidalPoloidalProjectionOperator)
IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ADD_LIBRARY(GToroidalPoloidalProjectionOperator ${LIBG_SOURCES})
TARGET_LINK_LIBRARIES(GToroidalPoloidalProjectionOperator visitcommon gui )
ADD_LIBRARY(VToroidalPoloidalProjectionOperator ${LIBV_SOURCES})
TARGET_LINK_LIBRARIES(VToroidalPoloidalProjectionOperator visitcommon viewer )
SET(INSTALLTARGETS ${INSTALLTARGETS} GToroidalPoloidalProjectionOperator VToroidalPoloidalProjectionOperator)
IF(VISIT_PYTHON_SCRIPTING)
SET(LIBS_SOURCES
ToroidalPoloidalProjectionScriptingPluginInfo.C
PyToroidalPoloidalProjection.C
${COMMON_SOURCES}
)
ADD_LIBRARY(SToroidalPoloidalProjectionOperator ${LIBS_SOURCES})
TARGET_LINK_LIBRARIES(SToroidalPoloidalProjectionOperator visitcommon visitpy ${PYTHON_LIBRARY})
SET(INSTALLTARGETS ${INSTALLTARGETS} SToroidalPoloidalProjectionOperator)
ENDIF(VISIT_PYTHON_SCRIPTING)
IF(VISIT_JAVA)
ADD_CUSTOM_TARGET(JavaToroidalPoloidalProjection ALL ${CMAKE_Java_COMPILER} ${CMAKE_Java_FLAGS} -d ${VISIT_BINARY_DIR}/java -classpath ${VISIT_BINARY_DIR}/java ToroidalPoloidalProjection.java)
ADD_DEPENDENCIES(JavaToroidalPoloidalProjection JavaClient)
ENDIF(VISIT_JAVA)
ENDIF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ADD_LIBRARY(EToroidalPoloidalProjectionOperator_ser ${LIBE_SOURCES})
TARGET_LINK_LIBRARIES(EToroidalPoloidalProjectionOperator_ser visitcommon avtexpressions_ser avtfilters_ser avtpipeline_ser )
SET(INSTALLTARGETS ${INSTALLTARGETS} EToroidalPoloidalProjectionOperator_ser)
IF(VISIT_PARALLEL)
ADD_PARALLEL_LIBRARY(EToroidalPoloidalProjectionOperator_par ${LIBE_SOURCES})
TARGET_LINK_LIBRARIES(EToroidalPoloidalProjectionOperator_par visitcommon avtexpressions_par avtfilters_par avtpipeline_par )
SET(INSTALLTARGETS ${INSTALLTARGETS} EToroidalPoloidalProjectionOperator_par)
ENDIF(VISIT_PARALLEL)
VISIT_INSTALL_OPERATOR_PLUGINS(${INSTALLTARGETS})
VISIT_PLUGIN_TARGET_PREFIX(${INSTALLTARGETS})
VISIT_PLUGIN_TARGET_FOLDER(operators ${INSTALLTARGETS})
/*****************************************************************************
*
* Copyright (c) 2000 - 2011, 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.
*
*****************************************************************************/
#include <PyToroidalPoloidalProjection.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <snprintf.h>
// ****************************************************************************
// Module: PyToroidalPoloidalProjection
//
// Purpose:
// Projects Exterior of Torus from 3D to ToroidalPoloidal mapping in 2D
//
// Note: Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation: omitted
//
// ****************************************************************************
//
// This struct contains the Python type information and a ToroidalPoloidalProjection.
//
struct ToroidalPoloidalProjectionObject
{
PyObject_HEAD
ToroidalPoloidalProjection *data;
bool owns;
PyObject *parent;
};
//
// Internal prototypes
//
static PyObject *NewToroidalPoloidalProjection(int);
std::string
PyToroidalPoloidalProjection_ToString(const ToroidalPoloidalProjection *atts, const char *prefix)
{
std::string str;
char tmpStr[1000];
SNPRINTF(tmpStr, 1000, "%sR0 = %g\n", prefix, atts->GetR0());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sr = %g\n", prefix, atts->GetR());
str += tmpStr;
return str;
}
static PyObject *
ToroidalPoloidalProjection_Notify(PyObject *self, PyObject *args)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)self;
obj->data->Notify();
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ToroidalPoloidalProjection_SetR0(PyObject *self, PyObject *args)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)self;
double dval;
if(!PyArg_ParseTuple(args, "d", &dval))
return NULL;
// Set the R0 in the object.
obj->data->SetR0(dval);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ToroidalPoloidalProjection_GetR0(PyObject *self, PyObject *args)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)self;
PyObject *retval = PyFloat_FromDouble(obj->data->GetR0());
return retval;
}
/*static*/ PyObject *
ToroidalPoloidalProjection_SetR(PyObject *self, PyObject *args)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)self;
double dval;
if(!PyArg_ParseTuple(args, "d", &dval))
return NULL;
// Set the r in the object.
obj->data->SetR(dval);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ToroidalPoloidalProjection_GetR(PyObject *self, PyObject *args)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)self;
PyObject *retval = PyFloat_FromDouble(obj->data->GetR());
return retval;
}
PyMethodDef PyToroidalPoloidalProjection_methods[TOROIDALPOLOIDALPROJECTION_NMETH] = {
{"Notify", ToroidalPoloidalProjection_Notify, METH_VARARGS},
{"SetR0", ToroidalPoloidalProjection_SetR0, METH_VARARGS},
{"GetR0", ToroidalPoloidalProjection_GetR0, METH_VARARGS},
{"SetR", ToroidalPoloidalProjection_SetR, METH_VARARGS},
{"GetR", ToroidalPoloidalProjection_GetR, METH_VARARGS},
{NULL, NULL}
};
//
// Type functions
//
static void
ToroidalPoloidalProjection_dealloc(PyObject *v)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)v;
if(obj->parent != 0)
Py_DECREF(obj->parent);
if(obj->owns)
delete obj->data;
}
static int
ToroidalPoloidalProjection_compare(PyObject *v, PyObject *w)
{
ToroidalPoloidalProjection *a = ((ToroidalPoloidalProjectionObject *)v)->data;
ToroidalPoloidalProjection *b = ((ToroidalPoloidalProjectionObject *)w)->data;
return (*a == *b) ? 0 : -1;
}
PyObject *
PyToroidalPoloidalProjection_getattr(PyObject *self, char *name)
{
if(strcmp(name, "R0") == 0)
return ToroidalPoloidalProjection_GetR0(self, NULL);
if(strcmp(name, "r") == 0)
return ToroidalPoloidalProjection_GetR(self, NULL);
return Py_FindMethod(PyToroidalPoloidalProjection_methods, self, name);
}
int
PyToroidalPoloidalProjection_setattr(PyObject *self, char *name, PyObject *args)
{
// Create a tuple to contain the arguments since all of the Set
// functions expect a tuple.
PyObject *tuple = PyTuple_New(1);
PyTuple_SET_ITEM(tuple, 0, args);
Py_INCREF(args);
PyObject *obj = NULL;
if(strcmp(name, "R0") == 0)
obj = ToroidalPoloidalProjection_SetR0(self, tuple);
else if(strcmp(name, "r") == 0)
obj = ToroidalPoloidalProjection_SetR(self, tuple);
if(obj != NULL)
Py_DECREF(obj);
Py_DECREF(tuple);
if( obj == NULL)
PyErr_Format(PyExc_RuntimeError, "Unable to set unknown attribute: '%s'", name);
return (obj != NULL) ? 0 : -1;
}
static int
ToroidalPoloidalProjection_print(PyObject *v, FILE *fp, int flags)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)v;
fprintf(fp, "%s", PyToroidalPoloidalProjection_ToString(obj->data, "").c_str());
return 0;
}
PyObject *
ToroidalPoloidalProjection_str(PyObject *v)
{
ToroidalPoloidalProjectionObject *obj = (ToroidalPoloidalProjectionObject *)v;
return PyString_FromString(PyToroidalPoloidalProjection_ToString(obj->data,"").c_str());
}
//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *ToroidalPoloidalProjection_Purpose = "Projects Exterior of Torus from 3D to ToroidalPoloidal mapping in 2D";
#else
static char *ToroidalPoloidalProjection_Purpose = "Projects Exterior of Torus from 3D to ToroidalPoloidal mapping in 2D";
#endif
//
// The type description structure
//
static PyTypeObject ToroidalPoloidalProjectionType =
{
//
// Type header
//
PyObject_HEAD_INIT(&PyType_Type)
0, // ob_size
"ToroidalPoloidalProjection", // tp_name
sizeof(ToroidalPoloidalProjectionObject), // tp_basicsize
0, // tp_itemsize
//
// Standard methods
//
(destructor)ToroidalPoloidalProjection_dealloc, // tp_dealloc
(printfunc)ToroidalPoloidalProjection_print, // tp_print
(getattrfunc)PyToroidalPoloidalProjection_getattr, // tp_getattr
(setattrfunc)PyToroidalPoloidalProjection_setattr, // tp_setattr
(cmpfunc)ToroidalPoloidalProjection_compare, // tp_compare
(reprfunc)0, // tp_repr
//
// Type categories
//
0, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
//
// More methods
//
0, // tp_hash
0, // tp_call
(reprfunc)ToroidalPoloidalProjection_str, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_CHECKTYPES, // tp_flags
ToroidalPoloidalProjection_Purpose, // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare
0 // tp_weaklistoffset
};
//
// Helper functions for object allocation.
//
static ToroidalPoloidalProjection *defaultAtts = 0;
static ToroidalPoloidalProjection *currentAtts = 0;
static PyObject *
NewToroidalPoloidalProjection(int useCurrent)
{
ToroidalPoloidalProjectionObject *newObject;
newObject = PyObject_NEW(ToroidalPoloidalProjectionObject, &ToroidalPoloidalProjectionType);
if(newObject == NULL)
return NULL;
if(useCurrent && currentAtts != 0)
newObject->data = new ToroidalPoloidalProjection(*currentAtts);
else if(defaultAtts != 0)
newObject->data = new ToroidalPoloidalProjection(*defaultAtts);
else
newObject->data = new ToroidalPoloidalProjection;
newObject->owns = true;
newObject->parent = 0;
return (PyObject *)newObject;
}
static PyObject *
WrapToroidalPoloidalProjection(const ToroidalPoloidalProjection *attr)
{
ToroidalPoloidalProjectionObject *newObject;
newObject = PyObject_NEW(ToroidalPoloidalProjectionObject, &ToroidalPoloidalProjectionType);
if(newObject == NULL)
return NULL;
newObject->data = (ToroidalPoloidalProjection *)attr;
newObject->owns = false;
newObject->parent = 0;
return (PyObject *)newObject;
}
///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////
PyObject *
ToroidalPoloidalProjection_new(PyObject *self, PyObject *args)
{
int useCurrent = 0;
if (!PyArg_ParseTuple(args, "i", &useCurrent))
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
else
PyErr_Clear();
}
return (PyObject *)NewToroidalPoloidalProjection(useCurrent);
}
//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef ToroidalPoloidalProjectionMethods[] = {
{"ToroidalPoloidalProjection", ToroidalPoloidalProjection_new, METH_VARARGS},
{NULL, NULL} /* Sentinel */
};
static Observer *ToroidalPoloidalProjectionObserver = 0;
std::string
PyToroidalPoloidalProjection_GetLogString()
{
std::string s("ToroidalPoloidalProjection = ToroidalPoloidalProjection()\n");
if(currentAtts != 0)
s += PyToroidalPoloidalProjection_ToString(currentAtts, "ToroidalPoloidalProjection.");
return s;
}
static void
PyToroidalPoloidalProjection_CallLogRoutine(Subject *subj, void *data)
{
ToroidalPoloidalProjection *atts = (ToroidalPoloidalProjection *)subj;
typedef void (*logCallback)(const std::string &);
logCallback cb = (logCallback)data;
if(cb != 0)
{
std::string s("ToroidalPoloidalProjection = ToroidalPoloidalProjection()\n");
s += PyToroidalPoloidalProjection_ToString(currentAtts, "ToroidalPoloidalProjection.");
cb(s);
}
}
void
PyToroidalPoloidalProjection_StartUp(ToroidalPoloidalProjection *subj, void *data)
{
if(subj == 0)
return;
currentAtts = subj;
PyToroidalPoloidalProjection_SetDefaults(subj);
//
// Create the observer that will be notified when the attributes change.
//
if(ToroidalPoloidalProjectionObserver == 0)
{
ToroidalPoloidalProjectionObserver = new ObserverToCallback(subj,
PyToroidalPoloidalProjection_CallLogRoutine, (void *)data);
}
}
void
PyToroidalPoloidalProjection_CloseDown()
{
delete defaultAtts;
defaultAtts = 0;
delete ToroidalPoloidalProjectionObserver;
ToroidalPoloidalProjectionObserver = 0;
}
PyMethodDef *
PyToroidalPoloidalProjection_GetMethodTable(int *nMethods)
{
*nMethods = 1;
return ToroidalPoloidalProjectionMethods;
}
bool
PyToroidalPoloidalProjection_Check(PyObject *obj)
{
return (obj->ob_type == &ToroidalPoloidalProjectionType);
}
ToroidalPoloidalProjection *
PyToroidalPoloidalProjection_FromPyObject(PyObject *obj)
{
ToroidalPoloidalProjectionObject *obj2 = (ToroidalPoloidalProjectionObject *)obj;
return obj2->data;
}
PyObject *
PyToroidalPoloidalProjection_New()
{
return NewToroidalPoloidalProjection(0);
}
PyObject *
PyToroidalPoloidalProjection_Wrap(const ToroidalPoloidalProjection *attr)
{
return WrapToroidalPoloidalProjection(attr);
}
void
PyToroidalPoloidalProjection_SetParent(PyObject *obj, PyObject *parent)
{
ToroidalPoloidalProjectionObject *obj2 = (ToroidalPoloidalProjectionObject *)obj;
obj2->parent = parent;
}