31 #ifndef vtkMaterialInterfaceFilter_h 32 #define vtkMaterialInterfaceFilter_h 34 #include "vtkMultiBlockDataSetAlgorithm.h" 35 #include "vtkPVVTKExtensionsDefaultModule.h" 39 #include "vtkSmartPointer.h" 40 #include "vtkTimerLog.h" 45 class vtkNonOverlappingAMR;
51 class vtkMultiProcessController;
52 class vtkDataArraySelection;
53 class vtkCallbackCommand;
54 class vtkImplicitFunction;
57 class vtkMaterialInterfaceLevel;
58 class vtkMaterialInterfaceFilterBlock;
59 class vtkMaterialInterfaceFilterIterator;
60 class vtkMaterialInterfaceEquivalenceSet;
61 class vtkMaterialInterfaceFilterRingBuffer;
66 :
public vtkMultiBlockDataSetAlgorithm
71 void PrintSelf(ostream& os, vtkIndent indent);
79 void SelectMaterialArray(
const char* name);
83 void UnselectMaterialArray(
const char* name);
87 void UnselectAllMaterialArrays();
91 void SetMaterialArrayStatus(
const char* name,
int status);
96 int GetMaterialArrayStatus(
const char* name);
97 int GetMaterialArrayStatus(
int index);
102 int GetNumberOfMaterialArrays();
106 const char* GetMaterialArrayName(
int index);
112 void SelectMassArray(
const char* name);
116 void UnselectMassArray(
const char* name);
120 void UnselectAllMassArrays();
124 void SetMassArrayStatus(
const char* name,
int status);
129 int GetMassArrayStatus(
const char* name);
130 int GetMassArrayStatus(
int index);
135 int GetNumberOfMassArrays();
139 const char* GetMassArrayName(
int index);
145 void SelectVolumeWtdAvgArray(
const char* name);
149 void UnselectVolumeWtdAvgArray(
const char* name);
153 void UnselectAllVolumeWtdAvgArrays();
158 void SetVolumeWtdAvgArrayStatus(
const char* name,
int status);
163 int GetVolumeWtdAvgArrayStatus(
const char* name);
164 int GetVolumeWtdAvgArrayStatus(
int index);
169 int GetNumberOfVolumeWtdAvgArrays();
173 const char* GetVolumeWtdAvgArrayName(
int index);
179 void SelectMassWtdAvgArray(
const char* name);
183 void UnselectMassWtdAvgArray(
const char* name);
187 void UnselectAllMassWtdAvgArrays();
192 void SetMassWtdAvgArrayStatus(
const char* name,
int status);
197 int GetMassWtdAvgArrayStatus(
const char* name);
198 int GetMassWtdAvgArrayStatus(
int index);
203 int GetNumberOfMassWtdAvgArrays();
207 const char* GetMassWtdAvgArrayName(
int index);
213 void SelectSummationArray(
const char* name);
217 void UnselectSummationArray(
const char* name);
221 void UnselectAllSummationArrays();
225 void SetSummationArrayStatus(
const char* name,
int status);
230 int GetSummationArrayStatus(
const char* name);
231 int GetSummationArrayStatus(
int index);
236 int GetNumberOfSummationArrays();
240 const char* GetSummationArrayName(
int index);
247 void SetMaterialFractionThreshold(
double fraction);
248 vtkGetMacro(MaterialFractionThreshold,
double);
256 vtkSetMacro(ComputeOBB,
bool);
257 vtkGetMacro(ComputeOBB,
bool);
272 void SetUpperLoadingBound(
int nPolys);
273 vtkGetMacro(UpperLoadingBound,
int);
281 vtkSetStringMacro(OutputBaseName);
282 vtkGetStringMacro(OutputBaseName);
288 vtkSetMacro(WriteGeometryOutput,
bool);
289 vtkGetMacro(WriteGeometryOutput,
bool);
290 vtkSetMacro(WriteStatisticsOutput,
bool);
291 vtkGetMacro(WriteStatisticsOutput,
bool);
300 vtkSetMacro(BlockGhostLevel,
unsigned char);
301 vtkGetMacro(BlockGhostLevel,
unsigned char);
307 static void SelectionModifiedCallback(vtkObject*,
unsigned long,
void* clientdata,
void*);
313 void SetClipFunction(vtkImplicitFunction* clipFunction);
314 vtkGetObjectMacro(ClipFunction, vtkImplicitFunction);
322 vtkSetMacro(InvertVolumeFraction,
int);
323 vtkGetMacro(InvertVolumeFraction,
int);
329 vtkMTimeType GetMTime();
335 virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
336 virtual int FillInputPortInformation(
int port, vtkInformation* info);
337 virtual int FillOutputPortInformation(
int port, vtkInformation* info);
341 void PrepareForPass(vtkNonOverlappingAMR* hbdsInput,
342 std::vector<std::string>& volumeWtdAvgArrayNames,
343 std::vector<std::string>& massWtdAvgArrayNames, std::vector<std::string>& summedArrayNames,
344 std::vector<std::string>& integratedArrayNames);
346 vtkPolyData* NewFragmentMesh();
348 int ProcessBlock(
int blockId);
351 void ConnectFragment(vtkMaterialInterfaceFilterRingBuffer* iterator);
352 void GetNeighborIterator(vtkMaterialInterfaceFilterIterator* next,
353 vtkMaterialInterfaceFilterIterator* iterator,
int axis0,
int maxFlag0,
int axis1,
int maxFlag1,
354 int axis2,
int maxFlag2);
355 void GetNeighborIteratorPad(vtkMaterialInterfaceFilterIterator* next,
356 vtkMaterialInterfaceFilterIterator* iterator,
int axis0,
int maxFlag0,
int axis1,
int maxFlag1,
357 int axis2,
int maxFlag2);
358 void CreateFace(vtkMaterialInterfaceFilterIterator* in, vtkMaterialInterfaceFilterIterator* out,
359 int axis,
int outMaxFlag);
360 int ComputeDisplacementFactors(vtkMaterialInterfaceFilterIterator* pointNeighborIterators[8],
361 double displacmentFactors[3],
int rootNeighborIdx,
int faceAxis);
362 int SubVoxelPositionCorner(
double* point,
363 vtkMaterialInterfaceFilterIterator* pointNeighborIterators[8],
int rootNeighborIdx,
365 void FindPointNeighbors(vtkMaterialInterfaceFilterIterator* iteratorMin0,
366 vtkMaterialInterfaceFilterIterator* iteratorMax0,
int axis0,
int maxFlag1,
int maxFlag2,
367 vtkMaterialInterfaceFilterIterator pointNeighborIterators[8],
double pt[3]);
369 int ComputeOriginAndRootSpacingOld(vtkNonOverlappingAMR* input);
370 void ComputeOriginAndRootSpacing(vtkNonOverlappingAMR* input);
372 int GetNumberOfLocalBlocks(vtkNonOverlappingAMR* input);
375 void ShareGhostBlocks();
376 void HandleGhostBlockRequests();
377 int ComputeRequiredGhostExtent(
int level,
int inExt[6],
int outExt[6]);
379 void ComputeAndDistributeGhostBlocks(
380 int* numBlocksInProc,
int* blockMetaData,
int myProc,
int numProcs);
386 vtkMaterialInterfaceFilterIterator* neighbor1, vtkMaterialInterfaceFilterIterator* neighbor2);
388 void PrepareForResolveEquivalences();
390 void ResolveEquivalences();
391 void GatherEquivalenceSets(vtkMaterialInterfaceEquivalenceSet*
set);
392 void ShareGhostEquivalences(vtkMaterialInterfaceEquivalenceSet* globalSet,
int* procOffsets);
393 void ReceiveGhostFragmentIds(vtkMaterialInterfaceEquivalenceSet* globalSet,
int* procOffset);
394 void MergeGhostEquivalenceSets(vtkMaterialInterfaceEquivalenceSet* globalSet);
398 int ResolveIntegratedAttributes(
const int controllingProcId);
400 int PrepareToResolveIntegratedAttributes();
403 int SendIntegratedAttributes(
const int recipientProcId);
405 int ReceiveIntegratedAttributes(
const int sourceProcId);
407 int PrepareToCollectIntegratedAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
408 std::vector<vtkDoubleArray*>& volumes, std::vector<vtkDoubleArray*>& clipDepthMaxs,
409 std::vector<vtkDoubleArray*>& clipDepthMins, std::vector<vtkDoubleArray*>& moments,
410 std::vector<std::vector<vtkDoubleArray*> >& volumeWtdAvgs,
411 std::vector<std::vector<vtkDoubleArray*> >& massWtdAvgs,
412 std::vector<std::vector<vtkDoubleArray*> >& sums);
414 int CleanUpAfterCollectIntegratedAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
415 std::vector<vtkDoubleArray*>& volumes, std::vector<vtkDoubleArray*>& clipDepthMaxs,
416 std::vector<vtkDoubleArray*>& clipDepthMins, std::vector<vtkDoubleArray*>& moments,
417 std::vector<std::vector<vtkDoubleArray*> >& volumeWtdAvgs,
418 std::vector<std::vector<vtkDoubleArray*> >& massWtdAvgs,
419 std::vector<std::vector<vtkDoubleArray*> >& sums);
422 int CollectIntegratedAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
423 std::vector<vtkDoubleArray*>& volumes, std::vector<vtkDoubleArray*>& clipDepthMaxs,
424 std::vector<vtkDoubleArray*>& clipDepthMins, std::vector<vtkDoubleArray*>& moments,
425 std::vector<std::vector<vtkDoubleArray*> >& volumeWtdAvgs,
426 std::vector<std::vector<vtkDoubleArray*> >& massWtdAvgs,
427 std::vector<std::vector<vtkDoubleArray*> >& sums);
429 int BroadcastIntegratedAttributes(
const int sourceProcessId);
431 int SendGeometricAttributes(
const int controllingProcId);
433 int PrepareToCollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
434 std::vector<vtkDoubleArray*>& coaabb, std::vector<vtkDoubleArray*>& obb,
435 std::vector<int*>& ids);
437 int CleanUpAfterCollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
438 std::vector<vtkDoubleArray*>& coaabb, std::vector<vtkDoubleArray*>& obb,
439 std::vector<int*>& ids);
442 int CollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
443 std::vector<vtkDoubleArray*>& coaabb, std::vector<vtkDoubleArray*>& obb,
444 std::vector<int*>& ids);
446 int PrepareToMergeGeometricAttributes();
448 int GatherGeometricAttributes(
const int recipientProcId);
450 void ResolveLocalFragmentGeometry();
452 void ResolveRemoteFragmentGeometry();
454 void CleanLocalFragmentGeometry();
456 void BuildLoadingArray(std::vector<vtkIdType>& loadingArray);
457 int PackLoadingArray(vtkIdType*& buffer);
458 int UnPackLoadingArray(vtkIdType* buffer,
int bufSize, std::vector<vtkIdType>& loadingArray);
462 void CopyAttributesToOutput0();
463 void CopyAttributesToOutput1();
464 void CopyAttributesToOutput2();
466 int WriteGeometryOutputToTextFile();
467 int WriteStatisticsOutputToTextFile();
469 int BuildOutputs(vtkMultiBlockDataSet* mbdsOutput0, vtkMultiBlockDataSet* mbdsOutput1,
470 vtkMultiBlockDataSet* mbdsOutput2,
int materialId);
474 int Accumulate(
double* dest,
479 int AccumulateMoments(
double* moments,
480 vtkDataArray* massArray,
484 void ComputeGeometricAttributes();
485 int ComputeLocalFragmentOBB();
486 int ComputeLocalFragmentAABBCenters();
493 void DeleteAllBlocks();
494 int InitializeBlocks(vtkNonOverlappingAMR* input, std::string& materialFractionArrayName,
495 std::string& massArrayName, std::vector<std::string>& volumeWtdAvgArrayNames,
496 std::vector<std::string>& massWtdAvgArrayNames, std::vector<std::string>& summedArrayNames,
497 std::vector<std::string>& integratedArrayNames);
498 void AddBlock(vtkMaterialInterfaceFilterBlock* block,
unsigned char levelOfGhostLayer);
501 void CheckLevelsForNeighbors(vtkMaterialInterfaceFilterBlock* block);
503 int FindFaceNeighbors(
unsigned int blockLevel,
int blockIndex[3],
int faceAxis,
int faceMaxFlag,
504 std::vector<vtkMaterialInterfaceFilterBlock*>* result);
511 int HasNeighbor(
unsigned int blockLevel,
int blockIndex[3],
int neighborDirection[3]);
522 vtkSetStringMacro(MaterialFractionArrayName);
644 double GlobalOrigin[3];
645 double RootSpacing[3];
646 int StandardBlockDimensions[3];
648 void SaveBlockSurfaces(
const char* fileName);
649 void SaveGhostSurfaces(
const char* fileName);
653 std::vector<vtkMaterialInterfaceLevel*>
Levels;
661 double FaceCornerPoints[12];
662 double FaceEdgePoints[12];
663 int FaceEdgeFlags[4];
665 void ComputeFacePoints(vtkMaterialInterfaceFilterIterator* in,
666 vtkMaterialInterfaceFilterIterator* out,
int axis,
int outMaxFlag);
667 void ComputeFaceNeighbors(vtkMaterialInterfaceFilterIterator* in,
668 vtkMaterialInterfaceFilterIterator* out,
int axis,
int outMaxFlag);
670 long ComputeProximity(
const int faceIdx[3],
int faceLevel,
const int ext[6],
int refLevel);
672 void FindNeighbor(
int faceIndex[3],
int faceLevel, vtkMaterialInterfaceFilterIterator* neighbor,
673 vtkMaterialInterfaceFilterIterator* reference);
691 #ifdef vtkMaterialInterfaceFilterDEBUG 698 double ClipCenter[3];
702 double ClipPlaneVector[3];
703 double ClipPlaneNormal[3];
712 #ifdef vtkMaterialInterfaceFilterPROFILE 714 vtkSmartPointer<vtkTimerLog> InitializeBlocksTimer;
715 vtkSmartPointer<vtkTimerLog> ShareGhostBlocksTimer;
717 long NumberOfGhostBlocks;
718 vtkSmartPointer<vtkTimerLog> ProcessBlocksTimer;
719 vtkSmartPointer<vtkTimerLog> ResolveEquivalencesTimer;
vtkImplicitFunction * ClipFunction
vtkDoubleArray * ClipDepthMinimums
vtkMaterialInterfaceEquivalenceSet * EquivalenceSet
int FragmentId
class vtkMaterialInterfaceFilterIntegrator {
Extract particles and analyse them.
Data structure that describes a fragment's loading.
vtkDataArraySelection * SummationArraySelection
vtkMultiProcessController * Controller
std::vector< vtkPolyData * > FragmentMeshes
std::vector< std::vector< int > > ResolvedFragmentIds
vtkMaterialInterfaceFilterIterator * FaceNeighbors
double ProgressMaterialInc
vtkIntArray * FragmentSplitGeometry
vtkDataArraySelection * MaterialArraySelection
vtkDoubleArray * ClipDepthMaximums
vtkMultiBlockDataSet * ResolvedFragments
vtkCallbackCommand * SelectionObserver
std::vector< vtkDoubleArray * > FragmentSums
unsigned char BlockGhostLevel
int * NumberOfRawFragmentsInProcess
vtkMultiBlockDataSet * ResolvedFragmentOBBs
double MaterialFractionThreshold
vtkDoubleArray * FragmentVolumes
int * LocalToGlobalOffsets
vtkDoubleArray * FragmentMoments
std::vector< double > FragmentMoment
vtkMultiBlockDataSet * ResolvedFragmentCenters
std::vector< std::vector< double > > FragmentVolumeWtdAvg
int NumberOfResolvedFragments
vtkMaterialInterfaceFilterBlock ** InputBlocks
int TotalNumberOfRawFragments
std::vector< std::string > VolumeWtdAvgArrayNames
std::vector< std::vector< double > > FragmentSum
std::vector< std::string > MassWtdAvgArrayNames
std::vector< std::vector< int > > FragmentSplitMarker
std::vector< vtkPoints * > ResolvedFragmentPoints
double scaledMaterialFractionThreshold
std::vector< vtkDoubleArray * > FragmentMassWtdAvgs
vtkDoubleArray * FragmentAABBCenters
vtkDataArraySelection * MassWtdAvgArraySelection
std::vector< vtkDoubleArray * > FragmentVolumeWtdAvgs
char * MaterialFractionArrayName
std::vector< std::vector< double > > FragmentMassWtdAvg
std::vector< std::string > IntegratedArrayNames
vtkPolyData * CurrentFragmentMesh
bool WriteStatisticsOutput
vtkDataArraySelection * VolumeWtdAvgArraySelection
int ResolvedFragmentCount
std::vector< vtkMaterialInterfaceFilterBlock * > GhostBlocks
vtkDoubleArray * FragmentOBBs
};
std::vector< int > IntegratedArrayNComp
double ProgressResolutionInc
vtkDataArraySelection * MassArraySelection
std::vector< vtkMaterialInterfaceLevel * > Levels