Commit afe100c7 authored by bonnell's avatar bonnell

Make YoungsMIR match behavior of ZooMIR when passed and empty mats object. Resolves #1554.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22524 18c085ea-50e0-402c-830e-de6fd14e8384
parent 90b0cc1b
......@@ -71,6 +71,7 @@ using std::vector;
// ****************************************************************************
YoungsMIR::YoungsMIR()
{
nmats = 0;
}
// ****************************************************************************
......@@ -122,7 +123,7 @@ YoungsMIR::ReconstructMesh(vtkDataSet *orig_ds, avtMaterial *orig_mat, int dim)
visitTimer->StopTimer(th_packmat, "MIR: Pack material");
//vector<string> matNames = mat->GetMaterials();
int nmats = mat->GetNMaterials();
nmats = mat->GetNMaterials();
int ncells = ds->GetNumberOfCells();
vector<vtkFloatArray *>vf(nmats);
for (int m=0; m<nmats; m++)
......@@ -298,6 +299,9 @@ YoungsMIR::Reconstruct2DMesh(vtkDataSet *ds, avtMaterial *mat)
// Jeremy Meredith, Mon Jan 4 15:09:23 EST 2010
// Added some timings.
//
// Kathleen Biagas, Wed Dec 18 11:21:12 PST 2013
// Return all materials if mats is empty. (To match behavior of ZooMIR).
//
// ****************************************************************************
vtkDataSet *
YoungsMIR::GetDataset(std::vector<int> mats, vtkDataSet *ds,
......@@ -305,31 +309,42 @@ YoungsMIR::GetDataset(std::vector<int> mats, vtkDataSet *ds,
bool doMats,
avtMaterial *mat)
{
if (mats.size() == 0)
return NULL;
bool doAllMats = mats.size() == 0;
int timerHandle = visitTimer->StartTimer();
// Collect up all the data sets we're asked for
vector<int> matIndex;
vector<vtkDataSet*> matDS;
for (unsigned int i=0; i<mats.size(); i++)
if (!doAllMats)
{
int matno = mats[i];
int index = -1;
for (unsigned int m=0; m<mapUsedMatToMat.size(); m++)
for (unsigned int i=0; i<mats.size(); i++)
{
if (mapUsedMatToMat[m] == matno)
int matno = mats[i];
int index = -1;
for (unsigned int m=0; m<mapUsedMatToMat.size(); m++)
{
index = m;
break;
if (mapUsedMatToMat[m] == matno)
{
index = m;
break;
}
}
}
if (index >= 0)
if (index >= 0)
{
matIndex.push_back(index);
matDS.push_back(output[index]);
}
}
}
else
{
for (int i = 0; i < nmats; i++)
{
matIndex.push_back(index);
matDS.push_back(output[index]);
matIndex.push_back(i);
matDS.push_back(output[i]);
}
}
......
......@@ -57,6 +57,8 @@
// Creation: April 2, 2009
//
// Modifications:
// Kathleen Biagas, Wed Dec 18 11:20:33 PST 2013
// Add nmats to track original number of materials.
//
// ****************************************************************************
class MIR_API YoungsMIR : public MIR
......@@ -83,7 +85,7 @@ class MIR_API YoungsMIR : public MIR
vtkDataSet **output;
std::vector<int> mapMatToUsedMat;
std::vector<int> mapUsedMatToMat;
int nmats;
};
......
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