-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFieldTopologyMapData.cxx
84 lines (70 loc) · 2.23 KB
/
FieldTopologyMapData.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
____ _ __ ____ __ ____
/ __/___(_) / ___ ____/ __ \__ _____ ___ / /_ / _/__ ____
_\ \/ __/ / _ \/ -_) __/ /_/ / // / -_|_-</ __/ _/ // _ \/ __/
/___/\__/_/_.__/\__/_/ \___\_\_,_/\__/___/\__/ /___/_//_/\__(_)
Copyright 2012 SciberQuest Inc.
*/
#include "FieldTopologyMapData.h"
#include "TerminationCondition.h"
#include "vtkDataSet.h"
#include "vtkCellData.h"
#include "vtkIntArray.h"
//-----------------------------------------------------------------------------
FieldTopologyMapData::FieldTopologyMapData()
:
IntersectColor(0)
//SourceId(0)
{
this->IntersectColor=vtkIntArray::New();
this->IntersectColor->SetName("IntersectColor");
// this->SourceId=vtkIntArray::New();
// this->SourceId->SetName("SourceId");
}
//-----------------------------------------------------------------------------
FieldTopologyMapData::~FieldTopologyMapData()
{
this->IntersectColor->Delete();
// this->SourceId->Delete();
}
//-----------------------------------------------------------------------------
void FieldTopologyMapData::SetOutput(vtkDataSet *o)
{
o->GetCellData()->AddArray(this->IntersectColor);
// o->GetCellData()->AddArray(this->SourceId);
}
//-----------------------------------------------------------------------------
int *FieldTopologyMapData::Append(vtkIntArray *ia, int nn)
{
vtkIdType ne=ia->GetNumberOfTuples();
return ia->WritePointer(ne,nn);
}
//-----------------------------------------------------------------------------
int FieldTopologyMapData::SyncScalars()
{
vtkIdType nLines=this->Lines.size();
vtkIdType lastLineId=this->IntersectColor->GetNumberOfTuples();
int *pColor=this->IntersectColor->WritePointer(lastLineId,nLines);
// int *pId=this->SourceId->WritePointer(lastLineId,nLines);
for (vtkIdType i=0; i<nLines; ++i)
{
FieldLine *line=this->Lines[i];
*pColor=this->Tcon->GetTerminationColor(line);
pColor+=1;
// *pId=line->GetSeedId();
// ++pId;
}
return 1;
}
//-----------------------------------------------------------------------------
void FieldTopologyMapData::PrintLegend(int reduce)
{
if (reduce)
{
this->Tcon->SqueezeColorMap(this->IntersectColor);
}
else
{
this->Tcon->PrintColorMap();
}
}