1 
2 /*=========================================================================
3 
4   Program:   ParaView
5   Module:    vtkModelMetadata.cxx
6 
7   Copyright (c) Kitware, Inc.
8   All rights reserved.
9   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
10 
11      This software is distributed WITHOUT ANY WARRANTY; without even
12      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13      PURPOSE.  See the above copyright notice for more information.
14 
15 =========================================================================*/
16 /*----------------------------------------------------------------------------
17  Copyright (c) Sandia Corporation
18  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
19 ----------------------------------------------------------------------------*/
20 
21 #include "vtkModelMetadata.h"
22 #include "vtkCellData.h"
23 #include "vtkCharArray.h"
24 #include "vtkDataArray.h"
25 #include "vtkDataSet.h"
26 #include "vtkFieldData.h"
27 #include "vtkFloatArray.h"
28 #include "vtkIdList.h"
29 #include "vtkIdTypeArray.h"
30 #include "vtkIntArray.h"
31 #include "vtkObjectFactory.h"
32 #include "vtkPointData.h"
33 #include "vtkStringArray.h"
34 #include <ctime>
35 
36 vtkStandardNewMacro(vtkModelMetadata);
37 
38 #include <algorithm>
39 #include <map>
40 #include <set>
41 
42 class vtkModelMetadataSTLCloak
43 {
44 public:
45   std::set<int> IntSet;
46   std::map<int, int> IntMap;
47 };
48 
49 #undef FREE
50 #undef FREELIST
51 
52 #define FREE(x)                                                                                    \
53   {                                                                                                \
54     delete[] x;                                                                                    \
55     x = nullptr;                                                                                   \
56   }
57 
58 #define FREELIST(x, len)                                                                           \
59   if (x && (len))                                                                                  \
60   {                                                                                                \
61     for (i = 0; i < (len); i++)                                                                    \
62     {                                                                                              \
63       delete[] x[i];                                                                               \
64     }                                                                                              \
65     delete[] x;                                                                                    \
66     x = nullptr;                                                                                   \
67   }
68 
InitializeAllMetadata()69 void vtkModelMetadata::InitializeAllMetadata()
70 {
71   this->Title = nullptr;
72 
73   this->NumberOfInformationLines = 0;
74   this->InformationLine = nullptr;
75 
76   this->Dimension = 0;
77   this->CoordinateNames = nullptr;
78 
79   this->TimeStepIndex = -1;
80   this->NumberOfTimeSteps = 0;
81   this->TimeStepValues = nullptr;
82 
83   this->NumberOfBlocks = 0;
84 
85   this->BlockIds = nullptr;
86   this->BlockElementType = nullptr;
87   this->BlockNumberOfElements = nullptr;
88   this->BlockNodesPerElement = nullptr;
89   this->BlockNumberOfAttributesPerElement = nullptr;
90   this->BlockAttributes = nullptr;
91   this->BlockElementIdList = nullptr;
92 
93   this->NumberOfNodeSets = 0;
94 
95   this->NodeSetIds = nullptr;
96   this->NodeSetSize = nullptr;
97   this->NodeSetNumberOfDistributionFactors = nullptr;
98   this->NodeSetNodeIdList = nullptr;
99   this->NodeSetDistributionFactors = nullptr;
100 
101   this->NodeSetNodeIdListIndex = nullptr;
102   this->NodeSetDistributionFactorIndex = nullptr;
103 
104   this->NumberOfSideSets = 0;
105 
106   this->SideSetIds = nullptr;
107   this->SideSetSize = nullptr;
108   this->SideSetNumberOfDistributionFactors = nullptr;
109   this->SideSetElementList = nullptr;
110   this->SideSetSideList = nullptr;
111   this->SideSetNumDFPerSide = nullptr;
112   this->SideSetDistributionFactors = nullptr;
113 
114   this->SideSetListIndex = nullptr;
115   this->SideSetDistributionFactorIndex = nullptr;
116 
117   this->NumberOfBlockProperties = 0;
118   this->BlockPropertyNames = nullptr;
119   this->BlockPropertyValue = nullptr;
120 
121   this->NumberOfNodeSetProperties = 0;
122   this->NodeSetPropertyNames = nullptr;
123   this->NodeSetPropertyValue = nullptr;
124 
125   this->NumberOfSideSetProperties = 0;
126   this->SideSetPropertyNames = nullptr;
127   this->SideSetPropertyValue = nullptr;
128 
129   this->NumberOfGlobalVariables = 0;
130   this->GlobalVariableNames = nullptr;
131   this->GlobalVariableValue = nullptr;
132 
133   this->OriginalNumberOfElementVariables = 0;
134   this->OriginalElementVariableNames = nullptr;
135   this->NumberOfElementVariables = 0;
136   this->MaxNumberOfElementVariables = 0;
137   this->ElementVariableNames = nullptr;
138   this->ElementVariableNumberOfComponents = nullptr;
139   this->MapToOriginalElementVariableNames = nullptr;
140 
141   this->ElementVariableTruthTable = nullptr;
142 
143   this->OriginalNumberOfNodeVariables = 0;
144   this->OriginalNodeVariableNames = nullptr;
145   this->NumberOfNodeVariables = 0;
146   this->MaxNumberOfNodeVariables = 0;
147   this->NodeVariableNames = nullptr;
148   this->NodeVariableNumberOfComponents = nullptr;
149   this->MapToOriginalNodeVariableNames = nullptr;
150 }
InitializeAllIvars()151 void vtkModelMetadata::InitializeAllIvars()
152 {
153   this->InitializeAllMetadata();
154 
155   this->SumElementsPerBlock = 0;
156   this->BlockElementIdListIndex = nullptr;
157 
158   this->SizeBlockAttributeArray = 0;
159   this->BlockAttributesIndex = nullptr;
160 
161   this->SumNodesPerNodeSet = 0;
162   this->SumDistFactPerNodeSet = 0;
163 
164   this->NodeSetNodeIdListIndex = nullptr;
165   this->NodeSetDistributionFactorIndex = nullptr;
166 
167   this->SumSidesPerSideSet = 0;
168   this->SumDistFactPerSideSet = 0;
169 
170   this->SideSetListIndex = nullptr;
171   this->SideSetDistributionFactorIndex = nullptr;
172 
173   this->AllVariablesDefinedInAllBlocks = 0;
174 
175   this->BlockIdIndex = nullptr;
176 }
FreeAllGlobalData()177 void vtkModelMetadata::FreeAllGlobalData()
178 {
179   // All the fields which apply to the whole data set, and so
180   // don't differ depending on which time step, which blocks,
181   // or which variables are read in.
182 
183   this->SetTitle(nullptr);
184   this->SetInformationLines(0, nullptr);
185 
186   this->SetCoordinateNames(0, nullptr);
187   this->SetTimeSteps(0, nullptr);
188 
189   this->SetBlockIds(nullptr);
190   this->SetBlockElementType(nullptr);
191   this->SetBlockNodesPerElement(nullptr);
192   this->SetBlockNumberOfAttributesPerElement(nullptr);
193 
194   delete this->BlockIdIndex;
195   this->BlockIdIndex = nullptr;
196 
197   this->SetNodeSetNames(nullptr);
198   this->SetNodeSetIds(nullptr);
199   this->SetSideSetNames(nullptr);
200   this->SetSideSetIds(nullptr);
201 
202   this->SetBlockPropertyNames(0, nullptr);
203   this->SetBlockPropertyValue(nullptr);
204   this->SetNodeSetPropertyNames(0, nullptr);
205   this->SetNodeSetPropertyValue(nullptr);
206   this->SetSideSetPropertyNames(0, nullptr);
207   this->SetSideSetPropertyValue(nullptr);
208   this->SetGlobalVariableNames(0, nullptr);
209 
210   this->SetElementVariableTruthTable(nullptr);
211 
212   this->FreeOriginalElementVariableNames();
213   this->FreeOriginalNodeVariableNames();
214 }
215 
FreeAllLocalData()216 void vtkModelMetadata::FreeAllLocalData()
217 {
218   // All the fields that depend on which blocks, which time step,
219   // and which variables were read in.
220 
221   this->FreeBlockDependentData();   // depends on blocks
222   this->FreeUsedElementVariables(); // depends on variables
223   this->FreeUsedNodeVariables();
224   this->SetGlobalVariableValue(nullptr); // depends on time step
225 }
226 
FreeBlockDependentData()227 void vtkModelMetadata::FreeBlockDependentData()
228 {
229   // All the fields that depend on exactly which blocks
230   // are in the vtkUnstructuredGrid
231 
232   this->SetBlockNumberOfElements(nullptr);
233   this->SetBlockElementIdList(nullptr);
234   this->SetBlockAttributes(nullptr);
235 
236   this->SetNodeSetNodeIdList(nullptr);
237   this->SetNodeSetDistributionFactors(nullptr);
238 
239   this->SetSideSetSize(nullptr);
240   this->SetSideSetNumberOfDistributionFactors(nullptr);
241   this->SetSideSetElementList(nullptr);
242   this->SetSideSetSideList(nullptr);
243   this->SetSideSetNumDFPerSide(nullptr);
244   this->SetSideSetDistributionFactors(nullptr);
245 }
246 
FreeOriginalElementVariableNames()247 void vtkModelMetadata::FreeOriginalElementVariableNames()
248 {
249   int i;
250   FREELIST(this->OriginalElementVariableNames, this->OriginalNumberOfElementVariables);
251 }
FreeOriginalNodeVariableNames()252 void vtkModelMetadata::FreeOriginalNodeVariableNames()
253 {
254   int i;
255   FREELIST(this->OriginalNodeVariableNames, this->OriginalNumberOfNodeVariables);
256 }
FreeUsedElementVariableNames()257 void vtkModelMetadata::FreeUsedElementVariableNames()
258 {
259   int i;
260   FREELIST(this->ElementVariableNames, this->MaxNumberOfElementVariables);
261 }
262 
FreeUsedNodeVariableNames()263 void vtkModelMetadata::FreeUsedNodeVariableNames()
264 {
265   int i;
266   FREELIST(this->NodeVariableNames, this->MaxNumberOfNodeVariables);
267 }
FreeUsedElementVariables()268 void vtkModelMetadata::FreeUsedElementVariables()
269 {
270   this->FreeUsedElementVariableNames();
271   FREE(this->ElementVariableNumberOfComponents);
272   FREE(this->MapToOriginalElementVariableNames);
273 }
FreeUsedNodeVariables()274 void vtkModelMetadata::FreeUsedNodeVariables()
275 {
276   this->FreeUsedNodeVariableNames();
277   FREE(this->NodeVariableNumberOfComponents);
278   FREE(this->MapToOriginalNodeVariableNames);
279 }
280 
FreeAllMetadata()281 void vtkModelMetadata::FreeAllMetadata()
282 {
283   this->FreeAllLocalData();
284   this->FreeAllGlobalData();
285 }
FreeAllIvars()286 void vtkModelMetadata::FreeAllIvars()
287 {
288   this->FreeAllMetadata();
289   FREE(this->BlockAttributesIndex);
290   FREE(this->BlockElementIdListIndex);
291   FREE(this->NodeSetDistributionFactorIndex);
292   FREE(this->NodeSetIds);
293   FREE(this->NodeSetNodeIdListIndex);
294   FREE(this->NodeSetNumberOfDistributionFactors);
295   FREE(this->NodeSetSize);
296   FREE(this->SideSetDistributionFactorIndex);
297   FREE(this->SideSetListIndex);
298 }
299 //
300 // At last: The constructor, destructor and copy operator
301 //
vtkModelMetadata()302 vtkModelMetadata::vtkModelMetadata()
303 {
304   this->InitializeAllIvars();
305 }
~vtkModelMetadata()306 vtkModelMetadata::~vtkModelMetadata()
307 {
308   this->FreeAllIvars();
309 }
Reset()310 void vtkModelMetadata::Reset()
311 {
312   this->FreeAllIvars();
313   this->InitializeAllIvars();
314 }
315 
316 //-------------------------------------------------
317 // information  && QA fields
318 //-------------------------------------------------
319 
SetInformationLines(int nlines,char ** lines)320 void vtkModelMetadata::SetInformationLines(int nlines, char** lines)
321 {
322   int i;
323 
324   FREELIST(this->InformationLine, this->NumberOfInformationLines);
325 
326   this->NumberOfInformationLines = nlines;
327   this->InformationLine = lines;
328 }
329 
GetInformationLines(char *** lines) const330 int vtkModelMetadata::GetInformationLines(char*** lines) const
331 {
332   *lines = this->InformationLine;
333 
334   return this->NumberOfInformationLines;
335 }
336 
SetTimeSteps(int num,float * steps)337 void vtkModelMetadata::SetTimeSteps(int num, float* steps)
338 {
339   FREE(this->TimeStepValues);
340 
341   this->NumberOfTimeSteps = num;
342   this->TimeStepValues = steps;
343 }
344 
SetCoordinateNames(int dimension,char ** n)345 void vtkModelMetadata::SetCoordinateNames(int dimension, char** n)
346 {
347   int i;
348   if (this->CoordinateNames)
349   {
350     FREELIST(this->CoordinateNames, this->Dimension);
351   }
352 
353   this->CoordinateNames = n;
354   this->Dimension = dimension;
355 }
356 
SetBlockIds(int * b)357 void vtkModelMetadata::SetBlockIds(int* b)
358 {
359   FREE(this->BlockIds);
360 
361   this->BlockIds = b;
362 }
SetBlockElementType(char ** t)363 void vtkModelMetadata::SetBlockElementType(char** t)
364 {
365   int i;
366 
367   FREELIST(this->BlockElementType, this->NumberOfBlocks);
368 
369   this->BlockElementType = t;
370 }
SetBlockNodesPerElement(int * e)371 void vtkModelMetadata::SetBlockNodesPerElement(int* e)
372 {
373   FREE(this->BlockNodesPerElement);
374 
375   this->BlockNodesPerElement = e;
376 }
SetBlockElementIdList(int * e)377 void vtkModelMetadata::SetBlockElementIdList(int* e)
378 {
379   FREE(this->BlockElementIdList);
380 
381   this->BlockElementIdList = e;
382 }
SetBlockAttributes(float * a)383 void vtkModelMetadata::SetBlockAttributes(float* a)
384 {
385   FREE(this->BlockAttributes);
386 
387   this->BlockAttributes = a;
388 }
BuildBlockAttributesIndex()389 int vtkModelMetadata::BuildBlockAttributesIndex()
390 {
391   int nblocks = this->NumberOfBlocks;
392   int* nelts = this->BlockNumberOfElements;
393   int* natts = this->BlockNumberOfAttributesPerElement;
394 
395   if ((nblocks < 1) || !nelts || !natts)
396   {
397     return 1;
398   }
399 
400   delete[] this->BlockAttributesIndex;
401   this->BlockAttributesIndex = new int[nblocks];
402 
403   int idx = 0;
404 
405   for (int i = 0; i < nblocks; i++)
406   {
407     this->BlockAttributesIndex[i] = idx;
408     idx += (int)(nelts[i] * natts[i]);
409   }
410 
411   this->SizeBlockAttributeArray = idx;
412 
413   return 0;
414 }
BuildBlockElementIdListIndex()415 int vtkModelMetadata::BuildBlockElementIdListIndex()
416 {
417   int nblocks = this->NumberOfBlocks;
418   int* size = this->BlockNumberOfElements;
419 
420   if ((nblocks < 1) || !size)
421   {
422     return 1;
423   }
424 
425   delete[] this->BlockElementIdListIndex;
426   this->BlockElementIdListIndex = new int[nblocks];
427 
428   int idx = 0;
429   for (int i = 0; i < nblocks; i++)
430   {
431     this->BlockElementIdListIndex[i] = idx;
432     idx += size[i];
433   }
434 
435   this->SumElementsPerBlock = idx;
436   return 0;
437 }
SetBlockNumberOfElements(int * nelts)438 int vtkModelMetadata::SetBlockNumberOfElements(int* nelts)
439 {
440   FREE(this->BlockNumberOfElements);
441 
442   if (nelts)
443   {
444     this->BlockNumberOfElements = nelts;
445 
446     this->BuildBlockAttributesIndex();
447     this->BuildBlockElementIdListIndex();
448   }
449 
450   return 0;
451 }
SetBlockNumberOfAttributesPerElement(int * natts)452 int vtkModelMetadata::SetBlockNumberOfAttributesPerElement(int* natts)
453 {
454   FREE(this->BlockNumberOfAttributesPerElement);
455 
456   if (natts)
457   {
458     this->BlockNumberOfAttributesPerElement = natts;
459 
460     this->BuildBlockAttributesIndex();
461   }
462 
463   return 0;
464 }
465 
466 //-------------------------------------------------
467 // node set calculations
468 //-------------------------------------------------
469 
SetNodeSetIds(int * n)470 void vtkModelMetadata::SetNodeSetIds(int* n)
471 {
472   FREE(this->NodeSetIds);
473 
474   this->NodeSetIds = n;
475 }
SetNodeSetSize(int * n)476 void vtkModelMetadata::SetNodeSetSize(int* n)
477 {
478   FREE(this->NodeSetSize);
479 
480   this->NodeSetSize = n;
481 }
SetNodeSetNodeIdList(int * n)482 void vtkModelMetadata::SetNodeSetNodeIdList(int* n)
483 {
484   FREE(this->NodeSetNodeIdList);
485 
486   this->NodeSetNodeIdList = n;
487 }
SetNodeSetNumberOfDistributionFactors(int * n)488 void vtkModelMetadata::SetNodeSetNumberOfDistributionFactors(int* n)
489 {
490   FREE(this->NodeSetNumberOfDistributionFactors);
491 
492   this->NodeSetNumberOfDistributionFactors = n;
493 }
SetNodeSetDistributionFactors(float * d)494 void vtkModelMetadata::SetNodeSetDistributionFactors(float* d)
495 {
496   FREE(this->NodeSetDistributionFactors);
497 
498   this->NodeSetDistributionFactors = d;
499 }
500 
501 //-------------------------------------------------
502 // side set calculations
503 //-------------------------------------------------
SetSideSetIds(int * s)504 void vtkModelMetadata::SetSideSetIds(int* s)
505 {
506   FREE(this->SideSetIds);
507 
508   this->SideSetIds = s;
509 }
SetSideSetElementList(int * s)510 void vtkModelMetadata::SetSideSetElementList(int* s)
511 {
512   FREE(this->SideSetElementList);
513 
514   this->SideSetElementList = s;
515 }
SetSideSetSideList(int * s)516 void vtkModelMetadata::SetSideSetSideList(int* s)
517 {
518   FREE(this->SideSetSideList);
519 
520   this->SideSetSideList = s;
521 }
SetSideSetNumDFPerSide(int * s)522 void vtkModelMetadata::SetSideSetNumDFPerSide(int* s)
523 {
524   FREE(this->SideSetNumDFPerSide);
525 
526   this->SideSetNumDFPerSide = s;
527 }
SetSideSetNumberOfDistributionFactors(int * df)528 int vtkModelMetadata::SetSideSetNumberOfDistributionFactors(int* df)
529 {
530   FREE(this->SideSetNumberOfDistributionFactors)
531 
532   if (df)
533   {
534     this->SideSetNumberOfDistributionFactors = df;
535 
536     this->BuildSideSetDistributionFactorIndex();
537   }
538 
539   return 0;
540 }
SetSideSetDistributionFactors(float * d)541 void vtkModelMetadata::SetSideSetDistributionFactors(float* d)
542 {
543   FREE(this->SideSetDistributionFactors);
544 
545   this->SideSetDistributionFactors = d;
546 }
547 
SetSideSetSize(int * size)548 int vtkModelMetadata::SetSideSetSize(int* size)
549 {
550   FREE(this->SideSetSize);
551 
552   if (size)
553   {
554     this->SideSetSize = size;
555   }
556 
557   return 0;
558 }
559 
BuildSideSetDistributionFactorIndex()560 int vtkModelMetadata::BuildSideSetDistributionFactorIndex()
561 {
562   int nsets = this->NumberOfSideSets;
563   int* numFactors = this->SideSetNumberOfDistributionFactors;
564 
565   if ((nsets < 1) || !numFactors)
566   {
567     return 1;
568   }
569 
570   delete[] this->SideSetDistributionFactorIndex;
571   this->SideSetDistributionFactorIndex = new int[nsets];
572 
573   int idx = 0;
574 
575   for (int i = 0; i < nsets; i++)
576   {
577     this->SideSetDistributionFactorIndex[i] = idx;
578     idx += numFactors[i];
579   }
580 
581   this->SumDistFactPerSideSet = idx;
582 
583   return 0;
584 }
585 
586 //-------------------------------------------------
587 // Properties
588 //-------------------------------------------------
589 
SetBlockPropertyNames(int nprop,char ** nms)590 void vtkModelMetadata::SetBlockPropertyNames(int nprop, char** nms)
591 {
592   int i;
593 
594   FREELIST(this->BlockPropertyNames, this->NumberOfBlockProperties);
595 
596   this->NumberOfBlockProperties = nprop;
597   this->BlockPropertyNames = nms;
598 }
SetBlockPropertyValue(int * v)599 void vtkModelMetadata::SetBlockPropertyValue(int* v)
600 {
601   FREE(this->BlockPropertyValue);
602 
603   this->BlockPropertyValue = v;
604 }
SetNodeSetPropertyNames(int nprops,char ** nms)605 void vtkModelMetadata::SetNodeSetPropertyNames(int nprops, char** nms)
606 {
607   int i;
608 
609   FREELIST(this->NodeSetPropertyNames, this->NumberOfNodeSetProperties);
610 
611   this->NumberOfNodeSetProperties = nprops;
612   this->NodeSetPropertyNames = nms;
613 }
SetNodeSetPropertyValue(int * v)614 void vtkModelMetadata::SetNodeSetPropertyValue(int* v)
615 {
616   FREE(this->NodeSetPropertyValue);
617 
618   this->NodeSetPropertyValue = v;
619 }
SetSideSetPropertyNames(int nprops,char ** nms)620 void vtkModelMetadata::SetSideSetPropertyNames(int nprops, char** nms)
621 {
622   int i;
623 
624   FREELIST(this->SideSetPropertyNames, this->NumberOfSideSetProperties);
625 
626   this->NumberOfSideSetProperties = nprops;
627   this->SideSetPropertyNames = nms;
628 }
SetSideSetPropertyValue(int * v)629 void vtkModelMetadata::SetSideSetPropertyValue(int* v)
630 {
631   FREE(this->SideSetPropertyValue);
632 
633   this->SideSetPropertyValue = v;
634 }
635 //-------------------------------------------------
636 // Global variables
637 //-------------------------------------------------
638 
SetGlobalVariableNames(int num,char ** n)639 void vtkModelMetadata::SetGlobalVariableNames(int num, char** n)
640 {
641   int i;
642 
643   FREELIST(this->GlobalVariableNames, this->NumberOfGlobalVariables);
644 
645   this->GlobalVariableNames = n;
646   this->NumberOfGlobalVariables = num;
647 }
SetGlobalVariableValue(float * f)648 void vtkModelMetadata::SetGlobalVariableValue(float* f)
649 {
650   FREE(this->GlobalVariableValue);
651 
652   this->GlobalVariableValue = f;
653 }
654 //-------------------------------------------------
655 // Element variables
656 //-------------------------------------------------
657 
FindNameOnList(char * name,char ** list,int listLen)658 int vtkModelMetadata::FindNameOnList(char* name, char** list, int listLen)
659 {
660   int found = -1;
661 
662   for (int i = 0; i < listLen; i++)
663   {
664     if (!strcmp(name, list[i]))
665     {
666       found = i;
667       break;
668     }
669   }
670 
671   return found;
672 }
673 
SetOriginalElementVariableNames(int nvars,char ** names)674 void vtkModelMetadata::SetOriginalElementVariableNames(int nvars, char** names)
675 {
676   this->FreeOriginalElementVariableNames();
677 
678   this->OriginalNumberOfElementVariables = nvars;
679   this->OriginalElementVariableNames = names;
680 }
SetElementVariableNames(int nvars,char ** names)681 void vtkModelMetadata::SetElementVariableNames(int nvars, char** names)
682 {
683   this->FreeUsedElementVariableNames();
684 
685   this->NumberOfElementVariables = nvars;
686   this->MaxNumberOfElementVariables = nvars;
687   this->ElementVariableNames = names;
688 }
SetElementVariableNumberOfComponents(int * comp)689 void vtkModelMetadata::SetElementVariableNumberOfComponents(int* comp)
690 {
691   FREE(this->ElementVariableNumberOfComponents);
692   this->ElementVariableNumberOfComponents = comp;
693 }
SetMapToOriginalElementVariableNames(int * map)694 void vtkModelMetadata::SetMapToOriginalElementVariableNames(int* map)
695 {
696   FREE(this->MapToOriginalElementVariableNames);
697   this->MapToOriginalElementVariableNames = map;
698 }
699 
SetElementVariableInfo(int numOrigNames,char ** origNames,int numNames,char ** names,int * numComp,int * map)700 void vtkModelMetadata::SetElementVariableInfo(
701   int numOrigNames, char** origNames, int numNames, char** names, int* numComp, int* map)
702 {
703   this->SetOriginalElementVariableNames(numOrigNames, origNames);
704   this->SetElementVariableNames(numNames, names);
705   this->SetElementVariableNumberOfComponents(numComp);
706   this->SetMapToOriginalElementVariableNames(map);
707 }
708 //-------------------------------------------------
709 // Truth table
710 //-------------------------------------------------
711 
SetElementVariableTruthTable(int * n)712 void vtkModelMetadata::SetElementVariableTruthTable(int* n)
713 {
714   FREE(this->ElementVariableTruthTable);
715   this->AllVariablesDefinedInAllBlocks = 1; // the default
716 
717   if (n)
718   {
719     this->ElementVariableTruthTable = n;
720 
721     int numEntries = this->NumberOfBlocks * this->OriginalNumberOfElementVariables;
722 
723     for (int i = 0; i < numEntries; i++)
724     {
725       if (n[i] == 0)
726       {
727         this->AllVariablesDefinedInAllBlocks = 0;
728         break;
729       }
730     }
731   }
732 }
733 
734 //-------------------------------------------------
735 // Node variables
736 //-------------------------------------------------
737 
SetOriginalNodeVariableNames(int nvars,char ** names)738 void vtkModelMetadata::SetOriginalNodeVariableNames(int nvars, char** names)
739 {
740   this->FreeOriginalNodeVariableNames();
741 
742   this->OriginalNumberOfNodeVariables = nvars;
743   this->OriginalNodeVariableNames = names;
744 }
SetNodeVariableNames(int nvars,char ** names)745 void vtkModelMetadata::SetNodeVariableNames(int nvars, char** names)
746 {
747   this->FreeUsedNodeVariableNames();
748 
749   this->NumberOfNodeVariables = nvars;
750   this->MaxNumberOfNodeVariables = nvars;
751   this->NodeVariableNames = names;
752 }
SetNodeVariableNumberOfComponents(int * comp)753 void vtkModelMetadata::SetNodeVariableNumberOfComponents(int* comp)
754 {
755   FREE(this->NodeVariableNumberOfComponents);
756   this->NodeVariableNumberOfComponents = comp;
757 }
SetMapToOriginalNodeVariableNames(int * map)758 void vtkModelMetadata::SetMapToOriginalNodeVariableNames(int* map)
759 {
760   FREE(this->MapToOriginalNodeVariableNames);
761   this->MapToOriginalNodeVariableNames = map;
762 }
763 
SetNodeVariableInfo(int numOrigNames,char ** origNames,int numNames,char ** names,int * numComp,int * map)764 void vtkModelMetadata::SetNodeVariableInfo(
765   int numOrigNames, char** origNames, int numNames, char** names, int* numComp, int* map)
766 {
767   this->SetOriginalNodeVariableNames(numOrigNames, origNames);
768   this->SetNodeVariableNames(numNames, names);
769   this->SetNodeVariableNumberOfComponents(numComp);
770   this->SetMapToOriginalNodeVariableNames(map);
771 }
772 
773 //-------------------------------------
774 // Display contents for debugging
775 //-------------------------------------
776 
ShowFloats(const char * what,int num,float * f)777 void vtkModelMetadata::ShowFloats(const char* what, int num, float* f)
778 {
779   if (num < 1)
780     return;
781   if (!f)
782     return;
783   cout << what << endl;
784   for (int i = 0; i < num; i++)
785   {
786     if (i && (i % 10 == 0))
787       cout << endl;
788     cout << " " << f[i];
789   }
790   cout << endl;
791 }
ShowLines(const char * what,int num,char ** l)792 void vtkModelMetadata::ShowLines(const char* what, int num, char** l)
793 {
794   if (num < 1)
795     return;
796   if (!l)
797     return;
798   cout << what << endl;
799   for (int i = 0; i < num; i++)
800   {
801     if (l[i])
802       cout << "  " << l[i] << endl;
803   }
804 }
ShowIntArray(const char * what,int numx,int numy,int * id)805 void vtkModelMetadata::ShowIntArray(const char* what, int numx, int numy, int* id)
806 {
807   if (numx < 1)
808     return;
809   if (numy < 1)
810     return;
811   if (id == nullptr)
812     return;
813 
814   cout << what << endl;
815   for (int x = 0; x < numx; x++)
816   {
817     for (int y = 0; y < numy; y++)
818     {
819       cout << " " << *id++;
820     }
821     cout << endl;
822   }
823   cout << endl;
824 }
ShowInts(const char * what,int num,int * id)825 void vtkModelMetadata::ShowInts(const char* what, int num, int* id)
826 {
827   if (num < 1)
828     return;
829   if (!id)
830     return;
831   cout << what << endl;
832   for (int i = 0; i < num; i++)
833   {
834     if (i && (i % 10 == 0))
835       cout << endl;
836     cout << " " << id[i];
837   }
838   cout << endl;
839 }
ShowListsOfInts(const char * what,int * list,int nlists,int * idx,int len,int verbose)840 void vtkModelMetadata::ShowListsOfInts(
841   const char* what, int* list, int nlists, int* idx, int len, int verbose)
842 {
843   int i, j, ii;
844   if (len == 0)
845     return;
846 
847   cout << what << endl;
848   for (i = 0; i < nlists; i++)
849   {
850     int start = idx[i];
851     int end = ((i == nlists - 1) ? len : idx[i + 1]);
852 
853     cout << i << ") ";
854 
855     for (j = start, ii = 0; j < end; j++, ii++)
856     {
857       if (ii && ((ii % 20) == 0))
858       {
859         if (verbose)
860         {
861           cout << endl;
862         }
863         else
864         {
865           cout << "...";
866           break;
867         }
868       }
869       cout << list[j] << " ";
870     }
871     cout << endl;
872   }
873 }
ShowListsOfFloats(const char * what,float * list,int nlists,int * idx,int len,int verbose)874 void vtkModelMetadata::ShowListsOfFloats(
875   const char* what, float* list, int nlists, int* idx, int len, int verbose)
876 {
877   int i, j, ii;
878   if (len == 0)
879     return;
880 
881   cout << what << endl;
882   for (i = 0; i < nlists; i++)
883   {
884     int start = idx[i];
885     int end = ((i == nlists - 1) ? len : idx[i + 1]);
886 
887     cout << i << ") ";
888 
889     for (j = start, ii = 0; j < end; j++, ii++)
890     {
891       if (ii && ((ii % 20) == 0))
892       {
893         if (verbose)
894         {
895           cout << endl;
896         }
897         else
898         {
899           cout << "...";
900           break;
901         }
902       }
903       cout << list[j] << " ";
904     }
905     cout << endl;
906   }
907 }
908 
PrintLocalInformation()909 void vtkModelMetadata::PrintLocalInformation()
910 {
911   int verbose = 0;
912 
913   // Only print out lists of element IDs, distribution factors, node
914   // IDs and so on if VERBOSE_TESTING is defined in the environment.
915   // You only want to see these for very small test files.
916 
917   char* val = getenv("VERBOSE_TESTING");
918   if (val)
919     verbose = 1;
920   val = getenv("VERY_VERBOSE_TESTING");
921   if (val)
922     verbose = 2;
923 
924   cout << "Metadata local information" << endl;
925   cout << "========================================" << endl;
926 
927   cout << "Time step (starting with 0): " << this->TimeStepIndex << endl;
928 
929   this->ShowInts("BlockNumberOfElements", this->NumberOfBlocks, this->BlockNumberOfElements);
930 
931   if (verbose)
932   {
933     // Only show these for really small data sets.
934 
935     this->ShowListsOfInts("BlockElementIdList", this->BlockElementIdList, this->NumberOfBlocks,
936       this->BlockElementIdListIndex, this->SumElementsPerBlock, (verbose > 1));
937     this->ShowListsOfFloats("BlockAttributes", this->BlockAttributes, this->NumberOfBlocks,
938       this->BlockAttributesIndex, this->SizeBlockAttributeArray, (verbose > 1));
939   }
940 
941   this->ShowInts("NodeSetSize", this->NumberOfNodeSets, this->NodeSetSize);
942   this->ShowInts("NodeSetNumberOfDistributionFactors", this->NumberOfNodeSets,
943     this->NodeSetNumberOfDistributionFactors);
944 
945   if (verbose)
946   {
947     this->ShowListsOfInts("NodeSetNodeIdList", this->NodeSetNodeIdList, this->NumberOfNodeSets,
948       this->NodeSetNodeIdListIndex, this->SumNodesPerNodeSet, (verbose > 1));
949     this->ShowListsOfFloats("NodeSetDistributionFactors", this->NodeSetDistributionFactors,
950       this->NumberOfNodeSets, this->NodeSetDistributionFactorIndex, this->SumDistFactPerNodeSet,
951       (verbose > 1));
952   }
953 
954   this->ShowInts("SideSetSize", this->NumberOfSideSets, this->SideSetSize);
955   this->ShowInts("SideSetNumberOfDistributionFactors", this->NumberOfSideSets,
956     this->SideSetNumberOfDistributionFactors);
957 
958   if (verbose)
959   {
960     this->ShowListsOfInts("SideSetElementList", this->SideSetElementList, this->NumberOfSideSets,
961       this->SideSetListIndex, this->SumSidesPerSideSet, (verbose > 1));
962     this->ShowListsOfInts("SideSetSideList", this->SideSetSideList, this->NumberOfSideSets,
963       this->SideSetListIndex, this->SumSidesPerSideSet, (verbose > 1));
964     this->ShowListsOfInts("SideSetNumDFPerSide", this->SideSetNumDFPerSide, this->NumberOfSideSets,
965       this->SideSetListIndex, this->SumSidesPerSideSet, (verbose > 1));
966     this->ShowListsOfFloats("SideSetDistributionFactors", this->SideSetDistributionFactors,
967       this->NumberOfSideSets, this->SideSetDistributionFactorIndex, this->SumDistFactPerSideSet,
968       (verbose > 1));
969   }
970 
971   this->ShowFloats("GlobalVariables", this->NumberOfGlobalVariables, this->GlobalVariableValue);
972 
973   cout << "NumberOfElementVariables " << this->NumberOfElementVariables << endl;
974   this->ShowLines(
975     "ElementVariableNames", this->NumberOfElementVariables, this->ElementVariableNames);
976   this->ShowInts("ElementVariableNumberOfComponents", this->NumberOfElementVariables,
977     this->ElementVariableNumberOfComponents);
978   this->ShowInts("MapToOriginalElementVariableNames", this->NumberOfElementVariables,
979     this->MapToOriginalElementVariableNames);
980 
981   cout << "NumberOfNodeVariables " << this->NumberOfNodeVariables << endl;
982   this->ShowLines("NodeVariableNames", this->NumberOfNodeVariables, this->NodeVariableNames);
983   this->ShowInts("NodeVariableNumberOfComponents", this->NumberOfNodeVariables,
984     this->NodeVariableNumberOfComponents);
985   this->ShowInts("MapToOriginalNodeVariableNames", this->NumberOfNodeVariables,
986     this->MapToOriginalNodeVariableNames);
987 }
988 
PrintGlobalInformation()989 void vtkModelMetadata::PrintGlobalInformation()
990 {
991   int i, j;
992 
993   cout << "Metadata global information" << endl;
994   cout << "========================================" << endl;
995 
996   if (this->Title)
997     cout << "Title: " << this->Title << endl;
998 
999   this->ShowLines("InformationLines", this->NumberOfInformationLines, this->InformationLine);
1000 
1001   this->ShowLines("CoordinateNames", this->Dimension, this->CoordinateNames);
1002 
1003   cout << "NumberOfTimeSteps " << this->NumberOfTimeSteps << endl;
1004   this->ShowFloats("TimeStepValues", this->NumberOfTimeSteps, this->TimeStepValues);
1005 
1006   cout << "NumberOfBlocks " << this->NumberOfBlocks << endl;
1007   this->ShowInts("BlockIds", this->NumberOfBlocks, this->BlockIds);
1008   this->ShowLines("BlockElementType", this->NumberOfBlocks, this->BlockElementType);
1009   this->ShowInts("BlockNodesPerElement", this->NumberOfBlocks, this->BlockNodesPerElement);
1010   this->ShowInts("BlockNumberOfAttributesPerElement", this->NumberOfBlocks,
1011     this->BlockNumberOfAttributesPerElement);
1012 
1013   cout << "NumberOfNodeSets " << this->NumberOfNodeSets << endl;
1014   this->ShowInts("NodeSetIds", this->NumberOfNodeSets, this->NodeSetIds);
1015 
1016   cout << "NumberOfSideSets " << this->NumberOfSideSets << endl;
1017   this->ShowInts("SideSetIds", this->NumberOfSideSets, this->SideSetIds);
1018 
1019   cout << "NumberOfBlockProperties " << this->NumberOfBlockProperties << endl;
1020   this->ShowLines("BlockPropertyNames", this->NumberOfBlockProperties, this->BlockPropertyNames);
1021   this->ShowIntArray("BlockPropertyValue", this->NumberOfBlocks, this->NumberOfBlockProperties,
1022     this->BlockPropertyValue);
1023 
1024   cout << "NumberOfNodeSetProperties " << this->NumberOfNodeSetProperties << endl;
1025   this->ShowLines(
1026     "NodeSetPropertyNames", this->NumberOfNodeSetProperties, this->NodeSetPropertyNames);
1027   this->ShowIntArray("NodeSetPropertyValue", this->NumberOfNodeSets,
1028     this->NumberOfNodeSetProperties, this->NodeSetPropertyValue);
1029 
1030   cout << "NumberOfSideSetProperties " << this->NumberOfSideSetProperties << endl;
1031   this->ShowLines(
1032     "SideSetPropertyNames", this->NumberOfSideSetProperties, this->SideSetPropertyNames);
1033   this->ShowIntArray("SideSetPropertyValue", this->NumberOfSideSets,
1034     this->NumberOfSideSetProperties, this->SideSetPropertyValue);
1035 
1036   cout << "NumberOfGlobalVariables " << this->NumberOfGlobalVariables << endl;
1037   this->ShowLines("GlobalVariableNames", this->NumberOfGlobalVariables, this->GlobalVariableNames);
1038 
1039   cout << "OriginalNumberOfElementVariables " << this->OriginalNumberOfElementVariables << endl;
1040   this->ShowLines("OriginalElementVariableNames", this->OriginalNumberOfElementVariables,
1041     this->OriginalElementVariableNames);
1042 
1043   cout << "OriginalNumberOfNodeVariables " << this->OriginalNumberOfNodeVariables << endl;
1044   this->ShowLines("OriginalNodeVariableNames", this->OriginalNumberOfNodeVariables,
1045     this->OriginalNodeVariableNames);
1046 
1047   int* tt = this->ElementVariableTruthTable;
1048   int nblocks = this->NumberOfBlocks;
1049   int nelts = this->OriginalNumberOfElementVariables;
1050   int ttsize = nblocks * nelts;
1051 
1052   if (tt && ttsize)
1053   {
1054     cout << "Block/Element variable truth table" << endl;
1055     for (i = 0; i < nblocks; i++)
1056     {
1057       cout << "block " << i << ", ";
1058       for (j = 0; j < nelts; j++)
1059       {
1060         cout << *tt++ << " ";
1061       }
1062       cout << endl;
1063     }
1064   }
1065 
1066   cout << "========================================" << endl;
1067 }
1068 
CalculateMaximumLengths(int & maxString,int & maxLine)1069 int vtkModelMetadata::CalculateMaximumLengths(int& maxString, int& maxLine)
1070 {
1071   int i;
1072   maxLine = 0;
1073   maxString = 0;
1074 
1075   // Exodus file strings have a bounded length.  The bounds
1076   // MAX_STR_LENGTH and MAX_LINE_LENGTH are in the exodusII
1077   // header file.  However the vtkModelMetadata class must
1078   // not require the Exodus library.  It is used by classes
1079   // that are ExodusModel-aware, but must work in non Exodus
1080   // environments.  (Like vtkEnSightWriter).  It also may be
1081   // used by other dataset file formats in the future.  So we
1082   // need to deduce a fixed string length and line length.
1083 
1084   int sizeLine = (this->Title ? static_cast<int>(strlen(this->Title)) : 0);
1085   maxLine = ((sizeLine > maxLine) ? sizeLine : maxLine);
1086 
1087   for (i = 0; i < this->NumberOfInformationLines; i++)
1088   {
1089     sizeLine = (this->InformationLine[i] ? static_cast<int>(strlen(this->InformationLine[i])) : 0);
1090     maxLine = ((sizeLine > maxLine) ? sizeLine : maxLine);
1091   }
1092 
1093   for (i = 0; i < this->Dimension; i++)
1094   {
1095     sizeLine = (this->CoordinateNames[i] ? static_cast<int>(strlen(this->CoordinateNames[i])) : 0);
1096     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1097   }
1098 
1099   for (i = 0; i < this->NumberOfBlocks; i++)
1100   {
1101     sizeLine =
1102       (this->BlockElementType[i] ? static_cast<int>(strlen(this->BlockElementType[i])) : 0);
1103     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1104   }
1105 
1106   for (i = 0; i < this->NumberOfBlockProperties; i++)
1107   {
1108     sizeLine =
1109       (this->BlockPropertyNames[i] ? static_cast<int>(strlen(this->BlockPropertyNames[i])) : 0);
1110     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1111   }
1112 
1113   for (i = 0; i < this->NumberOfNodeSetProperties; i++)
1114   {
1115     sizeLine =
1116       (this->NodeSetPropertyNames[i] ? static_cast<int>(strlen(this->NodeSetPropertyNames[i])) : 0);
1117     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1118   }
1119 
1120   for (i = 0; i < this->NumberOfSideSetProperties; i++)
1121   {
1122     sizeLine =
1123       (this->SideSetPropertyNames[i] ? static_cast<int>(strlen(this->SideSetPropertyNames[i])) : 0);
1124     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1125   }
1126 
1127   for (i = 0; i < this->NumberOfGlobalVariables; i++)
1128   {
1129     sizeLine =
1130       (this->GlobalVariableNames[i] ? static_cast<int>(strlen(this->GlobalVariableNames[i])) : 0);
1131     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1132   }
1133 
1134   // Figure the node and element variable name lengths into the calculations.
1135   // Note: sizeLine++ is necessary (for the null-terminating char?)
1136 
1137   for (i = 0; i < this->NumberOfNodeVariables; i++)
1138   {
1139     sizeLine =
1140       (this->NodeVariableNames[i] ? static_cast<int>(strlen(this->NodeVariableNames[i])) : 0);
1141     sizeLine++;
1142     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1143   }
1144 
1145   for (i = 0; i < this->NumberOfElementVariables; i++)
1146   {
1147     sizeLine =
1148       (this->ElementVariableNames[i] ? static_cast<int>(strlen(this->ElementVariableNames[i])) : 0);
1149     sizeLine++;
1150     maxString = (sizeLine > maxString) ? sizeLine : maxString;
1151   }
1152 
1153   return 0;
1154 }
1155 
PrintSelf(ostream & os,vtkIndent indent)1156 void vtkModelMetadata::PrintSelf(ostream& os, vtkIndent indent)
1157 {
1158   int i;
1159   this->Superclass::PrintSelf(os, indent);
1160 
1161   os << indent << "Title: " << (this->Title ? this->Title : "(none)") << endl;
1162   os << indent << "NumberOfInformationLines: " << this->NumberOfInformationLines << endl;
1163   os << indent << "Dimension: " << this->Dimension << endl;
1164   os << indent << "CoordinateNames: " << endl;
1165   for (i = 0; i < this->Dimension; i++)
1166   {
1167     os << indent << "-" << (this->CoordinateNames[i] ? this->CoordinateNames[i] : "(none)") << endl;
1168   }
1169   os << indent << "NumberOfBlocks: " << this->NumberOfBlocks << endl;
1170   os << indent << "NumberOfNodeSets: " << this->NumberOfNodeSets << endl;
1171   os << indent << "NodeSetNames: ";
1172   for (i = 0; this->NodeSetNames && (i < this->NodeSetNames->GetNumberOfValues()); i++)
1173   {
1174     os << this->NodeSetNames->GetValue(i) << " ";
1175   }
1176   os << indent << "NodeSetIds: ";
1177   for (i = 0; i < this->NumberOfNodeSets; i++)
1178   {
1179     os << this->NodeSetIds[i] << " ";
1180   }
1181   os << endl;
1182   if (this->NodeSetSize)
1183   {
1184     os << indent << "NodeSetSize: ";
1185     for (i = 0; i < this->NumberOfNodeSets; i++)
1186     {
1187       os << this->NodeSetSize[i] << " ";
1188     }
1189     os << endl;
1190   }
1191   os << indent << "NodeSetNodeIdList: ";
1192   for (i = 0; i < this->SumNodesPerNodeSet; i++)
1193   {
1194     os << this->NodeSetNodeIdList[i] << " ";
1195   }
1196   os << endl;
1197   //  os << indent << "NodeSetNumberOfDistributionFactors: " <<
1198   //                   (this->NodeSetNumberOfDistributionFactors?this->NodeSetNumberOfDistributionFactors:"(none)")
1199   //                   << endl;
1200   os << indent << "NodeSetDistributionFactors: ";
1201   for (i = 0; i < this->SumDistFactPerNodeSet; i++)
1202   {
1203     os << this->NodeSetDistributionFactors[i] << " ";
1204   }
1205   os << endl;
1206   os << indent << "NumberOfSideSets: " << this->NumberOfSideSets << endl;
1207   os << indent << "SideSetNames: ";
1208   for (i = 0; this->SideSetNames && (i < this->SideSetNames->GetNumberOfValues()); i++)
1209   {
1210     os << this->SideSetNames->GetValue(i) << " ";
1211   }
1212   os << indent << "SideSetIds: ";
1213   for (i = 0; i < this->NumberOfSideSets; i++)
1214   {
1215     os << this->SideSetIds[i] << " ";
1216   }
1217   os << endl;
1218   if (this->SideSetSize)
1219   {
1220     os << indent << "SideSetSize: ";
1221     for (i = 0; i < this->NumberOfSideSets; i++)
1222     {
1223       os << this->SideSetSize[i] << " ";
1224     }
1225     os << endl;
1226   }
1227   //  os << indent << "SideSetNumberOfDistributionFactors: " <<
1228   //                  (this->SideSetNumberOfDistributionFactors?this->SideSetNumberOfDistributionFactors:"(none)"
1229   //                  << endl;
1230   os << indent << "SideSetElementList: ";
1231   for (i = 0; i < this->SumSidesPerSideSet; i++)
1232   {
1233     os << this->SideSetElementList[i] << " ";
1234   }
1235   os << endl;
1236   os << indent << "SideSetSideList: ";
1237   for (i = 0; i < this->SumSidesPerSideSet; i++)
1238   {
1239     os << this->SideSetSideList[i] << " ";
1240   }
1241   os << endl;
1242   os << indent << "SideSetNumDFPerSide: ";
1243   for (i = 0; i < this->SumSidesPerSideSet; i++)
1244   {
1245     os << this->SideSetNumDFPerSide[i] << " ";
1246   }
1247   os << endl;
1248   os << indent << "SideSetDistributionFactors: ";
1249   for (i = 0; i < this->SumDistFactPerSideSet; i++)
1250   {
1251     os << this->SideSetDistributionFactors[i] << " ";
1252   }
1253   os << endl;
1254   os << indent << "NumberOfBlockProperties: " << this->NumberOfBlockProperties << endl;
1255   os << indent << "BlockPropertyNames: ";
1256   for (i = 0; i < this->NumberOfBlockProperties; i++)
1257   {
1258     os << indent << "-" << (this->BlockPropertyNames[i] ? this->BlockPropertyNames[i] : "(none)")
1259        << endl;
1260   }
1261   //  os << indent << "BlockPropertyValue: " <<
1262   //                   (this->BlockPropertyValue?this->BlockPropertyValue:"(none)") << endl;
1263   os << indent << "NumberOfNodeSetProperties: " << this->NumberOfNodeSetProperties << endl;
1264   os << indent << "NodeSetPropertyNames: ";
1265   for (i = 0; i < this->NumberOfNodeSetProperties; i++)
1266   {
1267     os << indent << "-"
1268        << (this->NodeSetPropertyNames[i] ? this->NodeSetPropertyNames[i] : "(none)") << endl;
1269   }
1270   //  os << indent << "NodeSetPropertyValue: " <<
1271   //                  (this->NodeSetPropertyValue?this->NodeSetPropertyValue:"(none)") << endl;
1272   os << indent << "NumberOfSideSetProperties: " << this->NumberOfSideSetProperties << endl;
1273   os << indent << "SideSetPropertyNames: ";
1274   for (i = 0; i < this->NumberOfSideSetProperties; i++)
1275   {
1276     os << indent << "-"
1277        << (this->SideSetPropertyNames[i] ? this->SideSetPropertyNames[i] : "(none)") << endl;
1278   }
1279   //  os << indent << "SideSetPropertyValue: " <<
1280   //                  (this->SideSetPropertyValue?this->SideSetPropertyValue:"(none)") << endl;
1281   os << indent << "NumberOfElementVariables: " << this->NumberOfElementVariables << endl;
1282   os << indent << "ElementVariableNames: ";
1283   for (i = 0; i < this->MaxNumberOfElementVariables; i++)
1284   {
1285     os << indent << "-"
1286        << (this->ElementVariableNames[i] ? this->ElementVariableNames[i] : "(none)") << endl;
1287   }
1288   os << indent << "NumberOfNodeVariables: " << this->NumberOfNodeVariables << endl;
1289   os << indent << "NodeVariableNames: ";
1290   for (i = 0; i < this->NumberOfNodeVariables; i++)
1291   {
1292     os << indent << "-" << (this->NodeVariableNames[i] ? this->NodeVariableNames[i] : "(none)")
1293        << endl;
1294   }
1295   //  os << indent << "ElementVariableTruthTable: " <<
1296   //                  (this->ElementVariableTruthTable?this->ElementVariableTruthTable:"(none)") <<
1297   //                  endl;
1298   os << indent << "TimeStepIndex: " << this->TimeStepIndex << endl;
1299   os << indent << "AllVariablesDefinedInAllBlocks: " << this->AllVariablesDefinedInAllBlocks
1300      << endl;
1301 }
1302