Commit 79c31251 authored by whitlocb's avatar whitlocb

Many SimV2 changes



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@6511 18c085ea-50e0-402c-830e-de6fd14e8384
parent b5102b5a
......@@ -135,8 +135,13 @@
# Hank Childs, Sat Feb 9 15:31:35 PST 2008
# Renamed components directory to avt.
#
# Brad Whitlock, Fri Feb 13 11:50:03 PST 2009
# I made sim be built before plugins since the SimV2 reader has a
# dependency on libsimV2runtime.
#
# Mark C. Miller, Wed Mar 4 18:02:00 PST 2009
# Made it work for dbio-only build.
#
##############################################################################
@SET_MAKE@
......@@ -146,8 +151,9 @@
SUBDIRS_DBIO_ONLY=include lib bin third_party_builtin common visit_vtk avt databases tools
SUBDIRS_STD=include lib bin third_party_builtin common @VTKQT@ visit_vtk \
avt engine launcher @METADATA_SERVER@ winutil @VIEWER@ \
@GUI@ @VISITPY@ @JAVA_TARGET@ plots operators databases @HELP@ \
sim tools
@GUI@ @VISITPY@ @JAVA_TARGET@ sim plots operators databases @HELP@ \
tools
SUBDIRS=@SUBDIRS@
SUBDIRS=@SUBDIRS@
#
......
......@@ -92,7 +92,7 @@ Zoo_src= \
Zoo/ResampledMat.C \
Zoo/ZooMIR.C
CPPFLAGS=-I../../include @COMPONENT_CPPFLAGS@ @CPPFLAGS@
CPPFLAGS=-I../../include -I../../include/visit @COMPONENT_CPPFLAGS@ @CPPFLAGS@
SEROBJ=$(SRC:.C=.o)
PAROBJ=$(SRC:.C=_par.o)
......
......@@ -887,3 +887,31 @@ View2DAttributes::SetUseFullFrame(bool ff)
fullFrameActivationMode = Off;
}
#include <math.h>
// ****************************************************************************
// Method: View2DAttributes::ResetView
//
// Purpose:
// Resets the view to something that can accommodate the bbox.
//
// Arguments:
// bbox : The 2D extents that we're trying to look at.
//
// Programmer: Brad Whitlock
// Creation: Tue Mar 3 16:21:14 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
View2DAttributes::ResetView(const double *bbox)
{
const double vpc[] = {0.2, 0.95, 0.15, 0.95};
View2DAttributes view2D;
view2D.SetWindowCoords(bbox);
view2D.SetViewportCoords(vpc);
// Copy the object into this.
*this = view2D;
}
......@@ -99,3 +99,33 @@ View2DAttributes::SetUseFullFrame(bool ff)
fullFrameActivationMode = Off;
}
Function: ResetView
Declaration: void View2DAttributes::ResetView(const double *bbox);
Definition:
#include <math.h>
// ****************************************************************************
// Method: View2DAttributes::ResetView
//
// Purpose:
// Resets the view to something that can accommodate the bbox.
//
// Arguments:
// bbox : The 2D extents that we're trying to look at.
//
// Programmer: Brad Whitlock
// Creation: Tue Mar 3 16:21:14 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
View2DAttributes::ResetView(const double *bbox)
{
const double vpc[] = {0.2, 0.95, 0.15, 0.95};
View2DAttributes view2D;
view2D.SetWindowCoords(bbox);
view2D.SetViewportCoords(vpc);
// Copy the object into this.
*this = view2D;
}
......@@ -125,6 +125,7 @@ public:
// User-defined methods
bool GetUseFullFrame(const double *limits=0) const;
void SetUseFullFrame(bool ff);
void View2DAttributes::ResetView(const double *bbox);
// IDs that can be used to identify fields in case statements
enum {
......
......@@ -33,6 +33,8 @@
</Function>
<Function name="SetUseFullFrame" user="true" member="true">
</Function>
<Function name="ResetView" user="true" member="true">
</Function>
<Constant name="DEFAULT_FULL_FRAME_AUTO_THRESHOLD" member="true">
</Constant>
<Include file="header" quoted="false">
......
......@@ -1380,3 +1380,88 @@ void View3DAttributes::RotateAxis(int axis, double angle)
}
}
#include <math.h>
// ****************************************************************************
// Method: View3DAttributes::ResetView
//
// Purpose:
// Resets the view to something that can accommodate the bbox.
//
// Arguments:
// bbox : The 3D extents that we're trying to look at.
//
// Programmer: Brad Whitlock
// Creation: Tue Mar 3 16:21:14 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
View3DAttributes::ResetView(const double *bbox)
{
View3DAttributes view3D;
//
// Set the scale. They are choosen such that the object should fit
// within a square window no matter the orientation when doing an
// orthographic projection. The parallelScale controls the scale
// with orthographic projections, whereas the distance controls the
// scale with perspective projections.
//
double width;
double distance;
width = 0.5 * sqrt(((bbox[1] - bbox[0]) *
(bbox[1] - bbox[0])) +
((bbox[3] - bbox[2]) *
(bbox[3] - bbox[2])) +
((bbox[5] - bbox[4]) *
(bbox[5] - bbox[4])));
view3D.viewAngle = 30.;
distance = width / tan (view3D.viewAngle * 3.1415926535 / 360.);
view3D.parallelScale = width;
//
// Set the view up vector, the focal point and the camera position.
//
view3D.viewNormal[0] = 0.;
view3D.viewNormal[1] = 0.;
view3D.viewNormal[2] = 1.;
view3D.focus[0] = (bbox[1] + bbox[0]) / 2.;
view3D.focus[1] = (bbox[3] + bbox[2]) / 2.;
view3D.focus[2] = (bbox[5] + bbox[4]) / 2.;
view3D.viewUp[0] = 0.;
view3D.viewUp[1] = 1.;
view3D.viewUp[2] = 0.;
//
// Calculate the near and far clipping planes. The clipping planes are
// set such that the object should not get clipped in the front or
// back no matter the orientation when doing an orthographic projection.
//
view3D.nearPlane = - 2.0 * width;
view3D.farPlane = 2.0 * width;
//
// Reset the image pan and image zoom.
//
view3D.imagePan[0] = 0.;
view3D.imagePan[1] = 0.;
view3D.imageZoom = 1.;
//
// Reset the center of rotation.
//
view3D.centerOfRotationSet = false;
view3D.centerOfRotation[0] = view3D.focus[0];
view3D.centerOfRotation[1] = view3D.focus[1];
view3D.centerOfRotation[2] = view3D.focus[2];
// Copy the object into this.
*this = view3D;
}
......@@ -302,6 +302,95 @@ void View3DAttributes::RotateAxis(int axis, double angle)
}
}
Function: ResetView
Declaration: void View3DAttributes::ResetView(const double *bbox);
Definition:
#include <math.h>
// ****************************************************************************
// Method: View3DAttributes::ResetView
//
// Purpose:
// Resets the view to something that can accommodate the bbox.
//
// Arguments:
// bbox : The 3D extents that we're trying to look at.
//
// Programmer: Brad Whitlock
// Creation: Tue Mar 3 16:21:14 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
View3DAttributes::ResetView(const double *bbox)
{
View3DAttributes view3D;
//
// Set the scale. They are choosen such that the object should fit
// within a square window no matter the orientation when doing an
// orthographic projection. The parallelScale controls the scale
// with orthographic projections, whereas the distance controls the
// scale with perspective projections.
//
double width;
double distance;
width = 0.5 * sqrt(((bbox[1] - bbox[0]) *
(bbox[1] - bbox[0])) +
((bbox[3] - bbox[2]) *
(bbox[3] - bbox[2])) +
((bbox[5] - bbox[4]) *
(bbox[5] - bbox[4])));
view3D.viewAngle = 30.;
distance = width / tan (view3D.viewAngle * 3.1415926535 / 360.);
view3D.parallelScale = width;
//
// Set the view up vector, the focal point and the camera position.
//
view3D.viewNormal[0] = 0.;
view3D.viewNormal[1] = 0.;
view3D.viewNormal[2] = 1.;
view3D.focus[0] = (bbox[1] + bbox[0]) / 2.;
view3D.focus[1] = (bbox[3] + bbox[2]) / 2.;
view3D.focus[2] = (bbox[5] + bbox[4]) / 2.;
view3D.viewUp[0] = 0.;
view3D.viewUp[1] = 1.;
view3D.viewUp[2] = 0.;
//
// Calculate the near and far clipping planes. The clipping planes are
// set such that the object should not get clipped in the front or
// back no matter the orientation when doing an orthographic projection.
//
view3D.nearPlane = - 2.0 * width;
view3D.farPlane = 2.0 * width;
//
// Reset the image pan and image zoom.
//
view3D.imagePan[0] = 0.;
view3D.imagePan[1] = 0.;
view3D.imageZoom = 1.;
//
// Reset the center of rotation.
//
view3D.centerOfRotationSet = false;
view3D.centerOfRotation[0] = view3D.focus[0];
view3D.centerOfRotation[1] = view3D.focus[1];
view3D.centerOfRotation[2] = view3D.focus[2];
// Copy the object into this.
*this = view3D;
}
Target: xml2python
Function: View3DAttributes_RotateAxis
Declaration: View3DAttributes_RotateAxis
......
......@@ -127,7 +127,8 @@ public:
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
// User-defined methods
void RotateAxis(int axis, double angle);
void View3DAttributes::RotateAxis(int axis, double angle);
void View3DAttributes::ResetView(const double *bbox);
// IDs that can be used to identify fields in case statements
enum {
......
......@@ -50,6 +50,8 @@
</Field>
<Function name="RotateAxis" user="true" member="true">
</Function>
<Function name="ResetView" user="true" member="true">
</Function>
<Function name="View3DAttributes_RotateAxis" user="true" member="true">
</Function>
<Include file="source" quoted="false">
......
......@@ -5937,14 +5937,13 @@ else
echo "${ECHO_T}no" >&6
fi
echo "$as_me:$LINENO: checking for strerror in -lcposix" >&5
echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6
if test "${ac_cv_lib_cposix_strerror+set}" = set; then
echo "$as_me:$LINENO: checking for library containing strerror" >&5
echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
if test "${ac_cv_search_strerror+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcposix $LIBS"
ac_func_search_save_LIBS=$LIBS
ac_cv_search_strerror=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
......@@ -5989,24 +5988,80 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_cposix_strerror=yes
ac_cv_search_strerror="none required"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_cposix_strerror=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
if test "$ac_cv_search_strerror" = no; then
for ac_lib in cposix; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char strerror ();
int
main ()
{
strerror ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_search_strerror="-l$ac_lib"
break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_cposix_strerror" >&5
echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6
if test $ac_cv_lib_cposix_strerror = yes; then
LIBS="$LIBS -lcposix"
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
done
fi
LIBS=$ac_func_search_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
echo "${ECHO_T}$ac_cv_search_strerror" >&6
if test "$ac_cv_search_strerror" != no; then
test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS"
fi
BUILD_FORTRAN=""
......@@ -19868,7 +19923,12 @@ fi
SIMULATION_PROTOTYPE_FILES="sim/Makefile
sim/examples/Makefile
sim/V1/Makefile
sim/V2/Makefile"
sim/V1/lib/Makefile
sim/V1/runtime/Makefile
sim/V2/Makefile
sim/V2/lib/Makefile
sim/V2/runtime/Makefile"
CQSCORE_FILES="cqscore/Makefile"
THIRD_PARTY_BUILTIN_FILES="third_party_builtin/Makefile
third_party_builtin/zlib/Makefile
......
......@@ -4073,7 +4073,12 @@ fi
SIMULATION_PROTOTYPE_FILES="sim/Makefile
sim/examples/Makefile
sim/V1/Makefile
sim/V2/Makefile"
sim/V1/lib/Makefile
sim/V1/runtime/Makefile
sim/V2/Makefile
sim/V2/lib/Makefile
sim/V2/runtime/Makefile"
CQSCORE_FILES="cqscore/Makefile"
THIRD_PARTY_BUILTIN_FILES="third_party_builtin/Makefile
third_party_builtin/zlib/Makefile
......
This diff is collapsed.
......@@ -99,7 +99,6 @@ class avtSimV2FileFormat : public avtSTMDFileFormat
avtSpecies *GetSpecies(int, const char *);
avtSimulationInformation simInfo;
VisIt_SimulationCallback cb;
std::set<std::string> curveMeshes;
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *);
......
This diff is collapsed.
......@@ -88,7 +88,6 @@ private:
std::string objectName;
stringVector varList;
int numblocks;
VisIt_SimulationCallback cb;
void WriteCurvilinearMesh(vtkStructuredGrid *,
int, VisIt_MeshMetaData *);
......
......@@ -2289,6 +2289,10 @@ Engine::EngineAbortCallback(void *data)
// Jeremy Meredith, Thu Aug 7 16:23:46 EDT 2008
// Removed unused vars.
//
// Brad Whitlock, Tue Mar 3 10:37:02 PST 2009
// I made it okay to call this function without an RPC since RPC's are no
// longer the only way to instigate engine functions into being called.
//
// ****************************************************************************
void
......@@ -2296,9 +2300,8 @@ Engine::EngineUpdateProgressCallback(void *data, const char *type, const char *d
int cur, int total)
{
NonBlockingRPC *rpc = (NonBlockingRPC*)data;
if (!rpc)
EXCEPTION1(VisItException,
"EngineUpdateProgressCallback called with no RPC set.");
if (rpc == 0)
return;
if (total == 0 && rpc->GetMaxStageNum() < 30)
{
......@@ -2370,18 +2373,21 @@ Engine::EngineUpdateProgressCallback(void *data, const char *type, const char *d
// Jeremy Meredith, Thu Jul 10 11:37:48 PDT 2003
// Made the engine an object.
//
// Brad Whitlock, Tue Mar 3 10:37:02 PST 2009
// I made it okay to call this function without an RPC since RPC's are no
// longer the only way to instigate engine functions into being called.
//
// ****************************************************************************
void
Engine::EngineInitializeProgressCallback(void *data, int nStages)
{
NonBlockingRPC *rpc = (NonBlockingRPC*)data;
if (!rpc)
EXCEPTION1(VisItException,
"EngineInitializeProgressCallback called with no RPC set.");
if (nStages > 0)
rpc->SendStatus(0, 1, "Starting execution", nStages+1);
{
if(rpc != 0)
rpc->SendStatus(0, 1, "Starting execution", nStages+1);
}
else
debug1 << "ERROR: EngineInitializeProgressCallback called "
<< "with nStages == 0" << endl;
......@@ -2559,11 +2565,13 @@ Engine::SimulationTimeStepChanged()
// Creation: Thu Jan 25 15:07:29 PST 2007
//
// Modifications:
//
// Brad Whitlock, Thu Feb 26 13:59:36 PST 2009
// I changed the argument to std::string.
//
// ****************************************************************************
void
Engine::SimulationInitiateCommand(const char *command)
Engine::SimulationInitiateCommand(const std::string &command)
{
if(!quitRPC->GetQuit())
{
......@@ -2572,6 +2580,50 @@ Engine::SimulationInitiateCommand(const char *command)
}
}
// ****************************************************************************
// Method: Engine::Message
//
// Purpose:
// This method lets the engine send a message back to the viewer.
//
// Arguments:
// msg : The message to send back to the viewer.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 26 13:59:47 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
Engine::Message(const std::string &msg)
{
SimulationInitiateCommand(std::string("Message:") + msg);
}
// ****************************************************************************
// Method: Engine::Error
//
// Purpose:
// This method lets the engine send an error message back to the viewer.
//
// Arguments:
// msg : The message to send back to the viewer.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 26 13:59:47 PST 2009
//
// Modifications:
//
// ****************************************************************************
void
Engine::Error(const std::string &msg)
{
SimulationInitiateCommand(std::string("Error:") + msg);
}
// ****************************************************************************
// Method: Engine::Disconnect
//
......@@ -2849,3 +2901,34 @@ ResetEngineTimeout(void *p, int secs)
}
e->ResetTimeout(secs);
}
// ****************************************************************************
// Method: Engine::SaveWindow
//
// Purpose:
// Tells the network manager to render and save a window.
//
// Arguments:
// filename : The filename in which to save an image.
// imageWidth : The width of the image to save.
// imageHeight: The height of the image to save.
// fmt : The file format to use for the saved image.
//
// Returns: True if the image was saved; false otherwise.
//
// Note: If imageWidth and imageHeight are <=0 then they are ignored and
// the previous image resolution is used.
//
// Programmer: Brad Whitlock
// Creation: Mon Mar 2 16:14:07 PST 2009
//
// Modifications:
//
// ****************************************************************************
bool
Engine::SaveWindow(const std::string &filename, int imageWidth, int imageHeight,
SaveWindowAttributes::FileFormat fmt)
{
return netmgr->SaveWindow(filename, imageWidth, imageHeight, fmt);
}
......@@ -83,6 +83,7 @@ class Xfer;
#include <avtDataObjectWriter.h>
#include <ParentProcess.h>
#include <BufferConnection.h>
#include <SaveWindowAttributes.h>
#ifdef PARALLEL
#include <parallel.h>
......@@ -189,6 +190,12 @@ class Xfer;
// Instance variable to store what kind of display we'll render with, and
// made SetupDisplay a method.
//
// Brad Whitlock, Thu Feb 26 14:03:25 PST 2009
// I added Message and Error so we can send messages to the simulation user.
//
// Brad Whitlock, Mon Mar 2 16:11:36 PST 2009
// I added a SaveWindow method.
//
// ****************************************************************************
class Engine
......@@ -207,12 +214,16 @@ class Engine
void PopulateSimulationMetaData(const std::string &db,
const std::string &fmt);
void SimulationTimeStepChanged();
void SimulationInitiateCommand(const char *);
void SimulationInitiateCommand(const std::string &);
void SetSimulationCommandCallback(void(*)(const char*,
int,float,const char*));
void ExecuteSimulationCommand(const std::string&,
int,float,const std::string&);
static void DisconnectSimulation();
void Message(const std::string &msg);
void Error(const std::string &msg);
bool SaveWindow(const std::string &, int, int,
SaveWindowAttributes::FileFormat);
// Two event loops
bool EventLoop();
......
......@@ -1242,14 +1242,21 @@ RPCExecutor<ReleaseDataRPC>::Execute(ReleaseDataRPC *rpc)
// Brad Whitlock, Tue Jun 24 16:02:10 PDT 2008
// Changed how the database plugin manager is accessed.
//
// Brad Whitlock, Thu Feb 26 14:05:27 PST 2009
// I added code to send engine error messages back to the viewer. It's
// done differently than some other RPC's because this RPC is non-blocking.
// This means we can't send the message back to the viewer via RPC results.
// This mechanism is probably only good for simulations presently.
//
// ****************************************************************************
template<>
void
RPCExecutor<OpenDatabaseRPC>::Execute(OpenDatabaseRPC *rpc)
{
Engine *engine = Engine::Instance();
TRY
{
Engine *engine = Engine::Instance();
NetworkManager *netmgr = engine->GetNetMgr();
debug2 << "Executing OpenDatabaseRPC: db="
......@@ -1273,8 +1280,9 @@ RPCExecutor<OpenDatabaseRPC>::Execute(OpenDatabaseRPC *rpc)
engine->PopulateSimulationMetaData(rpc->GetDatabaseName(),
rpc->GetFileFormat());
}
CATCH(VisItException)