Commit ce8934de authored by miller86's avatar miller86

2.9RC->Trunk

* I discovered a header file had #define NDEBUG 1. It was confined to
  Poincare operator and plot but out of caution I removed that line anyways.
* I fixed a bug in Silo reader causing a crash whenever a ucdmesh with
  no zonelist, facelist, edgelist or phzonelist was defined. I made the
  reader treat it like a point mesh. This is #2111 in the tracker.
* I fixed a bug in Namescheme that was terminating an inner loop correctly
  and causing a valgrind error.
* I fixed a bug in Namescheme_test where a namescheme being tested was mal-formed.
* I fixed a problem with avtMaterial constructor for the case of full zonal
  arrays for the volume fractions. The constructor wasn't robust in the presence
  of numerically likely but nonehtless mal-formed volume fractions (e.g. one
  material has frac>=1 and still another >0. The logic caused that case to
  skip an entry in the mix arrays leaving it uninitialized. Later in 
  avtUnstructuredDomainBoundaries::ExchangeMixedMaterials, it would cause
  a SEGV.
* I fixed a valgrind error in avtUnstructuredDomainBoundaries::ExchangeMixedMaterials
  where several memcpy calls were overrunning the end of the source buffers.
* I fixed a problem where Exodus plugin's auto-expression logic caused a SEGV if
  a candidate vector had fewer than 3 components.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@25732 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4ca08809
......@@ -806,8 +806,18 @@ avtUnstructuredDomainBoundaries::ExchangeMaterial(vector<int> domainNum,
// Programmer: Hank Childs
// Creation: February 13, 2007
//
// Modifications:
//
// Mark C. Miller, Mon Feb 9 17:11:23 PST 2015
// Adjust memcpy calls to copy minimum size of old/new buffers. I used
// MIN instead of always using old sizes because I was not absolutely sure
// whether the new sizes could indeed be smaller.
// ****************************************************************************
#ifndef MIN
#define MIN(A,B) ((A)>(B)?(B):(A))
#endif
vector<avtMaterial*>
avtUnstructuredDomainBoundaries::ExchangeMixedMaterials(vector<int> domainNum,
vector<avtMaterial*> mats)
......@@ -833,8 +843,10 @@ avtUnstructuredDomainBoundaries::ExchangeMixedMaterials(vector<int> domainNum,
//
// Estimate the sizes we will need for the new object.
//
int newNCells = oldMat->GetNZones();
int newMixlen = oldMat->GetMixlen();
int oldNCells = oldMat->GetNZones();
int oldMixlen = oldMat->GetMixlen();
int newNCells = oldNCells;
int newMixlen = oldMixlen;
for (int j = 0 ; j < nTotalDomains ; j++)
{
newNCells += nGainedCells[j][domainNum[i]];
......@@ -846,23 +858,23 @@ avtUnstructuredDomainBoundaries::ExchangeMixedMaterials(vector<int> domainNum,
//
int *new_matlist = new int[newNCells];
const int *old_matlist = mats[i]->GetMatlist();
memcpy(new_matlist, old_matlist, sizeof(int)*newNCells);
memcpy(new_matlist, old_matlist, sizeof(int)*MIN(oldNCells,newNCells));
int *new_mix_next = new int[newMixlen];
const int *old_mix_next = mats[i]->GetMixNext();
memcpy(new_mix_next, old_mix_next, sizeof(int)*newMixlen);
memcpy(new_mix_next, old_mix_next, sizeof(int)*MIN(oldMixlen,newMixlen));
int *new_mix_mat = new int[newMixlen];
const int *old_mix_mat = oldMat->GetMixMat();
memcpy(new_mix_mat, old_mix_mat, sizeof(int)*newMixlen);
memcpy(new_mix_mat, old_mix_mat, sizeof(int)*MIN(oldMixlen,newMixlen));
float *new_mix_vf = new float[newMixlen];
const float *old_mix_vf = oldMat->GetMixVF();
memcpy(new_mix_vf, old_mix_vf, sizeof(float)*newMixlen);
memcpy(new_mix_vf, old_mix_vf, sizeof(float)*MIN(oldMixlen,newMixlen));
int *new_mix_zone = new int[newMixlen];
const int *old_mix_zone = oldMat->GetMixZone();
memcpy(new_mix_zone, old_mix_zone, sizeof(int)*newMixlen);
memcpy(new_mix_zone, old_mix_zone, sizeof(int)*MIN(oldMixlen,newMixlen));
//
// Now copy over the ghost information. By iterating over the
......@@ -886,21 +898,19 @@ avtUnstructuredDomainBoundaries::ExchangeMixedMaterials(vector<int> domainNum,
{
// Decode how many materials in the cell.
new_matlist[matlist_cnt] = -(mixlen_cnt+1);
matlist_cnt++;
int nmats = -matlist[j][domainNum[i]][k];
matlist_cnt++;
for (int l = 0 ; l < nmats ; l++)
{
new_mix_mat[mixlen_cnt] = mixm[j][domainNum[i]][lml];
new_mix_vf[mixlen_cnt] = mixvf[j][domainNum[i]][lml];
new_mix_zone[mixlen_cnt] = -1;
new_mix_next[mixlen_cnt] =
(l < nmats-1 ? mixlen_cnt+2 : 0);
new_mix_next[mixlen_cnt] = (l < nmats-1 ? mixlen_cnt+2 : 0);
lml++;
mixlen_cnt++;
}
}
}
}
out[i] = new avtMaterial(oldMat->GetNMaterials(),
......
This diff is collapsed.
......@@ -162,6 +162,9 @@ struct MatZoneMap
// fraction for a material in a zone. Also an internal variable,
// mixalloc, which specifies how long the mixed arrays have been allocated.
//
// Mark C. Miller, Wed Feb 11 17:02:22 PST 2015
// Added AssertSelfIsValid which is only ever active in debug builds. It
// does a more thorough check of the material object that gets constucted.
// ****************************************************************************
class PIPELINE_API avtMaterial
......@@ -301,6 +304,7 @@ class PIPELINE_API avtMaterial
// meaningful, that's fine.
avtMaterial(const avtMaterial &) {;};
avtMaterial &operator=(const avtMaterial &) { return *this; };
void AssertSelfIsValid() const;
};
......
......@@ -354,6 +354,9 @@ char * Namescheme::retstrbuf[max_retstrs];
// Also, to support constant valued strings (e.g. namescheme strings with
// no conversion specs (%), allowed for them to NOT require being lead
// with the delimiter character.
//
// Mark C. Miller, Wed Feb 11 16:58:15 PST 2015
// Fix a problem with loop termination with string ends with delim char.
// ****************************************************************************
Namescheme::Namescheme(const char *fmt, ...)
{
......@@ -491,7 +494,8 @@ Namescheme::Namescheme(const char *fmt, ...)
this->exprtrees[ncspecs] = BuildExprTree((const char **) &exprstr1);
free(exprstr2);
ncspecs++;
if (fmt[i] == '\0')
if ((fmt[i] == '\0') ||
(fmt[i] == this->delim && fmt[i+1] == '\0'))
done = 1;
n = i;
}
......
......@@ -158,7 +158,7 @@ int main()
delete ns;
// Text Exodus material volume fraction variable convention
ns = new Namescheme("@%s@n>?'&VOLFRC_%d&n':'VOID_FRC':@");
ns = new Namescheme("@%s@n?'&VOLFRC_%d&n':'VOID_FRC':@");
if (strcmp(ns->GetName(0), "VOID_FRC") != 0) return 1;
if (strcmp(ns->GetName(1), "VOLFRC_1") != 0) return 1;
if (strcmp(ns->GetName(2), "VOLFRC_2") != 0) return 1;
......
......@@ -282,7 +282,7 @@ static void fill_tmp_suffixes(int n, ...)
fill_tmp_suffixes STRLIST; \
int q = 0; \
bool things_match = true; \
while (tmp_suffixes[q] && things_match) \
while (list[i+q] && tmp_suffixes[q] && things_match) \
{ \
char sepStr[2] = {sepChar, '\0'}; \
char ex_var_name[256]; \
......
......@@ -60,6 +60,8 @@ using namespace ExodusDBOptions;
// Programmer: miller -- generated by xml2avt
// Mark C. Miller, Tue Dec 9 10:04:22 PST 2014
//
// Mark C. Miller, Wed Feb 11 17:05:25 PST 2015
// Elaborated on help string for defining expressions.
// ****************************************************************************
DBOptionsAttributes *
......@@ -85,7 +87,8 @@ GetExodusReadOptions(void)
"<p><b>%s</b>: Checking this option will cause the plugin to try to guess that similarly "
"named variables are the scalar components of an aggregate type such as a vector, "
"tensor or array variable. The plugin will then automatically define expressions "
"for these aggregate typed variables."
"for these aggregate typed variables. Note that this is just a convenience to free "
"users from having to define expressions manally within their VisIt session."
"<p> "
"<p><b>%s</b>: Ordinarily, the plugin will determine the material count from the "
"material convention nameschemes. However, if it is having trouble getting the "
......
......@@ -65,10 +65,11 @@ namespace ExodusDBOptions
char const * const EXODUS_MATSPEC_NAMESCHEME = "Namescheme for material specific variables";
// Read options default values
char const * const EXODUS_VOLFRAC_NAMESCHEME_ALEGRA = "@%s@n>?'&VOLFRC_%d&n':'VOID_FRC':@";
// Note that the n>0 path specifies a namescheme sub-expression bracketed by '&' chars.
char const * const EXODUS_VOLFRAC_NAMESCHEME_ALEGRA = "@%s@n?'&VOLFRC_%d&n&':'VOID_FRC':@";
char const * const EXODUS_MATSPEC_NAMESCHEME_ALEGRA = "@%V_%d@n";
char const * const EXODUS_VOLFRAC_NAMESCHEME_CTH = "@%s@n>?'&VOLM_%d&n':'VOID_FRC':@";
char const * const EXODUS_VOLFRAC_NAMESCHEME_CTH = "@%s@n?'&VOLM_%d&n&':'VOID_FRC':@";
char const * const EXODUS_MATSPEC_NAMESCHEME_CTH = "@%V_%d@n";
}
......
......@@ -9491,6 +9491,8 @@ RemapFacelistForPolyhedronZones(DBfacelist *sfl, DBzonelist *szl)
// Kathleen Biagas, Wed Sep 17 09:56:05 PDT 2014
// Create avtOriginaNodeNumbers array when nodes added (eg arb poly).
//
// Mark C. Miller, Wed Feb 11 17:06:02 PST 2015
// Made it return a point mesh for a DBucdmesh with no topology defined.
// ****************************************************************************
vtkDataSet *
......@@ -9546,6 +9548,45 @@ avtSiloFileFormat::GetUnstructuredMesh(DBfile *dbfile, const char *mn,
EXCEPTION1(InvalidVariableException, "The Silo reader supports only "
"float and double precision coordinates in unstructured meshes.");
}
//
// Quick check to see if this is really a point mesh
//
if (um->faces == 0 && um->zones == 0 && um->edges == 0 && um->phzones == 0)
{
//
// Create the VTK objects and connect them up.
//
vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New();
ugrid->SetPoints(points);
ugrid->Allocate(um->nnodes);
vtkIdType onevertex[1];
for (int i = 0 ; i < um->nnodes; i++)
{
onevertex[0] = i;
ugrid->InsertNextCell(VTK_VERTEX, 1, onevertex);
}
//
// If we have global node ids, set them up and cache 'em
//
if (um->gnodeno != NULL)
{
vtkDataArray *arr = CreateDataArray(um->gnznodtype, um->gnodeno, um->nnodes);
um->gnodeno = 0; // vtkDataArray now owns the data.
//
// Cache this VTK object but in the VoidRefCache, not the VTK cache
// so that it can be obtained through the GetAuxiliaryData call
//
void_ref_ptr vr = void_ref_ptr(arr, avtVariableCache::DestructVTKObject);
cache->CacheVoidRef(mn, AUXILIARY_DATA_GLOBAL_NODE_IDS, timestep, domain, vr);
}
points->Delete();
DBFreeUcdmesh(um);
return ugrid;
}
//
// We already got the facelist read in free of charge. Let's use it.
......
......@@ -39,8 +39,6 @@
#ifndef __SKELET_H_INCLUDED
#define __SKELET_H_INCLUDED
#define NDEBUG 1
#include <math.h>
#include <assert.h>
#include <iostream>
......
......@@ -39,8 +39,6 @@
#ifndef __SKELET_H_INCLUDED
#define __SKELET_H_INCLUDED
#define NDEBUG 1
#include <math.h>
#include <assert.h>
#include <iostream>
......
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