python - What use instead of global variables in scipy weave? -


I am following the motility of some particles in the Forcefield described by many parameters .

If I do in C or Fortune, then I will define these parameters as Global Variable (this is the most convenient). Here, when I am using spit weaving, I have to give them as a logic of the function. Which I do not like because every time I add or remove a parameter, many functions have to be edited in the title Also, due to passing many arguments the function may be slow ( This performance is a severe tight loop).

For example, the following code parameters k, x_surf, C6, C12, CQ, Zeta, E0 and T1, beta many dependent tasks Repeated in the header of . Inline double forex (double x, double queue, double k, double x_serve, double c6, double c12, double cq, double zeta, double e) {...} inline Double step, double, double, double, double, double, double, double, double, double, double, double, double, double, c, double, c12, double cQ, double zeta, double e, double and x, double and v, double and quo) . .. Double F = getForce (X, Q, K, X_SEF, C6, C12, CQ, ZETA, E.); ...} zero trj2buff (double dt, int nostape, double mass, double t1, double beta, double k, double x_serve, double c 6, double c12, double cq, double zeta, double e, double x-start , Double V_start, double Q_start, double * x_buff, double * v_buff, double * Q_buff) {... move (DT, IMAS, T1, BETA, Q, Q, X_SEF, C6, C12, CQ, Zeta, E, X, V, Q); ...}

One solution will probably pass all the parameters as a single double * buffer (but this code will be less readable because it will be named Will be known from). >


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -