Commit 22642a31 authored by Mark Hymers's avatar Mark Hymers

Load ifrit-3.1.0/ into packages/ifrit/branches/upstream/trunk.

parent 3fc7595b
#
# Copyright (c) 2002-2006 Nick Gnedin
# Copyright (c) 2002-2007 Nick Gnedin
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of the
......@@ -15,7 +15,8 @@ PROJECT(${target})
SET(addOGL 0 CACHE BOOL "Add OpenGL manually")
SET(addX11 0 CACHE BOOL "Add X11 manualy")
MARK_AS_ADVANCED(addOGL addX11)
SET(expExt 0 CACHE BOOL "Build extensions explicitly")
MARK_AS_ADVANCED(addOGL addX11 expExt)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
......@@ -30,7 +31,11 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
#
# Shells
#
OPTION(Shell:CL "Include command-line shell" ON)
IF(WIN32)
OPTION(Shell:CL "Include command-line shell" OFF)
ELSE(WIN32)
OPTION(Shell:CL "Include command-line shell" ON)
ENDIF(WIN32)
OPTION(Shell:QT "Include Qt-based GUI shell" ON)
SET(nsh)
......@@ -49,26 +54,56 @@ IF(NOT nsh AND NOT gsh)
ENDIF(NOT nsh AND NOT gsh)
#
# Extensions
# Find max extension flag
#
FILE(GLOB dir ${src}/core/extensions/hart)
IF(EXISTS ${dir})
OPTION(Extension:HART "Include HART extension" ON)
ENDIF(EXISTS ${dir})
SET(maxNum 1)
FILE(READ ${src}/configure/iextensiondefines.h f)
FILE(GLOB dir ${src}/core/extensions/mv)
IF(EXISTS ${dir})
OPTION(Extension:MultiView "Include MultiView extension" ON)
ENDIF(EXISTS ${dir})
STRING(REGEX MATCHALL "#define IEXTENSION_[A-Z0-9_]*[ \t]*[0-9]*" m ${f})
IF(m)
STRING(REGEX REPLACE "#define IEXTENSION_[A-Z0-9_]*[ \t]*([0-9]*)" "\\1;" num ${m})
SET(num ${num}0)
FOREACH(n ${num})
IF(n GREATER ${maxNum})
SET(maxNum ${n})
ENDIF(n GREATER ${maxNum})
ENDFOREACH(n ${num})
ENDIF(m)
#
# Configure extensions
#
SET(ext)
IF(Extension:HART)
SET(ext ${ext} hart)
ENDIF(Extension:HART)
IF(Extension:MultiView)
SET(ext ${ext} mv)
ENDIF(Extension:MultiView)
FILE(GLOB dir ${src}/configure/.CMake.*.def)
IF(dir)
FOREACH(s ${dir})
STRING(REGEX REPLACE ".*\\.CMake\\.([A-Z0-9_]*)\\.def" "\\1" e ${s})
IF(e STREQUAL MV)
OPTION(Extension:MultiView "Include MultiView extension" OFF)
IF(Extension:MultiView)
set(ext ${ext} ${e})
ENDIF(Extension:MultiView)
ELSE(e STREQUAL MV)
OPTION(Extension::${e} "Include ${e} extension" ON)
IF(Extension::${e})
set(ext ${ext} ${e})
ENDIF(Extension::${e})
#
# Check that the define for this extension has been set already.
#
STRING(REGEX MATCH "#define IEXTENSION_${e}[ \t]*[0-9]*" m ${f})
IF(NOT m)
MESSAGE("Extension ${e} has not been defined in configure/iextensiondefines.h.\n I will define it for you.")
SET(maxNum 2*${maxNum})
FILE(APPEND ${src}/configure/iextensiondefines.h "#define IEXTENSION_${e} ${maxNum}\n")
ENDIF(NOT m)
ENDIF(e STREQUAL MV)
ENDFOREACH(s ${dir})
ENDIF(dir)
#
# ---------------------------------------------------------------------------
......@@ -169,18 +204,7 @@ ENDFOREACH(s)
# Extensions
#
FOREACH(e ${ext})
FILE(GLOB tmp ${src}/core/extensions/${e}/*.cpp)
IF(tmp)
SET(sources ${sources} ${tmp})
INCLUDE_DIRECTORIES(${src}/core/extensions/${e})
IF(gsh)
FILE(GLOB tmp ${src}/shells/generic/extensions/${e}/*.cpp)
SET(sources ${sources} ${tmp})
INCLUDE_DIRECTORIES(${src}/shells/generic/extensions/${e})
ENDIF(gsh)
STRING(TOUPPER ${e} ue)
SET(exten ${exten}+IEXTENSION_${ue})
ENDIF(tmp)
SET(exten ${exten}+IEXTENSION_${e})
ENDFOREACH(e)
#
......
......@@ -32,33 +32,30 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ICONFIGURE_H
//
// Suported extensions
//
// DESCRIPTION:
// Extensions in IFRIT must be associated with power-of-two ids, so that they can be ORed together.
// Supported extensions
//
#define IEXTENSION_NONE 0
#define IEXTENSION_HART 1
#define IEXTENSION_MV 2
#define IEXTENSION_GADGET 4
#define IEXTENSION_MV 0x80000000
#include "iextensiondefines.h"
//
// Supported shells
//
#define ISHELL_CL 1
#define ISHELL_GG 0xFFFE
#define ISHELL_GG 0xFFFFFFFE
#define ISHELL_QT 2
//#define ISHELL_FX 4
//
// Multiple extensions can be included, they are not exclusive
//
#define IEXTENSION_INCLUDED(_Type_) (IEXTENSION & _Type_)
#define IEXTENSION_INCLUDED(_Type_) ((IEXTENSION & _Type_) != 0)
//
// Multiple shells can be included, they are not exclusive
//
#define ISHELL_INCLUDED(_Type_) (ISHELL & _Type_)
#define ISHELL_INCLUDED(_Type_) ((ISHELL & _Type_) != 0)
//
// ******************************************************************************
......@@ -68,8 +65,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef I_EXTERNAL_CONFIGURATION
#include "iconfiguresettings.ext.h"
#else
#define IEXTENSION 0xFFFF
#define ISHELL 0xFFFF
#define IEXTENSION 0xFFFFFFFF
#define ISHELL 0xFFFFFFFF
#endif
//
// ******************************************************************************
......
......@@ -26,67 +26,125 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include <string.h>
#include "itune.h"
#include "iextensionbuilder.h"
#include "iconsole.h"
#include "ifile.h"
#ifdef I_BUILD_EXTENSIONS_EXPLICITLY
//#include <iostream.h>
#include "iconfigure.h"
//
// --------------- Core extensions ---------------------
//
#ifndef ITUNE_INLINE
#define ITUNEDEFS_H
#include "itunedefs.h"
#undef ITUNEDEFS_H
//
// HART extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
#include "hextension.h"
#endif
//
// VTK extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_VTK)
#include "vtkextension.h"
#endif
//
// GADGET extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_GADGET)
#include "gextension.h"
#endif
//
// *************************************************************************
//
// DESCRIPTION:
// Add the include to your core extension header here. The include
// needs to be wrapped around in #if/#endif clause.
//
// *************************************************************************
//
#if ITUNE_INLINE == 0
#define ITUNEWORK_H
#include "itunework.h"
#undef ITUNEWORK_H
#elif ITUNE_INLINE != 1
#if ISHELL_INCLUDED(ISHELL_GG) // --------------- Generic GUI extensions ---------------------
#error "iTune class is configured incorrectly."
!TERMINATE!
//
// HART extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
#include "hggextension.h"
#endif
//
// VTK extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_VTK)
#include "vtkggextension.h"
#endif
//
// GADGET extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_GADGET)
#include "gggextension.h"
#endif
//
// *************************************************************************
//
// DESCRIPTION:
// Add the include to your GUI shell extension header here. The include
// needs to be wrapped around in #if/#endif clause.
//
// *************************************************************************
//
#endif // ITUNE_INLINE
#endif // --------------- Generic GUI extensions ---------------------
//
// This function does self-tuning
//
void iTune::Tune()
void iExtensionBuilder::Build()
{
//
// Are we already tuned?
// HART extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
hExtension::Build();
#if ISHELL_INCLUDED(ISHELL_GG)
hggExtension::Build();
#endif
#endif
//
// VTK extension
//
#if ITUNE_DONE != 0
return;
#if IEXTENSION_INCLUDED(IEXTENSION_VTK)
vtkExtension::Build();
#if ISHELL_INCLUDED(ISHELL_GG)
vtkggExtension::Build();
#endif
#endif
//
// GADGET extension
//
#if IEXTENSION_INCLUDED(IEXTENSION_GADGET)
gExtension::Build();
#if ISHELL_INCLUDED(ISHELL_GG)
gggExtension::Build();
#endif
#endif
//
// Find the file "core/itunedefs.h". If it is not there, then we are not in the
// build directory, so we cannot tune. Report a non-intrusive warning and exit.
// *************************************************************************
//
// DESCRIPTION:
// Add calls to Build function for your extension here. The calls
// need to be wrapped around in #if/#endif clause.
//
// *************************************************************************
//
iFile F("core/itunedefs.h");
if(!F.Open(iFile::_Read,iFile::_Text))
{
iConsole::Instance()->DisplayTextMessage("IFrIT has not been tuned up. You can tune it to improve performance by:");
iConsole::Instance()->DisplayTextMessage(" 1. Starting IFrIT once from the build directory.");
iConsole::Instance()->DisplayTextMessage(" 2. Recompiling it after that again.");
return;
}
iConsole::Instance()->DisplayTextMessage("Tuning IFrIT up. Please, wait...");
iConsole::Instance()->DisplayTextMessage("IFrIT is fully tuned up. Enjoy.");
F.Close();
}
#else
void iExtensionBuilder::Build()
{
}
#endif
......@@ -26,15 +26,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "ishellcomponent.h"
#ifndef IEXTENSIONBUILDER_H
#define IEXTENSIONBUILDER_H
#include "ishell.h"
class iExtensionBuilder
{
public:
iShellComponent::iShellComponent(iShell *s)
{
mShell = s;
static void Build();
};
#endif // IEXTENSIONBUILDER_H
if(s != 0) s->OnInitAtom();
}
/*=========================================================================
Program: Ionization FRont Interactive Tool (IFRIT)
Language: C++
Copyright (c) 2002-2006 Nick Gnedin
All rights reserved.
This file may be distributed and/or modified under the terms of the
GNU General Public License version 2 as published by the Free Software
Foundation and appearing in the file LICENSE.GPL included in the
packaging of this file.
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 THE AUTHORS 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.
=========================================================================*/
//
// Supported extensions
//
// DESCRIPTION:
// Extensions in IFRIT must be associated with power-of-two ids, so that they can be ORed together.
//
#define IEXTENSION_HART 1
#define IEXTENSION_VTK 2
#define IEXTENSION_GADGET 4
//
// Keep adding new defines here, but, please, do not change the existing ones.
//
......@@ -27,134 +27,32 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "iconfigure.h"
#ifdef IEXTENSION
#include "iextensionfactory.h"
//
// This file is documented only partially.
//
#include "ianimatorscript.h"
#include "icontrolmodule.h"
#include "icrosssectionviewsubject.h"
#include "idata.h"
#include "idataexplorer.h"
#include "idatareader.h"
#include "iedition.h"
#include "iparticlegroup.h"
#include "iparticlesviewsubject.h"
#include "ipicker.h"
#include "irendertool.h"
#include "isurfaceviewsubject.h"
#include "itensorfieldviewsubject.h"
#include "ivectorfieldviewsubject.h"
#include "iviewmodule.h"
#include "iviewobject.h"
#include "iviewobjectfamily.h"
#include "ivolumeviewsubject.h"
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
#include "hobjects.h"
#endif
#if IEXTENSION_INCLUDED(IEXTENSION_MV)
#include "imultiviewrendertool.h"
#endif
//
// **************************************************************************
//
// IMPORTANT: Factory methods do not need to be checked for null pointers
// since they are only called from within New() functions
//
// **************************************************************************
//
iAnimatorScript* iExtensionFactory::CreateAnimatorScript(iAnimator *m)
{
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
return new hAnimatorScript(m);
#else
return new iAnimatorScript(m);
#include "hanimatorscript.h"
#endif
}
iViewObject* iExtensionFactory::CreateViewObject(iViewObjectParent *parent)
iAnimatorScript* iExtensionFactory::CreateAnimatorScript(iAnimator *animator)
{
iViewModule *vm(parent->GetViewModule());
const iObjectType &type(parent->GetObjectType());
//
// Particles are special - they are not single-type
//
iViewObject *obj = new iViewObject(parent,false,!type.IsMatch(iParticlesViewSubject::Type()));
if(obj == 0) return 0;
//
// View objects
//
if(type.IsMatch(iCrossSectionViewSubject::Type()))
{
obj->AddSubject(new iCrossSectionViewSubject(vm,iData::UniformScalars(),"Cross Section"));
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
obj->AddSubject(new hCrossSectionViewSubject(vm,iData::HARTVariables(),"Cross Section"));
#endif
}
if(type.IsMatch(iParticlesViewSubject::Type()))
{
obj->AddSubject(new iParticlesViewSubject(vm,iData::BasicParticles(),"Particles"));
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
obj->AddSubject(new iParticlesViewSubject(vm,iData::HARTParticles(0),"HART Particles"));
obj->AddSubject(new iParticlesViewSubject(vm,iData::HARTParticles(1),"HART Stellar Particles"));
obj->AddSubject(new iParticlesViewSubject(vm,iData::HARTParticles(2),"HART Black Hole Particles"));
#endif
}
if(type.IsMatch(iSurfaceViewSubject::Type()))
{
obj->AddSubject(new iSurfaceViewSubject(vm,iData::UniformScalars(),"Surface"));
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
obj->AddSubject(new hSurfaceViewSubject(vm,iData::HARTVariables(),"Surface"));
#endif
}
if(type.IsMatch(iTensorFieldViewSubject::Type()))
{
obj->AddSubject(new iTensorFieldViewSubject(vm,iData::UniformTensors(),"Tensor Field"));
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
obj->AddSubject(new hTensorFieldViewSubject(vm,iData::HARTVariables(2),"Tensor Field"));
#endif
}
if(type.IsMatch(iVectorFieldViewSubject::Type()))
{
obj->AddSubject(new iVectorFieldViewSubject(vm,iData::UniformVectors(),"Vector Field"));
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
obj->AddSubject(new hVectorFieldViewSubject(vm,iData::HARTVariables(1),"Vector Field"));
#endif
}
if(type.IsMatch(iVolumeViewSubject::Type()))
{
obj->AddSubject(new iVolumeViewSubject(vm,iData::UniformScalars(),"Volume"));
#if IEXTENSION_INCLUDED(IEXTENSION_HART)
obj->AddSubject(new hVolumeViewSubject(vm,iData::HARTVariables(),"Volume"));
#endif
}
#if IEXTENSION_INCLUDED(IEXTENSION_HART)