Int main ()
{
VtkSmartPointer
VtkSmartPointer
VtkCellArray * cells=vtkCellArray: : New ();
VtkSmartPointer
Scalars - & gt; SetNumberOfTuples (3 * 3 * 3);
VtkSmartPointer
Vectors - & gt; SetNumberOfTuples (3 * 3 * 3);
Vectors - & gt; SetNumberOfComponents (3);
VtkIndent indent.
Auto integ=vtkSmartPointer
Ifstream readFile1 (" C: \ \ Users \ \ Administrator \ \ Desktop \ \ vector TXT ");
Ifstream readFile2 (" C: \ \ Users \ \ Administrator \ \ Desktop \ \ scalar TXT ");
Double \ [27]={0.0};
Double vector [27] [3]={0.0};
VtkIdType idtype;
Int t=0, id=0;
for (int i=0; I & lt; 27. I++)
{
ReadFile2 & gt;> \ [I];
for (int j=0; J & lt; 3; J++)
{
ReadFile1 & gt;> The vector [I] [j];
}
}
for (int i=0; I & lt; 27. I++)
{
Scalars - & gt; InsertTuple1 (I, \ [I]);
Vectors - & gt; InsertTuple3 (I, vector [I] [0], the vector [I] [1], the vector [I] [2]).
}
ReadFile1. Close ();
ReadFile2. Close ();
Points1 - & gt; SetDimensions (3, 3, 3);
Points1 - & gt; SetOrigin (0, 0, 0);
Points1 - & gt; SetSpacing (1.0, 1.0, 1.0);
Points1 - & gt; GetPointData () - & gt; SetScalars (scalars);
Points1 - & gt; GetPointData () - & gt; SetVectors (vectors);
VtkSmartPointer
VtkSmartPointer
GeometryFilter - & gt; SetInputData (Points1);
GeometryFilter - & gt; The Update ();
Scalars - & gt; The Delete ();
Vectors - & gt; The Delete ();
Auto colors=
VtkSmartPointer
//the Source of the streamlines -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
VtkSmartPointer
VtkSmartPointer
Seeds - & gt; SetXResolution (10);
Seeds - & gt; SetYResolution (10);
Seeds - & gt; SetOrigin (0, 0, 0);
Seeds - & gt; SetPoint1 (3, 0, 0);
Seeds - & gt; SetPoint2 (0, 0, 3);
Auto streamer=
VtkSmartPointer
The streamer - & gt; SetInputConnection (geometryFilter - & gt; GetOutputPort ());
The streamer - & gt; SetSourceConnection (seeds - & gt; GetOutputPort ());
The streamer - & gt; SetMaximumPropagation (100); Steps//
The streamer - & gt; SetInitialIntegrationStep (0.05);//step
The streamer - & gt; SetIntegrationDirectionToBoth ();//integral direction
//the streamer - & gt; SetIntegrationDirectionToForward ();
//the streamer - & gt; SetIntegrator (integ);////fourth order Runge - Kutta method used for numerical solution of ordinary differential equations of higher accuracy,
//define the color mapping table
VtkSmartPointer
//set the color in the color table
PColorTable - & gt; SetNumberOfColors (256);
PColorTable - & gt; SetHueRange (0.7 0);//the tonal range from red to blue
PColorTable - & gt; Build ();
VtkSmartPointer
VtkSmartPointer
StreamLineMapper - & gt; SetInputConnection (streamer - & gt; GetOutputPort ());
StreamLineMapper - & gt; SetScalarRange (0, 10);
StreamLineMapper - & gt; SetLookupTable (pColorTable);
//Actor
VtkSmartPointer
StreamLineActor - & gt; SetMapper (streamLineMapper);
StreamLineActor - & gt; GetProperty () - & gt; SetPointSize (5);
//streamLineActor - & gt; GetProperty () - & gt; SetLineWidth (2);
//*/
//Now create the usual graphics stuff.
Auto the renderer=
VtkSmartPointer
Auto renderWindow=
VtkSmartPointer
RenderWindow - & gt; AddRenderer (the renderer);
Auto interactor=
VtkSmartPointer
Interactor - & gt; SetRenderWindow (renderWindow);
VtkSmartPointer
Interactor - & gt; SetInteractorStyle (style);
The renderer - & gt; AddActor (streamLineActor);
The renderer - & gt; SetBackground (colors - & gt; GetColor3d (" SlateGray "). The GetData ());
RenderWindow - & gt; SetSize (640, 480);
RenderWindow - & gt; Render ();
Interactor - & gt; Start ().
return 1;
}
An error
CodePudding user response:
The call stack,