gmsh-TingyuanDoc
0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
Go to the documentation of this file.
7 #include "GmshConfig.h"
13 #if defined(HAVE_OPENGL)
44 #if defined(HAVE_OPENGL)
48 for(
int i = 0; i <
getNbU(); ++i) {
49 for(
int j = 0; j <
getNbV(); ++j) {
58 double *opt,
double step,
double min,
149 return "Plugin(StreamLines) computes stream lines "
150 "from the `TimeStep'-th time step of a vector "
151 "view `View' and optionally interpolates the "
152 "scalar view `OtherView' on the resulting stream "
154 "The plugin takes as input a grid defined by the "
155 "3 points (`X0',`Y0',`Z0') (origin), (`X1',`Y1',`Z1') "
156 "(axis of U) and (`X2',`Y2',`Z2') (axis of V).\n\n"
157 "The number of points along U and V that are to be "
158 "transported is set with the options `NumPointsU' "
159 "and `NumPointsV'. The equation\n\n"
160 "dX(t)/dt = V(x,y,z)\n\n"
161 "is then solved with the initial condition X(t=0) "
162 "chosen as the grid and with V(x,y,z) interpolated "
163 "on the vector view.\n\n"
164 "The time stepping scheme is a RK44 with step size "
165 "`DT' and `MaxIter' maximum number of iterations.\n\n"
166 "If `TimeStep' < 0, the plugin tries to compute "
167 "streamlines of the unsteady flow.\n\n"
168 "If `View' < 0, the plugin is run on the current view.\n\n"
169 "Plugin(StreamLines) creates one new list-based view. This "
170 "view contains multi-step vector points if `OtherView' "
171 "< 0, or single-step scalar lines if `OtherView' >= 0.";
196 double u =
getNbU() > 1 ? (double)iU / (
double)(
getNbU() - 1.) : 0.;
197 double v =
getNbV() > 1 ? (double)iV / (
double)(
getNbV() - 1.) : 0.;
224 PView *v2 = (otherView < 0) ?
nullptr :
getView(otherView, v);
234 double *val2 =
nullptr;
244 const double b1 = 1. / 3., b2 = 2. / 3., b3 = 1. / 3.,
b4 = 1. / 6.;
245 const double a1 = 0.5,
a2 = 0.5, a3 = 1.,
a4 = 1.;
246 double XINIT[3], X[3], DX[3], X1[3], X2[3], X3[3], X4[3];
248 for(
int i = 0; i <
getNbU(); ++i) {
249 for(
int j = 0; j <
getNbV(); ++j) {
253 if(data2) { o2->
searchScalar(X[0], X[1], X[2], val2, -1); }
256 data3->
VP.push_back(X[0]);
257 data3->
VP.push_back(X[1]);
258 data3->
VP.push_back(X[2]);
261 int currentTimeStep = 0;
263 for(
int iter = 0; iter < maxIter; iter++) {
264 double XPREV[3] = {X[0], X[1], X[2]};
268 double currentT = T0 +
DT * iter;
269 data3->
Time.push_back(currentT);
271 currentT > 0.5 * (data1->
getTime(currentTimeStep) +
272 data1->
getTime(currentTimeStep + 1));
277 currentTimeStep = timeStep;
287 o1.
searchVector(X[0], X[1], X[2], val, currentTimeStep);
288 for(
int k = 0; k < 3; k++) X1[k] = X[k] +
DT * val[k] *
a1;
289 o1.
searchVector(X1[0], X1[1], X1[2], val, currentTimeStep);
290 for(
int k = 0; k < 3; k++) X2[k] = X[k] +
DT * val[k] *
a2;
291 o1.
searchVector(X2[0], X2[1], X2[2], val, currentTimeStep);
292 for(
int k = 0; k < 3; k++) X3[k] = X[k] +
DT * val[k] * a3;
293 o1.
searchVector(X3[0], X3[1], X3[2], val, currentTimeStep);
294 for(
int k = 0; k < 3; k++) X4[k] = X[k] +
DT * val[k] *
a4;
296 for(
int k = 0; k < 3; k++)
297 X[k] += (
b1 * (X1[k] - X[k]) + b2 * (X2[k] - X[k]) +
298 b3 * (X3[k] - X[k]) +
b4 * (X4[k] - X[k]));
299 for(
int k = 0; k < 3; k++) DX[k] = X[k] - XINIT[k];
303 data3->
SL.push_back(XPREV[0]);
304 data3->
SL.push_back(X[0]);
305 data3->
SL.push_back(XPREV[1]);
306 data3->
SL.push_back(X[1]);
307 data3->
SL.push_back(XPREV[2]);
308 data3->
SL.push_back(X[2]);
310 data3->
SL.push_back(val2[k]);
313 data3->
SL.push_back(val2[k]);
316 data3->
VP.push_back(DX[0]);
317 data3->
VP.push_back(DX[1]);
318 data3->
VP.push_back(DX[2]);
static double callbackZ2(int, int, double)
static double callbackY1(int, int, double)
static double callbackY2(int, int, double)
bool searchScalar(double x, double y, double z, double *values, int step=-1, double *size=nullptr, int qn=0, double *qx=nullptr, double *qy=nullptr, double *qz=nullptr, bool grad=false, int dim=-1)
virtual int getNumTimeSteps()=0
static void(* draw)(void *)
static void Error(const char *fmt,...)
static double callbackX2(int, int, double)
static double callbackV(int, int, double)
virtual void setFileName(const std::string &val)
GMSH_Plugin * GMSH_RegisterStreamLinesPlugin()
virtual double getTime(int step)
static double callbackZ1(int, int, double)
static double callbackU(int, int, double)
bool finalize(bool computeMinMax=true, const std::string &interpolationScheme="")
virtual void setName(const std::string &val)
static double callbackX0(int, int, double)
static double callbackY0(int, int, double)
static double callback(int num, int action, double value, double *opt, double step, double min, double max)
static void getPoint(int iU, int iV, double *X)
StringXNumber * getOption(int iopt)
bool searchVector(double x, double y, double z, double *values, int step=-1, double *size=nullptr, int qn=0, double *qx=nullptr, double *qy=nullptr, double *qz=nullptr, bool grad=false, int dim=-1)
static void setDrawFunction(void(*fct)(void *))
virtual PView * getView(int index, PView *view)
virtual PViewData * getPossiblyAdaptiveData(PView *view)
std::vector< double > Time
PViewOptions * getOptions()
static double callbackX1(int, int, double)
static double callbackZ0(int, int, double)
StringXNumber StreamLinesOptions_Number[]
virtual std::string getName()
void drawSphere(double R, double x, double y, double z, int n1, int n2, int light)
virtual PViewDataList * getDataList(PView *view, bool showError=true)
std::string getHelp() const