fix LGlyph dt tracking
This commit is contained in:
parent
4e18d957d1
commit
f7c4b7883d
|
|
@ -139,7 +139,7 @@ void LGlyphLayer::updateData(int t) {
|
||||||
|
|
||||||
// supersampling
|
// supersampling
|
||||||
for (int i=0; i < SUPERSAMPLINGRATE; i++) {
|
for (int i=0; i < SUPERSAMPLINGRATE; i++) {
|
||||||
std::tie(point[1], point[0]) = advector->advect(t, point[1], point[0], (t-this->lastT)/SUPERSAMPLINGRATE);
|
std::tie(point[1], point[0]) = advector->advect(t, point[1], point[0], this->dt/SUPERSAMPLINGRATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the particle's location remains unchanged, increase beachedFor number. Else, decrease it and update point position.
|
// if the particle's location remains unchanged, increase beachedFor number. Else, decrease it and update point position.
|
||||||
|
|
@ -153,7 +153,6 @@ void LGlyphLayer::updateData(int t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modifiedData) this->points->Modified();
|
if (modifiedData) this->points->Modified();
|
||||||
this->lastT = t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LGlyphLayer::addObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) {
|
void LGlyphLayer::addObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) {
|
||||||
|
|
@ -162,3 +161,8 @@ void LGlyphLayer::addObservers(vtkSmartPointer<vtkRenderWindowInteractor> intera
|
||||||
interactor->AddObserver(vtkCommand::LeftButtonReleaseEvent, newPointCallBack);
|
interactor->AddObserver(vtkCommand::LeftButtonReleaseEvent, newPointCallBack);
|
||||||
interactor->AddObserver(vtkCommand::MouseMoveEvent, newPointCallBack);
|
interactor->AddObserver(vtkCommand::MouseMoveEvent, newPointCallBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LGlyphLayer::setDt(int dt) {
|
||||||
|
this->dt = dt;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ private:
|
||||||
vtkSmartPointer<vtkIntArray> particlesBeached;
|
vtkSmartPointer<vtkIntArray> particlesBeached;
|
||||||
std::unique_ptr<AdvectionKernel> advector;
|
std::unique_ptr<AdvectionKernel> advector;
|
||||||
std::shared_ptr<UVGrid> uvGrid;
|
std::shared_ptr<UVGrid> uvGrid;
|
||||||
int lastT = 1000;
|
int dt = 3600;
|
||||||
int beachedAtNumberOfTimes = 20;
|
int beachedAtNumberOfTimes = 20;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -39,6 +39,12 @@ public:
|
||||||
vtkSmartPointer<SpawnPointCallback> createSpawnPointCallback();
|
vtkSmartPointer<SpawnPointCallback> createSpawnPointCallback();
|
||||||
|
|
||||||
void addObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) override;
|
void addObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) override;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a custom DT value, needed for advect calls to the simulation logic.
|
||||||
|
*/
|
||||||
|
void setDt(int dt);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ int main() {
|
||||||
|
|
||||||
auto l = new LGlyphLayer(uvGrid, std::move(kernelRK4BoundaryChecked));
|
auto l = new LGlyphLayer(uvGrid, std::move(kernelRK4BoundaryChecked));
|
||||||
l->spoofPoints();
|
l->spoofPoints();
|
||||||
|
l->setDt(DT);
|
||||||
|
|
||||||
unique_ptr<Program> program = make_unique<Program>(DT);
|
unique_ptr<Program> program = make_unique<Program>(DT);
|
||||||
program->addLayer(new BackgroundImage("../../../../data/map_661-661.png"));
|
program->addLayer(new BackgroundImage("../../../../data/map_661-661.png"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue