Commit a96270ff authored by fogal1's avatar fogal1

Squashed commit of the following:

commit 955893b9b758e381158b85082fc8814d8b706da6
Author: Tom Fogal <tfogal@alumni.unh.edu>
Date:   Wed Jun 11 14:17:33 2008 -0400

    Split up NetworkManager::Render
    * Save internal render state w/in NM, not the method.
    * Created RenderSetup and RenderCleanup.
    * Helper methods for the former (private).

    Misc additions:
    * Add in StackTimer, which I thought I had committed last summer.
    * Added [] operator to array_ref_ptr.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@4398 18c085ea-50e0-402c-830e-de6fd14e8384
parent 46b819e6
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, The Regents of the University of California
* Produced at the Lawrence Livermore National Laboratory
* All rights reserved.
*
* This file is part of VisIt. For details, see http://www.llnl.gov/visit/. 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 materials provided with the distribution.
* - Neither the name of the UC/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 THE REGENTS OF THE UNIVERSITY OF
* CALIFORNIA, 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.
*
*****************************************************************************/
// ************************************************************************* //
// StackTimer.h //
// ************************************************************************* //
#ifndef STACK_TIMER_H
#define STACK_TIMER_H
#include <TimingsManager.h>
// ****************************************************************************
// Class: StackTimer
//
// Purpose:
// Simplified mechanism for timing blocks of code. Create a StackTimer on
// the stack and it will record timing information when it goes out of
// scope. For example:
//
// if(doLongComplicatedTask) {
// StackTimer task_identifier("my task");
// this->Function();
// }
//
// For short blocks, it may be easier to use the macro:
//
// TimedCodeBlock("my task", this->Function());
//
// Programmer: Tom Fogal
// Creation: July 2, 2007
//
// Modifications:
//
// ****************************************************************************
class MISC_API StackTimer
{
public:
StackTimer(const char *msg) {
this->message = std::string(msg);
this->timer_index = visitTimer->StartTimer();
}
~StackTimer() {
visitTimer->StopTimer(this->timer_index, this->message);
}
private:
// Unimplemented. It does not make sense to have a timer without a
// message: there will be no way to identify it.
StackTimer();
// Unimplemented. You should not be trying to pass timers around.
StackTimer(const StackTimer &);
const StackTimer & operator =(const StackTimer &);
// Unimplemented. Allowing pointers would prevent automatic destruction
// and defeat the whole purpose.
static void *operator new(size_t);
private:
std::string message;
int timer_index;
};
#define TimedCodeBlock(msg, block) \
do { \
StackTimer _generic_stack_timer(msg); \
block; \
} while(0)
#endif /* STACK_TIMER_H */
......@@ -53,6 +53,11 @@
// Programmer: Hank Childs
// Creation: September 17, 2001
//
// Modifications:
//
// Tom Fogal, Mon Jun 9 14:30:36 EDT 2008
// Added [] operator, for direct array access.
//
// ****************************************************************************
template <class T>
......@@ -69,6 +74,8 @@ class array_ref_ptr
const T *operator*() const;
T *operator->();
const T *operator->() const;
T &operator[](size_t idx);
const T &operator[](size_t idx) const;
template <class S> void CopyTo(array_ref_ptr<S> &);
void Print(ostream&);
private:
......@@ -156,6 +163,20 @@ array_ref_ptr<T>::operator->() const
return p;
}
template <class T>
inline T &
array_ref_ptr<T>::operator[](size_t idx)
{
return p[idx];
}
template <class T>
const T &
array_ref_ptr<T>::operator[](size_t idx) const
{
return p[idx];
}
template <class T>
void
array_ref_ptr<T>::AddReference(T *p_, int *n_)
......
This diff is collapsed.
......@@ -312,6 +312,13 @@ typedef void (*ProgressCallback)(void *, const char *, const char *,int,int);
// Cyrus Harrison, Tue Feb 19 08:42:51 PST 2008
// Removed dumpRenders (now controled by avtDebugDumpOptions)
//
// Tom Fogal, Mon Jun 9 09:34:09 EDT 2008
// Added methods to start splitting up Render(). This works by adding some
// additional state to the object, via the render_state struct.
//
// Tom Fogal, Tue Jun 10 15:50:19 EDT 2008
// More of the above; `RenderCleanup' today.
//
// Mark C. Miller, Tue Jun 10 15:57:15 PDT 2008
// Added bool for ignoring extents to StartNetwork / GetDBFromCache
//
......@@ -319,7 +326,21 @@ typedef void (*ProgressCallback)(void *, const char *, const char *,int,int);
class NetworkManager
{
typedef std::map<std::string, stringVector> StringVectorMap;
typedef std::map<std::string, stringVector> StringVectorMap;
struct render_state {
DataNetwork *origWorkingNet; /* saves this->workingNet */
array_ref_ptr<int> cellCounts; /* # of cells, per network */
int stereoType; /* for push/popping stereo rendering */
int annotMode;
int timer; /* handle for overall render time */
bool getZBuffer; /* should we readback Z too? */
bool handledAnnotations; /* annotations already done? */
bool handledCues;
bool haveImagePlots; /* image based plots? (2d rendering) */
bool needToSetUpWindowContents;
bool viewportedMode;
};
public:
NetworkManager(void);
~NetworkManager(void);
......@@ -402,10 +423,24 @@ class NetworkManager
static void SetStereoEnabled();
protected:
void RenderSetup(intVector networkIds, bool getZBuffer,
int annotMode, int windowID, bool leftEye);
void RenderCleanup(int windowID);
private:
void UpdateVisualCues(int winID);
void NewVisWindow(int winID);
void UpdateVisualCues(int winID);
void NewVisWindow(int winID);
bool PlotsNeedUpdating(const intVector &plots,
const intVector &plotsInWindow) const;
bool ViewerExecute(const VisWindow * const viswin,
const intVector &plots,
const WindowAttributes &windowAttributes);
void SetUpWindowContents(int windowID, const intVector &plotIds,
bool forceViewerExecute);
std::vector<DataNetwork*> networkCache;
std::vector<int> globalCellCounts;
......@@ -438,6 +473,8 @@ class NetworkManager
static void CallInitializeProgressCallback(int);
static void CallProgressCallback(const char *, const char*,
int, int);
struct render_state r_mgmt;
};
#endif
../../common/misc/StackTimer.h
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment