Skip to content

Commit

Permalink
Refs #7429. First cut at turning 4D back on.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Oct 9, 2013
1 parent ea36b3f commit 2776c4e
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
The set the viewing limit to the top percentile of the denses boxes.
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty
name="TimestepValues"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available timestep values.
</Documentation>
</DoubleVectorProperty>
<StringVectorProperty
name="TimeLabelAnnotation"
information_only="1"
si_class="vtkSITimeLabelProperty">
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
<!-- End SplatterPlot -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnstructuredGridAlgorithm.h"
#include "vtkUnstructuredGrid.h"

Expand Down Expand Up @@ -75,6 +76,14 @@ void vtkSplatterPlot::SetTopPercentile(double topPercentile)
}
}

/**
* Getter for the time
* @return the time.
*/
double vtkSplatterPlot::getTime() const
{
return m_time;
}

int vtkSplatterPlot::RequestData(vtkInformation *,
vtkInformationVector **inputVector,
Expand All @@ -87,6 +96,13 @@ int vtkSplatterPlot::RequestData(vtkInformation *,
vtkDataSet *output = vtkDataSet::SafeDownCast(
outInfo->Get(vtkDataObject::DATA_OBJECT()));

if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
{
// usually only one actual step requested
m_time = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
}
m_presenter->setTime(m_time);

vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkDataSet *input = vtkDataSet::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
Expand Down Expand Up @@ -145,12 +161,10 @@ void vtkSplatterPlot::PrintSelf(ostream& os, vtkIndent indent)
/**
* Output the progress information and progress text.
* @param : progress
*@param : message
* @param : message
*/
void vtkSplatterPlot::updateAlgorithmProgress(double progress, const std::string& message)
{
this->SetProgress(progress);
this->SetProgressText(message.c_str());
}


Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class VTK_EXPORT vtkSplatterPlot : public vtkUnstructuredGridAlgorithm
public:
static vtkSplatterPlot *New();
vtkTypeMacro(vtkSplatterPlot, vtkUnstructuredGridAlgorithm);
double getTime() const;
void PrintSelf(ostream& os, vtkIndent indent);
void SetNumberOfPoints(int nPoints);
void SetTopPercentile(double topPercentile);
Expand All @@ -38,9 +39,10 @@ class VTK_EXPORT vtkSplatterPlot : public vtkUnstructuredGridAlgorithm
Mantid::VATES::vtkSplatterPlotFactory *m_presenter;
/// Holder for the workspace name
std::string m_wsName;
/// Time.
double m_time;

vtkSplatterPlot(const vtkSplatterPlot&);
void operator = (const vtkSplatterPlot&);

};
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class DLLExport vtkSplatterPlotFactory : public vtkDataSetFactory
/// Set percentage of boxes from which points will be plotted
virtual void SetPercentToUse(double percentToUse);

/// Set the time value.
void setTime(double timeStep);

private:

template<typename MDE, size_t nd>
Expand Down Expand Up @@ -117,7 +120,8 @@ class DLLExport vtkSplatterPlotFactory : public vtkDataSetFactory
/// Variable to hold sorted list, so sort doesn't have to be repeated
mutable std::vector< Mantid::API::IMDNode * > m_sortedBoxes;


/// Time value.
double m_time;
};

}
Expand Down
27 changes: 25 additions & 2 deletions Code/Mantid/Vates/VatesAPI/src/vtkSplatterPlotFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ namespace VATES
// Find out how many events to plot, and the percentage of the largest
// boxes to use.
size_t totalPoints = ws->getNPoints();
std::cout << "AAA: " << totalPoints << ", " << m_numPoints << std::endl;
size_t numPoints = m_numPoints;

if (numPoints > totalPoints)
{
numPoints = totalPoints;
Expand Down Expand Up @@ -128,6 +130,7 @@ namespace VATES
size_t newPoints = box->getNPoints();
if (newPoints > 0)
{
std::cout << "D: (" << i << "): " << newPoints << std::endl;
m_sortedBoxes.push_back(box);
}
}
Expand All @@ -144,7 +147,7 @@ namespace VATES
std::cout << "DONE SORTING" << std::endl;
}
}

std::cout << "GG: " << m_sortedBoxes.size() << std::endl;
size_t num_boxes_to_use = static_cast<size_t>(percent_to_use * static_cast<double>(m_sortedBoxes.size()) / 100.0);
if (num_boxes_to_use >= m_sortedBoxes.size())
{
Expand All @@ -157,6 +160,7 @@ namespace VATES
for (size_t i = 0; i < num_boxes_to_use; i++)
{
size_t newPoints = m_sortedBoxes[i]->getNPoints();
std::cout << "E: (" << i << "): " << newPoints << std::endl;
total_points_available += newPoints;
}

Expand Down Expand Up @@ -313,6 +317,7 @@ namespace VATES
}

size_t nd = m_workspace->getNumDims();
std::cout << "AA: " << m_workspace->getNPoints() << std::endl;

Mantid::Kernel::ReadLock lock(*m_workspace);
if (nd > 3)
Expand All @@ -329,6 +334,8 @@ namespace VATES
// Define where the slice is in 4D
// TODO: Where to slice? Right now is just 0
std::vector<coord_t> point(nd, 0);
std::cout << "BB: " << m_time << std::endl;
point[3] = coord_t(m_time); //Specifically for 4th/time dimension.

// Define two opposing planes that point in all higher dimensions
std::vector<coord_t> normal1(nd, 0);
Expand All @@ -354,7 +361,7 @@ namespace VATES
// Clean up
if (this->slice)
{
delete this->sliceMask;
delete[] this->sliceMask;
delete this->sliceImplicitFunction;
}

Expand Down Expand Up @@ -388,11 +395,13 @@ namespace VATES
{
throw std::runtime_error("Invalid vtkSplatterPlotFactory. Workspace must have at least 3 dimensions.");
}
/*
size_t nd = m_workspace->getNonIntegratedDimensions().size();
if (nd > 3)
{
throw std::runtime_error("SplatterPlot cannot handle 4D data, please integrate to 3D!");
}
*/
}

/**
Expand Down Expand Up @@ -429,5 +438,19 @@ namespace VATES
}
}

/**
* Set the time value.
* @param double : the time
*/
void vtkSplatterPlotFactory::setTime(double time)
{
std::cout << "GG: " << time << ", " << m_time << std::endl;
if (m_time != time)
{
m_buildSortedList = true;
}
m_time = time;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ void SplatterPlotView::render()
QString renderType = "Points";
pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();

/*
if (this->checkForBadDimensions(src))
{
return;
}

*/
// Do not allow overplotting of MDWorkspaces
if (!this->isPeaksWorkspace(src) && NULL != this->splatSource)
{
Expand Down

0 comments on commit 2776c4e

Please sign in to comment.