From: Roman Lygin Date: Fri, 31 May 2013 13:04:58 +0000 (+0400) Subject: 0023952: Improving thread-safety of intersections, approximations and other modeling... X-Git-Tag: V6_7_0_beta~258 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=1ef32e96ee89dc3e7d0b44fe887fe44fc908f8f2;hp=416d012709be8aa7529bb95cbe01862aaf8f3acc 0023952: Improving thread-safety of intersections, approximations and other modeling algorithms AdvApp2Var_SysBase::mcrgene_ size reduced from 1000 to 32 elements, and each element reworked into typed structure. fixed IntAna_Curve.cxx to prevent access to #NAN# SigneSqrtDis fixed alignment of doubles by 8 bytes, and minor corrections Minor correction: static const N given more specific name (MAX_ALLOC_NB) Added QAcommands OCC23952sweep and OCC23952intersect Added test cases bugs/modalg_5/bug23952_1 bug23952_2 --- diff --git a/src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx b/src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx index 8d1e0e39e9..6c1a77ec7a 100755 --- a/src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx +++ b/src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx @@ -277,7 +277,7 @@ int mma1cdi_(integer *ndimen, doublereal *hermit, integer *iercod) { - static integer c__1 = 1; + integer c__1 = 1; /* System generated locals */ integer contr1_dim1, contr1_offset, contr2_dim1, contr2_offset, @@ -286,9 +286,9 @@ int mma1cdi_(integer *ndimen, i__2, i__3; /* Local variables */ - static integer nroo2, ncfhe, nd, ii, kk; - static integer ibb, kkm, kkp; - static doublereal bid1, bid2, bid3; + integer nroo2, ncfhe, nd, ii, kk; + integer ibb, kkm, kkp; + doublereal bid1, bid2, bid3; /* ********************************************************************** */ @@ -505,8 +505,8 @@ int mma1cnt_(integer *ndimen, i__2, i__3; /* Local variables */ - static integer nd, ii, jj, ibb; - static doublereal bid; + integer nd, ii, jj, ibb; + doublereal bid; /* *********************************************************************** @@ -643,10 +643,10 @@ int mma1fdi_(integer *ndimen, doublereal d__1; /* Local variables */ - static integer ideb, ifin, nroo2, ideru, iderv; - static doublereal renor; - static integer ii, nd, ibb, iim, nbp, iip; - static doublereal bid1, bid2; + integer ideb, ifin, nroo2, ideru, iderv; + doublereal renor; + integer ii, nd, ibb, iim, nbp, iip; + doublereal bid1, bid2; /* ********************************************************************** */ @@ -971,8 +971,8 @@ int mma1fer_(integer *,//ndimen, integer crvjac_dim1, crvjac_offset, i__1, i__2; /* Local variables */ - static integer idim, ncfja, ncfnw, ndses, ii, kk, ibb, ier; - static integer nbr0; + integer idim, ncfja, ncfnw, ndses, ii, kk, ibb, ier; + integer nbr0; /* *********************************************************************** @@ -1165,7 +1165,7 @@ int AdvApp2Var_ApproxF2var::mma1her_(const integer *iordre, integer hermit_dim1, hermit_offset; /* Local variables */ - static integer ibb; + integer ibb; @@ -1333,7 +1333,7 @@ int mma1jak_(integer *ndimen, crvjac_dim1, crvjac_offset, cgauss_dim1; /* Local variables */ - static integer ibb; + integer ibb; /* ********************************************************************** */ @@ -1448,9 +1448,9 @@ int mma1noc_(doublereal *dfuvin, doublereal d__1; /* Local variables */ - static doublereal rider, riord; - static integer nd, ibb; - static doublereal bid; + doublereal rider, riord; + integer nd, ibb; + doublereal bid; /* ********************************************************************** */ @@ -1581,8 +1581,8 @@ int mma1nop_(integer *nbroot, integer i__1; /* Local variables */ - static doublereal alinu, blinu, alinv, blinv; - static integer ii, ibb; + doublereal alinu, blinu, alinv, blinv; + integer ii, ibb; /* *********************************************************************** */ @@ -1700,11 +1700,11 @@ int AdvApp2Var_ApproxF2var::mma2ac1_(integer const *ndimen, patjac_dim2, patjac_offset, i__1, i__2, i__3, i__4, i__5; /* Local variables */ - static logical ldbg; - static integer ndgu, ndgv; - static doublereal bidu1, bidu2, bidv1, bidv2; - static integer ioru1, iorv1, ii, nd, jj, ku, kv; - static doublereal cnt1, cnt2, cnt3, cnt4; + logical ldbg; + integer ndgu, ndgv; + doublereal bidu1, bidu2, bidv1, bidv2; + integer ioru1, iorv1, ii, nd, jj, ku, kv; + doublereal cnt1, cnt2, cnt3, cnt4; /* ********************************************************************** */ @@ -1865,9 +1865,9 @@ int AdvApp2Var_ApproxF2var::mma2ac2_(const integer *ndimen, vhermt_dim1, vhermt_offset, i__1, i__2, i__3, i__4; /* Local variables */ - static logical ldbg; - static integer ndgv1, ndgv2, ii, jj, nd, kk; - static doublereal bid1, bid2; + logical ldbg; + integer ndgv1, ndgv2, ii, jj, nd, kk; + doublereal bid1, bid2; /* ********************************************************************** */ @@ -2011,9 +2011,9 @@ int AdvApp2Var_ApproxF2var::mma2ac3_(const integer *ndimen, uhermt_dim1, uhermt_offset, i__1, i__2, i__3, i__4; /* Local variables */ - static logical ldbg; - static integer ndgu1, ndgu2, ii, jj, nd, kk; - static doublereal bid1, bid2; + logical ldbg; + integer ndgu1, ndgu2, ii, jj, nd, kk; + doublereal bid1, bid2; /* ********************************************************************** */ @@ -2157,8 +2157,8 @@ int AdvApp2Var_ApproxF2var::mma2can_(const integer *ncfmxu, patcan_offset, i__1, i__2; /* Local variables */ - static logical ldbg; - static integer ilon1, ilon2, ii, nd; + logical ldbg; + integer ilon1, ilon2, ii, nd; /* ********************************************************************** */ @@ -2310,7 +2310,7 @@ int mma2cd1_(integer *ndimen, doublereal *diditb) { - static integer c__1 = 1; + integer c__1 = 1; /* System generated locals */ integer contr1_dim1, contr1_dim2, contr1_offset, contr2_dim1, contr2_dim2, @@ -2324,10 +2324,10 @@ int mma2cd1_(integer *ndimen, i__5; /* Local variables */ - static integer ncfhu, ncfhv, nuroo, nvroo, nd, ii, jj, kk, ll, ibb, kkm, + integer ncfhu, ncfhv, nuroo, nvroo, nd, ii, jj, kk, ll, ibb, kkm, llm, kkp, llp; - static doublereal bid1, bid2, bid3, bid4; - static doublereal diu1, diu2, div1, div2, sou1, sou2, sov1, sov2; + doublereal bid1, bid2, bid3, bid4; + doublereal diu1, diu2, div1, div2, sou1, sou2, sov1, sov2; /* ********************************************************************** */ @@ -2670,7 +2670,7 @@ int mma2cd2_(integer *ndimen, doublereal *diditb) { - static integer c__1 = 1; + integer c__1 = 1; /* System generated locals */ integer sotbv1_dim1, sotbv1_dim2, sotbv1_offset, sotbv2_dim1, sotbv2_dim2, sotbv2_offset, ditbv1_dim1, ditbv1_dim2, ditbv1_offset, @@ -2681,8 +2681,8 @@ int mma2cd2_(integer *ndimen, disotb_dim1, disotb_dim2, disotb_offset, i__1, i__2, i__3, i__4; /* Local variables */ - static integer ncfhv, nuroo, nvroo, ii, nd, jj, kk, ibb, jjm, jjp; - static doublereal bid1, bid2, bid3, bid4; + integer ncfhv, nuroo, nvroo, ii, nd, jj, kk, ibb, jjm, jjp; + doublereal bid1, bid2, bid3, bid4; /* ********************************************************************** */ @@ -2982,7 +2982,7 @@ int mma2cd3_(integer *ndimen, doublereal *diditb) { - static integer c__1 = 1; + integer c__1 = 1; /* System generated locals */ integer sotbu1_dim1, sotbu1_dim2, sotbu1_offset, sotbu2_dim1, sotbu2_dim2, @@ -2994,8 +2994,8 @@ int mma2cd3_(integer *ndimen, disotb_dim1, disotb_dim2, disotb_offset, i__1, i__2, i__3, i__4; /* Local variables */ - static integer ncfhu, nuroo, nvroo, ii, nd, jj, kk, ibb, kkm, kkp; - static doublereal bid1, bid2, bid3, bid4; + integer ncfhu, nuroo, nvroo, ii, nd, jj, kk, ibb, kkm, kkp; + doublereal bid1, bid2, bid3, bid4; /* ********************************************************************** */ @@ -3308,7 +3308,7 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* System generated locals */ integer contr1_dim1, contr1_dim2, contr1_offset, contr2_dim1, contr2_dim2, @@ -3319,13 +3319,13 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen, disotb_offset; /* Local variables */ - static integer ilong; - static intptr_t iofwr; - static doublereal wrkar[1]; - static integer iszwr; - static integer ibb, ier; - static integer isz1, isz2, isz3, isz4; - static intptr_t ipt1, ipt2, ipt3, ipt4; + integer ilong; + intptr_t iofwr; + doublereal* wrkar = 0; + integer iszwr; + integer ibb, ier; + integer isz1, isz2, isz3, isz4; + intptr_t ipt1, ipt2, ipt3, ipt4; @@ -3471,6 +3471,7 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen, --sotbv2; --ditbv1; --ditbv2; + AdvApp2Var_SysBase anAdvApp2Var_SysBase; /* Function Body */ ibb = AdvApp2Var_SysBase::mnfndeb_(); @@ -3506,7 +3507,7 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen, isz3 = ((*iordru + 1) << 1) * *nbpntu; isz4 = ((*iordrv + 1) << 1) * *nbpntv; iszwr = isz1 + isz2 + isz3 + isz4; - AdvApp2Var_SysBase::mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier); + anAdvApp2Var_SysBase.mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier); if (ier > 0) { goto L9013; } @@ -3579,7 +3580,7 @@ L9013: L9999: if (iofwr != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier); + anAdvApp2Var_SysBase.mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier); } if (ier > 0) { *iercod = 13; @@ -3623,7 +3624,7 @@ int AdvApp2Var_ApproxF2var::mma2ce1_(integer *numdec, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* System generated locals */ integer sosotb_dim1, sosotb_dim2, sosotb_offset, disotb_dim1, disotb_dim2, @@ -3632,13 +3633,13 @@ int AdvApp2Var_ApproxF2var::mma2ce1_(integer *numdec, patjac_offset; /* Local variables */ - static logical ldbg; - static intptr_t iofwr; - static doublereal wrkar[1]; - static integer iszwr; - static integer ier; - static integer isz1, isz2, isz3, isz4, isz5, isz6, isz7; - static intptr_t ipt1, ipt2, ipt3, ipt4, ipt5, ipt6, ipt7; + logical ldbg; + intptr_t iofwr; + doublereal* wrkar = 0; + integer iszwr; + integer ier; + integer isz1, isz2, isz3, isz4, isz5, isz6, isz7; + intptr_t ipt1, ipt2, ipt3, ipt4, ipt5, ipt6, ipt7; @@ -3799,7 +3800,8 @@ int AdvApp2Var_ApproxF2var::mma2ce1_(integer *numdec, isz6 = *ndjacv + 1 - ((*iordrv + 1) << 1); isz7 = *ndimen << 2; iszwr = isz1 + isz2 + isz3 + isz4 + isz5 + isz6 + isz7; - AdvApp2Var_SysBase::mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier); + AdvApp2Var_SysBase anAdvApp2Var_SysBase; + anAdvApp2Var_SysBase.mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier); if (ier > 0) { goto L9013; } @@ -3853,7 +3855,7 @@ L9013: L9999: if (iofwr != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier); + anAdvApp2Var_SysBase.mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier); } if (ier > 0) { *iercod = 13; @@ -3913,12 +3915,12 @@ int mma2ce2_(integer *numdec, patjac_offset, vecerr_dim1, vecerr_offset, i__1, i__2, i__3, i__4; /* Local variables */ - static logical ldbg; - static integer idim, igsu, minu, minv, maxu, maxv, igsv; - static doublereal vaux[3]; - static integer i2rdu, i2rdv, ndses, nd, ii, jj, kk, nu, nv; - static doublereal zu, zv; - static integer nu1, nv1; + logical ldbg; + integer idim, igsu, minu, minv, maxu, maxv, igsv; + doublereal vaux[3]; + integer i2rdu, i2rdv, ndses, nd, ii, jj, kk, nu, nv; + doublereal zu, zv; + integer nu1, nv1; /* ********************************************************************** */ @@ -4678,9 +4680,9 @@ int mma2cfu_(integer *ndujac, soditb_offset, diditb_dim1, i__1, i__2; /* Local variables */ - static logical ldbg; - static integer nptu2, nptv2, ii, jj; - static doublereal bid0, bid1, bid2; + logical ldbg; + integer nptu2, nptv2, ii, jj; + doublereal bid0, bid1, bid2; /* ********************************************************************** */ @@ -4894,9 +4896,9 @@ int mma2cfv_(integer *ndvjac, patjac_offset, i__1, i__2; /* Local variables */ - static logical ldbg; - static integer nptv2, ii, jj; - static doublereal bid1; + logical ldbg; + integer nptv2, ii, jj; + doublereal bid1; /* ********************************************************************** */ @@ -5052,9 +5054,9 @@ int AdvApp2Var_ApproxF2var::mma2ds1_(integer *ndimen, fpntab_offset, i__1; /* Local variables */ - static logical ldbg; - static integer ibid1, ibid2, iuouv, nd; - static integer isz1, isz2; + logical ldbg; + integer ibid1, ibid2, iuouv, nd; + integer isz1, isz2; /* ********************************************************************** */ @@ -5365,7 +5367,7 @@ int mma2ds2_(integer *ndimen, integer *iercod) { - static integer c__0 = 0; + integer c__0 = 0; /* System generated locals */ integer sosotb_dim1, sosotb_dim2, sosotb_offset, disotb_dim1, disotb_dim2, disotb_offset, soditb_dim1, soditb_dim2, soditb_offset, @@ -5373,12 +5375,12 @@ int mma2ds2_(integer *ndimen, fpntab_offset, i__1, i__2, i__3; /* Local variables */ - static integer jdec; - static logical ldbg; - static doublereal alinu, blinu, alinv, blinv, tcons; - static doublereal dbfn1[2], dbfn2[2]; - static integer nuroo, nvroo, id, iu, iv; - static doublereal um, up; + integer jdec; + logical ldbg; + doublereal alinu, blinu, alinv, blinv, tcons; + doublereal dbfn1[2], dbfn2[2]; + integer nuroo, nvroo, id, iu, iv; + doublereal um, up; /* ********************************************************************** @@ -5749,11 +5751,11 @@ int mma2er1_(integer *ndjacu, doublereal d__1; /* Local variables */ - static logical ldbg; - static integer minu, minv; - static doublereal vaux[2]; - static integer ii, nd, jj; - static doublereal bid0, bid1; + logical ldbg; + integer minu, minv; + doublereal vaux[2]; + integer ii, nd, jj; + doublereal bid0, bid1; /* ********************************************************************** */ @@ -5915,12 +5917,12 @@ int mma2er2_(integer *ndjacu, doublereal d__1; /* Local variables */ - static logical ldbg; - static doublereal vaux[2]; - static integer i2rdu, i2rdv; - static doublereal errnu, errnv; - static integer ii, nd, jj, nu, nv; - static doublereal bid0, bid1; + logical ldbg; + doublereal vaux[2]; + integer i2rdu, i2rdv; + doublereal errnu, errnv; + integer ii, nd, jj, nu, nv; + doublereal bid0, bid1; /* ********************************************************************** */ @@ -6155,7 +6157,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* System generated locals */ integer courbe_dim1, courbe_dim2, courbe_offset, somtab_dim1, somtab_dim2, @@ -6166,22 +6168,22 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen, doublereal d__1; /* Local variables */ - static integer ideb; - static doublereal tmil; - static integer ideb1, ibid1, ibid2, ncfja, ndgre, ilong, + integer ideb; + doublereal tmil; + integer ideb1, ibid1, ibid2, ncfja, ndgre, ilong, ndwrk; - static doublereal wrkar[1]; - static integer nupil; - static intptr_t iofwr; - static doublereal uvpav[4] /* was [2][2] */; - static integer nd, ii; - static integer ibb; - static integer ier; - static doublereal uv11[4] /* was [2][2] */; - static integer ncb1; - static doublereal eps3; - static integer isz1, isz2, isz3, isz4, isz5; - static intptr_t ipt1, ipt2, ipt3, ipt4, ipt5,iptt, jptt; + doublereal* wrkar = 0; + integer nupil; + intptr_t iofwr; + doublereal uvpav[4] /* was [2][2] */; + integer nd, ii; + integer ibb; + integer ier; + doublereal uv11[4] /* was [2][2] */; + integer ncb1; + doublereal eps3; + integer isz1, isz2, isz3, isz4, isz5; + intptr_t ipt1, ipt2, ipt3, ipt4, ipt5,iptt, jptt; /* ********************************************************************** */ @@ -6370,6 +6372,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen, courbe_dim2 = *ndimen; courbe_offset = courbe_dim1 * (courbe_dim2 + 1) + 1; courbe -= courbe_offset; + AdvApp2Var_SysBase anAdvApp2Var_SysBase; /* Function Body */ ibb = AdvApp2Var_SysBase::mnfndeb_(); @@ -6429,7 +6432,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen, isz5 = (*ndgjac + 1) * *ndimen; ndwrk = isz1 + isz2 + isz3 + isz4 + isz5; - AdvApp2Var_SysBase::mcrrqst_(&c__8, &ndwrk, wrkar, &iofwr, &ier); + anAdvApp2Var_SysBase.mcrrqst_(&c__8, &ndwrk, wrkar, &iofwr, &ier); if (ier > 0) { goto L9013; } /* --> For the parameters of discretisation (NBROOT+2 extremities). */ @@ -6666,7 +6669,7 @@ L9100: L9900: if (iofwr != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, &ndwrk, wrkar, &iofwr, &ier); + anAdvApp2Var_SysBase.mcrdelt_(&c__8, &ndwrk, wrkar, &iofwr, &ier); } if (ier > 0) { *iercod = 13; @@ -6715,9 +6718,9 @@ int AdvApp2Var_ApproxF2var::mma2fx6_(integer *ncfmxu, doublereal d__1, d__2; /* Local variables */ - static integer idim, ncfu, ncfv, id, ii, nd, jj, ku, kv, ns, ibb; - static doublereal bid; - static doublereal tol; + integer idim, ncfu, ncfv, id, ii, nd, jj, ku, kv, ns, ibb; + doublereal bid; + doublereal tol; /* ********************************************************************** */ @@ -7146,9 +7149,9 @@ int AdvApp2Var_ApproxF2var::mma2jmx_(integer *ndgjac, integer i__1; /* Local variables */ - static logical ldbg; - static integer numax, ii; - static doublereal bid; + logical ldbg; + integer numax, ii; + doublereal bid; /* ********************************************************************** @@ -7250,9 +7253,9 @@ int mma2moy_(integer *ndgumx, integer patjac_dim1, patjac_dim2, patjac_offset, i__1, i__2, i__3; /* Local variables */ - static logical ldbg; - static integer minu, minv, idebu, idebv, ii, nd, jj; - static doublereal bid0, bid1; + logical ldbg; + integer minu, minv, idebu, idebv, ii, nd, jj; + doublereal bid0, bid1; /* ********************************************************************** @@ -7397,7 +7400,7 @@ int AdvApp2Var_ApproxF2var::mma2roo_(integer *nbpntu, integer i__1; /* Local variables */ - static integer ii, ibb; + integer ii, ibb; /* ********************************************************************** */ @@ -7503,9 +7506,9 @@ int mmmapcoe_(integer *ndim, crvjac_dim1, crvjac_offset, gsstab_dim1, i__1, i__2, i__3; /* Local variables */ - static integer igss, ikdeb; - static doublereal bidon; - static integer nd, ik, ir, nbroot, ibb; + integer igss, ikdeb; + doublereal bidon; + integer nd, ik, ir, nbroot, ibb; /* ********************************************************************** */ @@ -7664,9 +7667,9 @@ int mmaperm_(integer *ncofmx, integer crvjac_dim1, crvjac_offset, i__1, i__2; /* Local variables */ - static doublereal bidj; - static integer i__, ia, nd, ncfcut, ibb; - static doublereal bid; + doublereal bidj; + integer i__, ia, nd, ncfcut, ibb; + doublereal bid; /* ********************************************************************** */ @@ -7773,7 +7776,7 @@ int AdvApp2Var_ApproxF2var::mmapptt_(const integer *ndgjac, integer cgauss_dim1, i__1; /* Local variables */ - static integer kjac, iptt, ipdb0, infdg, iptdb, mxjac, ilong, ibb; + integer kjac, iptt, ipdb0, infdg, iptdb, mxjac, ilong, ibb; /* ********************************************************************** */ @@ -8077,7 +8080,7 @@ int mmjacpt_(const integer *ndimen, ptcaux_offset, i__1, i__2, i__3; /* Local variables */ - static integer kdim, nd, ii, jj, ibb; + integer kdim, nd, ii, jj, ibb; /* *********************************************************************** */ diff --git a/src/AdvApp2Var/AdvApp2Var_MathBase.cxx b/src/AdvApp2Var/AdvApp2Var_MathBase.cxx index e5ee691910..110ff02942 100755 --- a/src/AdvApp2Var/AdvApp2Var_MathBase.cxx +++ b/src/AdvApp2Var/AdvApp2Var_MathBase.cxx @@ -266,15 +266,15 @@ int AdvApp2Var_MathBase::mdsptpt_(integer *ndimen, doublereal *distan) { - static integer c__8 = 8; + integer c__8 = 8; /* System generated locals */ integer i__1; doublereal d__1; /* Local variables */ - static integer i__; - static doublereal differ[100]; - static integer ier; + integer i__; + doublereal* differ = 0; + integer ier; intptr_t iofset, j; /* ********************************************************************** @@ -331,8 +331,9 @@ int AdvApp2Var_MathBase::mdsptpt_(integer *ndimen, /* *********************************************************************** */ + AdvApp2Var_SysBase anAdvApp2Var_SysBase; if (*ndimen > 100) { - AdvApp2Var_SysBase::mcrrqst_(&c__8, ndimen, differ, &iofset, &ier); + anAdvApp2Var_SysBase.mcrrqst_(&c__8, ndimen, differ, &iofset, &ier); } /* --- If allocation is refused, the trivial method is applied. */ @@ -371,7 +372,7 @@ int AdvApp2Var_MathBase::mdsptpt_(integer *ndimen, /* --- Dynamic Desallocation */ if (iofset != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, ndimen, differ, &iofset, &ier); + anAdvApp2Var_SysBase.mcrdelt_(&c__8, ndimen, differ, &iofset, &ier); } return 0 ; @@ -389,7 +390,7 @@ int mfac_(doublereal *f, integer i__1; /* Local variables */ - static integer i__; + integer i__; /* FORTRAN CONFORME AU TEXT */ /* CALCUL DE MFACTORIEL N */ @@ -422,7 +423,7 @@ int AdvApp2Var_MathBase::mmapcmp_(integer *ndim, i__2; /* Local variables */ - static integer ipair, nd, ndegre, impair, ibb, idg; + integer ipair, nd, ndegre, impair, ibb, idg; //extern int mgsomsg_();//mgenmsg_(), /* ********************************************************************** @@ -538,9 +539,9 @@ int mmaper0_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer ncut; - static doublereal bidon; - static integer ii, nd; + integer ncut; + doublereal bidon; + integer ii, nd; /* *********************************************************************** */ @@ -716,9 +717,9 @@ int mmaper2_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer idec, ncut; - static doublereal bidon; - static integer ii, nd; + integer idec, ncut; + doublereal bidon; + integer ii, nd; @@ -900,9 +901,9 @@ int mmaper4_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer idec, ncut; - static doublereal bidon; - static integer ii, nd; + integer idec, ncut; + doublereal bidon; + integer ii, nd; @@ -1079,9 +1080,9 @@ int mmaper6_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer idec, ncut; - static doublereal bidon; - static integer ii, nd; + integer idec, ncut; + doublereal bidon; + integer ii, nd; @@ -1201,7 +1202,7 @@ int AdvApp2Var_MathBase::mmaperx_(integer *ncofmx, integer crvjac_dim1, crvjac_offset; /* Local variables */ - static integer jord; + integer jord; /* ********************************************************************** */ @@ -1297,11 +1298,11 @@ int AdvApp2Var_MathBase::mmaperx_(integer *ncofmx, i__2, i__3; /* Local variables */ - static integer nboct; - static doublereal tbaux[61]; - static integer nd; - static doublereal bid; - static integer ncf, ncj; + integer nboct; + doublereal tbaux[61]; + integer nd; + doublereal bid; + integer ncf, ncj; /* IMPLICIT DOUBLE PRECISION(A-H,O-Z) */ @@ -1542,14 +1543,14 @@ int AdvApp2Var_MathBase::mmarcin_(integer *ndimax, doublereal d__1; /* Local variables */ - static doublereal x0, x1; - static integer nd; - static doublereal tabaux[61]; - static integer ibb; - static doublereal bid; - static integer ncf; - static integer ncj; - static doublereal eps3; + doublereal x0, x1; + integer nd; + doublereal tabaux[61]; + integer ibb; + doublereal bid; + integer ncf; + integer ncj; + doublereal eps3; @@ -1767,10 +1768,10 @@ int mmatvec_(integer *nligne, integer i__1, i__2; /* Local variables */ - static logical ldbg; - static integer jmin, jmax, i__, j, k; - static doublereal somme; - static integer aux; + logical ldbg; + integer jmin, jmax, i__, j, k; + doublereal somme; + integer aux; /* *********************************************************************** @@ -1917,9 +1918,9 @@ int AdvApp2Var_MathBase::mmbulld_(integer *nbcoln, integer dtabtr_dim1, dtabtr_offset, i__1, i__2; /* Local variables */ - static logical ldbg; - static doublereal daux; - static integer nite1, nite2, nchan, i1, i2; + logical ldbg; + doublereal daux; + integer nite1, nite2, nchan, i1, i2; /* *********************************************************************** */ @@ -2070,8 +2071,8 @@ int AdvApp2Var_MathBase::mmcdriv_(integer *ndimen, i__2; /* Local variables */ - static integer i__, j, k; - static doublereal mfactk, bid; + integer i__, j, k; + doublereal mfactk, bid; /* *********************************************************************** @@ -2248,15 +2249,15 @@ int AdvApp2Var_MathBase::mmcglc1_(integer *ndimax, doublereal d__1; /* Local variables */ - static integer ndec; - static doublereal tdeb, tfin; - static integer iter; - static doublereal oldso; - static integer itmax; - static doublereal sottc; - static integer kk, ibb; - static doublereal dif, pas; - static doublereal som; + integer ndec; + doublereal tdeb, tfin; + integer iter; + doublereal oldso; + integer itmax; + doublereal sottc; + integer kk, ibb; + doublereal dif, pas; + doublereal som; /* *********************************************************************** @@ -2478,10 +2479,10 @@ int mmchole_(integer *,//mxcoef, //double sqrt(); /* Local variables */ - static logical ldbg; - static integer kmin, i__, j, k; - static doublereal somme; - static integer ptini, ptcou; + logical ldbg; + integer kmin, i__, j, k; + doublereal somme; + integer ptini, ptcou; /* *********************************************************************** @@ -2648,10 +2649,10 @@ int AdvApp2Var_MathBase::mmcvctx_(integer *ndimen, i__2; /* Local variables */ - static integer moup1, nordr; - static integer nd; - static integer ibb, ncf, ndv; - static doublereal eps1; + integer moup1, nordr; + integer nd; + integer ibb, ncf, ndv; + doublereal eps1; /* *********************************************************************** @@ -2896,7 +2897,7 @@ L9999: integer curve_dim1, curve_offset, curveo_dim1, curveo_offset, i__1, i__2; /* Local variables */ - static integer i__, nd, ibb; + integer i__, nd, ibb; /* *********************************************************************** @@ -2976,8 +2977,8 @@ int mmcvstd_(integer *ncofmx, integer courbe_dim1, crvcan_dim1, crvcan_offset, i__1, i__2, i__3; /* Local variables */ - static integer ndeg, i__, j, j1, nd, ibb; - static doublereal bid; + integer ndeg, i__, j, j1, nd, ibb; + doublereal bid; /* *********************************************************************** @@ -3131,7 +3132,7 @@ int AdvApp2Var_MathBase::mmdrc11_(integer *iordre, /* Local variables */ - static integer ndeg, i__, j, ndgcb, nd, ibb; + integer ndeg, i__, j, ndgcb, nd, ibb; /* ********************************************************************** @@ -3318,7 +3319,7 @@ int mmdrvcb_(integer *ideriv, integer courbe_dim1, tabpnt_dim1, i__1, i__2, i__3; /* Local variables */ - static integer ndeg, i__, j, nd, ndgcrb, iptpnt, ibb; + integer ndeg, i__, j, nd, ndgcrb, iptpnt, ibb; /* *********************************************************************** @@ -3500,8 +3501,8 @@ int AdvApp2Var_MathBase::mmdrvck_(integer *ncoeff, integer courbe_dim1, courbe_offset, i__1, i__2; /* Local variables */ - static integer i__, j, k, nd; - static doublereal mfactk, bid; + integer i__, j, k, nd; + doublereal mfactk, bid; /* IMPLICIT INTEGER (I-N) */ @@ -3774,8 +3775,8 @@ int mmexthi_(integer *ndegre, integer i__1; /* Local variables */ - static integer iadd, ideb, ndeg2, nmod2, ii, ibb; - static integer kpt; + integer iadd, ideb, ndeg2, nmod2, ii, ibb; + integer kpt; /* ********************************************************************** */ @@ -3925,8 +3926,8 @@ int mmextrl_(integer *ndegre, integer i__1; /* Local variables */ - static integer iadd, ideb, ndeg2, nmod2, ii, ibb; - static integer kpt; + integer iadd, ideb, ndeg2, nmod2, ii, ibb; + integer kpt; /* ********************************************************************** @@ -4081,7 +4082,7 @@ int AdvApp2Var_MathBase::mmfmca8_(const integer *ndimen, tabres_offset; /* Local variables */ - static integer i__, j, k, ilong; + integer i__, j, k, ilong; @@ -4217,7 +4218,7 @@ L9999: tabres_offset, i__1, i__2, i__3; /* Local variables */ - static integer i__, j, k, ilong; + integer i__, j, k, ilong; @@ -4359,16 +4360,16 @@ int AdvApp2Var_MathBase::mmfmcar_(integer *ndimen, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* System generated locals */ integer patold_dim1, patold_dim2, patnew_dim1, patnew_dim2, i__1, patold_offset,patnew_offset; /* Local variables */ - static doublereal tbaux[1]; - static integer ksize, numax, kk; - static intptr_t iofst; - static integer ibb, ier; + doublereal* tbaux = 0; + integer ksize, numax, kk; + intptr_t iofst; + integer ibb, ier; /* *********************************************************************** */ @@ -4443,6 +4444,7 @@ int AdvApp2Var_MathBase::mmfmcar_(integer *ndimen, } *iercod = 0; iofst = 0; + AdvApp2Var_SysBase anAdvApp2Var_SysBase; /* ********************************************************************** */ @@ -4509,7 +4511,7 @@ L2000: /* ------------------------- Dynamic allocation ------------------- ---- */ ksize = *ndimen * *ncoefu * *ncoefv; - AdvApp2Var_SysBase::mcrrqst_(&c__8, &ksize, tbaux, &iofst, &ier); + anAdvApp2Var_SysBase.mcrrqst_(&c__8, &ksize, tbaux, &iofst, &ier); if (ier > 0) { *iercod = 13; goto L9900; @@ -4567,7 +4569,7 @@ L2000: L9900: if (iofst != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, &ksize, tbaux, &iofst, &ier); + anAdvApp2Var_SysBase.mcrdelt_(&c__8, &ksize, tbaux, &iofst, &ier); } if (ier > 0) { *iercod = 13; @@ -4607,7 +4609,7 @@ int AdvApp2Var_MathBase::mmfmcb5_(integer *isenmsc, i__2; /* Local variables */ - static integer i__, nboct, nd; + integer i__, nboct, nd; /* ********************************************************************** @@ -4747,16 +4749,16 @@ int AdvApp2Var_MathBase::mmfmtb1_(integer *maxsz1, integer *jsize2, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* System generated locals */ integer table1_dim1, table1_offset, table2_dim1, table2_offset, i__1, i__2; /* Local variables */ - static doublereal work[1]; - static integer ilong, isize, ii, jj, ier; - static intptr_t iofst,iipt, jjpt; + doublereal* work = 0; + integer ilong, isize, ii, jj, ier; + intptr_t iofst,iipt, jjpt; /************************************************************************ @@ -4816,6 +4818,7 @@ int AdvApp2Var_MathBase::mmfmtb1_(integer *maxsz1, table2_dim1 = *maxsz2; table2_offset = table2_dim1 + 1; table2 -= table2_offset; + AdvApp2Var_SysBase anAdvApp2Var_SysBase; /* Function Body */ *iercod = 0; @@ -4825,7 +4828,7 @@ int AdvApp2Var_MathBase::mmfmtb1_(integer *maxsz1, iofst = 0; isize = *maxsz2 * *isize1; - AdvApp2Var_SysBase::mcrrqst_(&c__8, &isize, work, &iofst, &ier); + anAdvApp2Var_SysBase.mcrrqst_(&c__8, &isize, work, &iofst, &ier); if (ier > 0) { goto L9200; } @@ -4870,7 +4873,7 @@ L9200: L9999: if (iofst != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, &isize, work, &iofst, &ier); + anAdvApp2Var_SysBase.mcrdelt_(&c__8, &isize, work, &iofst, &ier); } if (ier > 0) { *iercod = 2; @@ -4903,12 +4906,12 @@ int AdvApp2Var_MathBase::mmgaus1_(integer *ndimf, integer i__1, i__2; /* Local variables */ - static integer ndeg; - static doublereal h__[20]; - static integer j; - static doublereal t, u[20], x; - static integer idimf; - static doublereal c1x, c2x; + integer ndeg; + doublereal h__[20]; + integer j; + doublereal t, u[20], x; + integer idimf; + doublereal c1x, c2x; /* ********************************************************************** */ @@ -5082,8 +5085,8 @@ L9999: int mmherm0_(doublereal *debfin, integer *iercod) { - static integer c__576 = 576; - static integer c__6 = 6; + integer c__576 = 576; + integer c__6 = 6; /* System generated locals */ @@ -5091,19 +5094,19 @@ int mmherm0_(doublereal *debfin, doublereal d__1; /* Local variables */ - static doublereal amat[36] /* was [6][6] */; - static integer iord[2]; - static doublereal prod; - static integer iord1, iord2; - static doublereal miden[36] /* was [6][6] */; - static integer ncmat; - static doublereal epspi, d1, d2; - static integer ii, jj, pp, ncf; - static doublereal cof[6]; - static integer iof[2], ier; - static doublereal mat[36] /* was [6][6] */; - static integer cot; - static doublereal abid[72] /* was [12][6] */; + doublereal amat[36] /* was [6][6] */; + integer iord[2]; + doublereal prod; + integer iord1, iord2; + doublereal miden[36] /* was [6][6] */; + integer ncmat; + doublereal epspi, d1, d2; + integer ii, jj, pp, ncf; + doublereal cof[6]; + integer iof[2], ier; + doublereal mat[36] /* was [6][6] */; + integer cot; + doublereal abid[72] /* was [12][6] */; /* *********************************************************************** */ @@ -5427,9 +5430,9 @@ int mmherm1_(doublereal *debfin, integer hermit_dim1, hermit_dim2, hermit_offset; /* Local variables */ - static integer nbval; - static doublereal d1; - static integer cot; + integer nbval; + doublereal d1; + integer cot; /* *********************************************************************** */ @@ -5643,25 +5646,25 @@ int AdvApp2Var_MathBase::mmhjcan_(integer *ndimen, integer *iercod) { - static integer c__2 = 2; - static integer c__21 = 21; + integer c__2 = 2; + integer c__21 = 21; /* System generated locals */ integer tcbold_dim1, tcbold_dim2, tcbold_offset, tcbnew_dim1, tcbnew_dim2, tcbnew_offset, i__1, i__2, i__3, i__4, i__5; /* Local variables */ - static logical ldbg; - static integer ndeg; - static doublereal taux1[21]; - static integer d__, e, i__, k; - static doublereal mfact; - static integer ncoeff; - static doublereal tjacap[21]; - static integer iordre[2]; - static doublereal hermit[36]/* was [6][3][2] */, ctenor, bornes[2]; - static integer ier; - static integer aux1, aux2; + logical ldbg; + integer ndeg; + doublereal taux1[21]; + integer d__, e, i__, k; + doublereal mfact; + integer ncoeff; + doublereal tjacap[21]; + integer iordre[2]; + doublereal hermit[36]/* was [6][3][2] */, ctenor, bornes[2]; + integer ier; + integer aux1, aux2; /* *********************************************************************** */ @@ -5889,10 +5892,10 @@ L9999: integer tabtri_dim1, tabtri_offset, i__1, i__2; /* Local variables */ - static logical idbg; - static integer icol, ilgn, nlgn, noct, inser; - static doublereal epsega; - static integer ibb; + logical idbg; + integer icol, ilgn, nlgn, noct, inser; + doublereal epsega = 0.; + integer ibb; /* *********************************************************************** */ @@ -6090,8 +6093,8 @@ L9999: integer poljac_dim1, i__1, i__2; /* Local variables */ - static integer iptt, i__, j, ibb; - static doublereal bid; + integer iptt, i__, j, ibb; + doublereal bid; /* *********************************************************************** */ @@ -6241,7 +6244,7 @@ L9999: polaux_dim1, i__1, i__2; /* Local variables */ - static integer ndeg, i__, nd, ii, ibb; + integer ndeg, i__, nd, ii, ibb; /* *********************************************************************** */ @@ -6345,18 +6348,18 @@ int mmloncv_(integer *ndimax, { /* Initialized data */ - static integer kgar = 0; + integer kgar = 0; /* System generated locals */ integer courbe_dim1, courbe_offset, i__1, i__2; /* Local variables */ - static doublereal tran; - static integer ngaus; - static doublereal c1, c2, d1, d2, wgaus[20], uroot[20], x1, x2, dd; - static integer ii, jj, kk; - static doublereal som; - static doublereal der1, der2; + doublereal tran; + integer ngaus; + doublereal c1, c2, d1, d2, wgaus[20], uroot[20], x1, x2, dd; + integer ii, jj, kk; + doublereal som; + doublereal der1, der2; @@ -6578,27 +6581,27 @@ L9900: integer *iercod) { - static integer c__2 = 2; - static integer c__1 = 1; + integer c__2 = 2; + integer c__1 = 1; /* Initialized data */ - static doublereal moin11[2] = { -1.,1. }; + doublereal moin11[2] = { -1.,1. }; /* System generated locals */ integer valbas_dim1, i__1; /* Local variables */ - static doublereal vjac[80], herm[24]; - static integer iord[2]; - static doublereal wval[4]; - static integer nwcof, iunit; - static doublereal wpoly[7]; - static integer ii, jj, iorjac; - static doublereal hermit[36] /* was [6][3][2] */; - static integer kk1, kk2, kk3; - static integer khe, ier; + doublereal vjac[80], herm[24]; + integer iord[2]; + doublereal wval[4]; + integer nwcof, iunit; + doublereal wpoly[7]; + integer ii, jj, iorjac; + doublereal hermit[36] /* was [6][3][2] */; + integer kk1, kk2, kk3; + integer khe, ier; /* *********************************************************************** @@ -6887,8 +6890,8 @@ L9999: integer courbe_dim1, courbe_offset, i__1, i__2; /* Local variables */ - static integer ncof2; - static integer isize, nd, kcf, ncf; + integer ncof2; + integer isize, nd, kcf, ncf; /* *********************************************************************** @@ -7016,8 +7019,8 @@ L9999: integer courbe_dim1, courbe_offset, i__1; /* Local variables */ - static integer i__, nd; - static doublereal fu; + integer i__, nd; + doublereal fu; /* *********************************************************************** @@ -7096,19 +7099,19 @@ int mmpojac_(doublereal *tparam, integer *iercod) { - static integer c__2 = 2; + integer c__2 = 2; /* Initialized data */ - static integer nbcof = -1; + integer nbcof = -1; /* System generated locals */ integer valjac_dim1, i__1, i__2; /* Local variables */ - static doublereal cofa, cofb, denom, tnorm[100]; - static integer ii, jj, kk1, kk2; - static doublereal aux1, aux2; + doublereal cofa, cofb, denom, tnorm[100]; + integer ii, jj, kk1, kk2; + doublereal aux1, aux2; /* *********************************************************************** @@ -7330,9 +7333,9 @@ L9999: integer i__1, i__2; /* Local variables */ - static logical ldbg; - static integer imin, jmin, i__, j, k; - static logical trouve; + logical ldbg; + integer imin, jmin, i__, j, k; + logical trouve; /* *********************************************************************** */ @@ -7491,23 +7494,23 @@ L9999: integer *iercod) { - static integer c__100 = 100; + integer c__100 = 100; /* System generated locals */ integer i__1, i__2; /* Local variables */ - static logical ldbg; - static doublereal mcho[100]; - static integer jmin, jmax, i__, j, k, l; - static intptr_t iofv1, iofv2, iofv3, iofv4; - static doublereal v1[100], v2[100], v3[100], v4[100]; - static integer deblig, dimhch; - static doublereal hchole[100]; - static intptr_t iofmch, iofmam, iofhch; - static doublereal matsym[100]; - static integer ier; - static integer aux; + logical ldbg; + doublereal* mcho = 0; + integer jmin, jmax, i__, j, k, l; + intptr_t iofv1, iofv2, iofv3, iofv4; + doublereal *v1 = 0, *v2 = 0, *v3 = 0, *v4 = 0; + integer deblig, dimhch; + doublereal* hchole = 0; + intptr_t iofmch, iofmam, iofhch; + doublereal* matsym = 0; + integer ier; + integer aux; @@ -7622,13 +7625,13 @@ L9999: */ /* Dynamic allocation */ - - AdvApp2Var_SysBase::macrar8_(hdimen, &c__100, v1, &iofv1, &ier); + AdvApp2Var_SysBase anAdvApp2Var_SysBase; + anAdvApp2Var_SysBase.macrar8_(hdimen, &c__100, v1, &iofv1, &ier); if (ier > 0) { goto L9102; } dimhch = hposit[(*hdimen << 1) + 2]; - AdvApp2Var_SysBase::macrar8_(&dimhch, &c__100, hchole, &iofhch, &ier); + anAdvApp2Var_SysBase.macrar8_(&dimhch, &c__100, hchole, &iofhch, &ier); if (ier > 0) { goto L9102; } @@ -7656,19 +7659,19 @@ L9999: /* where G=MATSYG */ /* c=VECSYG */ - AdvApp2Var_SysBase::macrar8_(gdimen, &c__100, v2, &iofv2, &ier); + anAdvApp2Var_SysBase.macrar8_(gdimen, &c__100, v2, &iofv2, &ier); if (ier > 0) { goto L9102; } - AdvApp2Var_SysBase::macrar8_(hdimen, &c__100, v3, &iofv3, &ier); + anAdvApp2Var_SysBase.macrar8_(hdimen, &c__100, v3, &iofv3, &ier); if (ier > 0) { goto L9102; } - AdvApp2Var_SysBase::macrar8_(gdimen, &c__100, v4, &iofv4, &ier); + anAdvApp2Var_SysBase.macrar8_(gdimen, &c__100, v4, &iofv4, &ier); if (ier > 0) { goto L9102; } - AdvApp2Var_SysBase::macrar8_(mnstoc, &c__100, matsym, &iofmam, &ier); + anAdvApp2Var_SysBase.macrar8_(mnstoc, &c__100, matsym, &iofmam, &ier); if (ier > 0) { goto L9102; } @@ -7734,7 +7737,7 @@ L9999: AdvApp2Var_SysBase::mvriraz_(gdimen, &v4[iofv4]); - AdvApp2Var_SysBase::macrar8_(mnstoc, &c__100, mcho, &iofmch, &ier); + anAdvApp2Var_SysBase.macrar8_(mnstoc, &c__100, mcho, &iofmch, &ier); if (ier > 0) { goto L9102; } @@ -7806,31 +7809,31 @@ L9102: L9999: /* ___ DESALLOCATION, ... */ - AdvApp2Var_SysBase::macrdr8_(hdimen, &c__100, v1, &iofv1, &ier); + anAdvApp2Var_SysBase.macrdr8_(hdimen, &c__100, v1, &iofv1, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } - AdvApp2Var_SysBase::macrdr8_(&dimhch, &c__100, hchole, &iofhch, &ier); + anAdvApp2Var_SysBase.macrdr8_(&dimhch, &c__100, hchole, &iofhch, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } - AdvApp2Var_SysBase::macrdr8_(gdimen, &c__100, v2, &iofv2, &ier); + anAdvApp2Var_SysBase.macrdr8_(gdimen, &c__100, v2, &iofv2, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } - AdvApp2Var_SysBase::macrdr8_(hdimen, &c__100, v3, &iofv3, &ier); + anAdvApp2Var_SysBase.macrdr8_(hdimen, &c__100, v3, &iofv3, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } - AdvApp2Var_SysBase::macrdr8_(gdimen, &c__100, v4, &iofv4, &ier); + anAdvApp2Var_SysBase.macrdr8_(gdimen, &c__100, v4, &iofv4, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } - AdvApp2Var_SysBase::macrdr8_(mnstoc, &c__100, matsym, &iofmam, &ier); + anAdvApp2Var_SysBase.macrdr8_(mnstoc, &c__100, matsym, &iofmam, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } - AdvApp2Var_SysBase::macrdr8_(mnstoc, &c__100, mcho, &iofmch, &ier); + anAdvApp2Var_SysBase.macrdr8_(mnstoc, &c__100, mcho, &iofmch, &ier); if (*iercod == 0 && ier > 0) { *iercod = 3; } @@ -7859,10 +7862,10 @@ int mmrslss_(integer *,//mxcoef, integer i__1, i__2; /* Local variables */ - static logical ldbg; - static integer i__, j; - static doublereal somme; - static integer pointe, ptcour; + logical ldbg; + integer i__, j; + doublereal somme; + integer pointe, ptcour; /* *********************************************************************** */ @@ -8017,10 +8020,10 @@ int mmrslw_(integer *normax, doublereal d__1; /* Local variables */ - static integer kpiv; - static doublereal pivot; - static integer ii, jj, kk; - static doublereal akj; + integer kpiv; + doublereal pivot; + integer ii, jj, kk; + doublereal akj; /* ********************************************************************** @@ -8240,8 +8243,8 @@ L9999: xmat_offset, aaux_dim1, aaux_offset, i__1, i__2; /* Local variables */ - static integer i__, j; - static integer ibb; + integer i__, j; + integer ibb; /* IMPLICIT DOUBLE PRECISION (A-H,O-Z) */ /* IMPLICIT INTEGER (I-N) */ @@ -8377,7 +8380,7 @@ L9999: doublereal *rtlegd) { - static integer ideb, nmod2, nsur2, ilong, ibb; + integer ideb, nmod2, nsur2, ilong, ibb; /* ********************************************************************** @@ -8508,7 +8511,7 @@ L9999: doublereal d__1; /* Local variables */ - static integer ideb, ifin, imil, ibb; + integer ideb, ifin, imil, ibb; /* *********************************************************************** */ @@ -8661,10 +8664,10 @@ int mmtmave_(integer *nligne, integer i__1, i__2; /* Local variables */ - static logical ldbg; - static integer imin, imax, i__, j, k; - static doublereal somme; - static integer aux; + logical ldbg; + integer imin, imax, i__, j, k; + doublereal somme; + integer aux; /* *********************************************************************** @@ -8812,9 +8815,9 @@ int mmtrpj0_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer ncut, i__; - static doublereal bidon, error; - static integer nd; + integer ncut, i__; + doublereal bidon, error; + integer nd; /* *********************************************************************** @@ -8992,10 +8995,10 @@ int mmtrpj2_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer ncut, i__; - static doublereal bidon, error; - static integer ia, nd; - static doublereal bid, eps1; + integer ncut, i__; + doublereal bidon, error; + integer ia, nd; + doublereal bid, eps1; /* *********************************************************************** @@ -9196,10 +9199,10 @@ int mmtrpj4_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer ncut, i__; - static doublereal bidon, error; - static integer ia, nd; - static doublereal bid, eps1; + integer ncut, i__; + doublereal bidon, error; + integer ia, nd; + doublereal bid, eps1; @@ -9400,10 +9403,10 @@ int mmtrpj6_(integer *ncofmx, doublereal d__1; /* Local variables */ - static integer ncut, i__; - static doublereal bidon, error; - static integer ia, nd; - static doublereal bid, eps1; + integer ncut, i__; + doublereal bidon, error; + integer ia, nd; + doublereal bid, eps1; @@ -9546,7 +9549,7 @@ L9999: integer crvlgd_dim1, crvlgd_offset; /* Local variables */ - static integer ia; + integer ia; /* *********************************************************************** @@ -9628,18 +9631,18 @@ L9999: integer *iercod) { - static doublereal c_b2 = 10.; + doublereal c_b2 = 10.; /* System generated locals */ integer i__1; doublereal d__1; /* Local variables */ - static integer nchif, iunit, izero; - static doublereal vnorm; - static integer ii; - static doublereal bid; - static doublereal eps0; + integer nchif, iunit, izero; + doublereal vnorm; + integer ii; + doublereal bid; + doublereal eps0; @@ -9771,7 +9774,7 @@ L9999: static char nomprg[8+1] = "MMEPS1 "; - static integer ibb; + integer ibb; @@ -9879,13 +9882,13 @@ L9999: integer i__1; /* Local variables */ - static logical ldbg; - static integer d__; - static doublereal vaux1[3], vaux2[3]; - static logical colin; - static doublereal valaux; - static integer aux; - static logical nul; + logical ldbg; + integer d__; + doublereal vaux1[3], vaux2[3]; + logical colin; + doublereal valaux; + integer aux; + logical nul; /* *********************************************************************** */ @@ -10290,8 +10293,8 @@ integer pow__ii(integer *x, doublereal ret_val; /* Local variables */ - static integer i__; - static doublereal x; + integer i__; + doublereal x; @@ -10364,9 +10367,9 @@ int mvcvin2_(integer *ncoeff, integer i__1, i__2; /* Local variables */ - static integer m1jm1, ncfm1, j, k; - static doublereal bid; - static doublereal cij1, cij2; + integer m1jm1, ncfm1, j, k; + doublereal bid; + doublereal cij1, cij2; @@ -10514,10 +10517,10 @@ int mvcvinv_(integer *ncoeff, integer i__1, i__2; /* Local variables */ - static integer m1jm1, ncfm1, j, k; - static doublereal bid; + integer m1jm1, ncfm1, j, k; + doublereal bid; //extern /* Subroutine */ int maermsg_(); - static doublereal cij1, cij2, cij3; + doublereal cij1, cij2, cij3; /* ********************************************************************** @@ -10669,8 +10672,8 @@ int mvgaus0_(integer *kindic, integer i__1; /* Local variables */ - static doublereal tamp[40]; - static integer ndegl, kg, ii; + doublereal tamp[40]; + integer ndegl, kg, ii; /* ********************************************************************** */ @@ -10797,8 +10800,8 @@ int mvpscr2_(integer *ncoeff, integer i__1; /* Local variables */ - static integer ndeg, kk; - static doublereal xxx, yyy; + integer ndeg, kk; + doublereal xxx, yyy; @@ -10925,8 +10928,8 @@ int mvpscr3_(integer *ncoeff, integer i__1; /* Local variables */ - static integer ndeg, kk; - static doublereal xxx, yyy, zzz; + integer ndeg, kk; + doublereal xxx, yyy, zzz; @@ -11064,9 +11067,9 @@ L9999: integer dtab_dim1, dtab_offset, i__1, i__2; /* Local variables */ - static integer incr; - static doublereal dsave; - static integer i3, i4, i5, incrp1; + integer incr; + doublereal dsave; + integer i3, i4, i5, incrp1; /************************************************************************ @@ -11195,8 +11198,8 @@ L9900: doublereal ret_val, d__1, d__2; /* Local variables */ - static doublereal xsom; - static integer i__, irmax; + doublereal xsom; + integer i__, irmax; diff --git a/src/AdvApp2Var/AdvApp2Var_SysBase.cxx b/src/AdvApp2Var/AdvApp2Var_SysBase.cxx index 7c2f5260f5..4fbec48f89 100755 --- a/src/AdvApp2Var/AdvApp2Var_SysBase.cxx +++ b/src/AdvApp2Var/AdvApp2Var_SysBase.cxx @@ -16,6 +16,7 @@ // and conditions governing the rights and limitations under the License. // AdvApp2Var_SysBase.cxx +#include #include #include #include @@ -34,9 +35,6 @@ int __s__cmp(); static int macrbrk_(); -static -int macrchk_(); - static int macrclw_(intptr_t *iadfld, intptr_t *iadflf, @@ -121,24 +119,11 @@ int mcrgetv_(integer *sz, void* *iad, integer *ier); -static -int mcrlist_(integer *ier); - static int mcrlocv_(void* t, intptr_t *l); -/* Structures */ -static struct { - intptr_t icore[12000]; - integer ncore, lprot; -} mcrgene_; - -static struct { - integer nrqst[2], ndelt[2], nbyte[2], mbyte[2]; -} mcrstac_; - static struct { integer lec, imp, keyb, mae, jscrn, itblt, ibb; } mblank__; @@ -146,6 +131,25 @@ static struct { #define mcrfill_ABS(a) (((a)<0)?(-(a)):(a)) +//======================================================================= +//function : AdvApp2Var_SysBase +//purpose : +//======================================================================= +AdvApp2Var_SysBase::AdvApp2Var_SysBase() +{ + mainial_(); + memset (&mcrstac_, 0, sizeof (mcrstac_)); +} + +//======================================================================= +//function : ~AdvApp2Var_SysBase +//purpose : +//======================================================================= +AdvApp2Var_SysBase::~AdvApp2Var_SysBase() +{ + assert (mcrgene_.ncore == 0); //otherwise memory leaking +} + //======================================================================= //function : macinit_ //purpose : @@ -156,7 +160,7 @@ int AdvApp2Var_SysBase::macinit_(integer *imode, { /* Fortran I/O blocks */ - static cilist io______1 = { 0, 0, 0, (char*) "(' --- Debug-mode : ',I10,' ---')", 0 }; + cilist io______1 = { 0, 0, 0, (char*) "(' --- Debug-mode : ',I10,' ---')", 0 }; /* ************************************************************************/ /* FUNCTION : */ @@ -292,14 +296,12 @@ int AdvApp2Var_SysBase::macrai4_(integer *nbelem, */ integer iunit; - /* Parameter adjustments */ - --itablo; iunit = sizeof(integer); /* Function Body */ if (*nbelem > *maxelm) { - AdvApp2Var_SysBase::mcrrqst_(&iunit, nbelem, &itablo[1], iofset, iercod); + /*AdvApp2Var_SysBase::*/mcrrqst_(&iunit, nbelem, itablo, iofset, iercod); } else { *iercod = 0; *iofset = 0; @@ -318,7 +320,7 @@ int AdvApp2Var_SysBase::macrar8_(integer *nbelem, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* *********************************************************************** */ @@ -366,12 +368,9 @@ int AdvApp2Var_SysBase::macrar8_(integer *nbelem, */ - /* Parameter adjustments */ - --xtablo; - /* Function Body */ if (*nbelem > *maxelm) { - AdvApp2Var_SysBase::mcrrqst_(&c__8, nbelem, &xtablo[1], iofset, iercod); + /*AdvApp2Var_SysBase::*/mcrrqst_(&c__8, nbelem, xtablo, iofset, iercod); } else { *iercod = 0; *iofset = 0; @@ -392,16 +391,16 @@ int macrbrk_() //function : macrchk_ //purpose : //======================================================================= -int macrchk_() +int AdvApp2Var_SysBase::macrchk_() { /* System generated locals */ integer i__1; /* Local variables */ - static integer i__, j; - static intptr_t ioff; - static doublereal t[1]; - static intptr_t loc; + integer i__, j; + intptr_t ioff; + doublereal* t = 0; + intptr_t loc; /* *********************************************************************** */ @@ -489,27 +488,28 @@ int macrchk_() mcrlocv_(t, &loc); /* CONTROL OF FLAGS IN THE TABLE */ i__1 = mcrgene_.ncore; - for (i__ = 1; i__ <= i__1; ++i__) { - - for (j = 10; j <= 11; ++j) { - - if (mcrgene_.icore[j + i__ * 12 - 13] != -1) { + for (i__ = 0; i__ < i__1; ++i__) { + + //p to access startaddr and endaddr + intptr_t* p = &mcrgene_.icore[i__].startaddr; + for (j = 0; j <= 1; ++j) { + intptr_t* pp = p + j; + if (*pp != -1) { - ioff = (mcrgene_.icore[j + i__ * 12 - 13] - loc) / 8; + ioff = (*pp - loc) / 8; if (t[ioff] != -134744073.) { /* MSG : '*** ERREUR : REMOVAL FROM MEMORY OF ADDRESS E:',ICORE(J,I) */ /* AND OF RANK ICORE(12,I) */ - macrerr_(&mcrgene_.icore[j + i__ * 12 - 13], - &mcrgene_.icore[i__ * 12 - 1]); + macrerr_(pp, p + 2); /* BACK-PARCING IN PHASE OF PRODUCTION */ maostrb_(); /* REMOVAL OF THE ADDRESS OF FLAG TO AVOID REMAKING ITS CONTROL */ - mcrgene_.icore[j + i__ * 12 - 13] = -1; + *pp = -1; } @@ -587,14 +587,12 @@ int AdvApp2Var_SysBase::macrdi4_(integer *nbelem, */ integer iunit; - /* Parameter adjustments */ - --itablo; iunit = sizeof(integer); /* Function Body */ if (*iofset != 0) { AdvApp2Var_SysBase::mcrdelt_(&iunit, nbelem, - &itablo[1], + itablo, iofset, iercod); } else { @@ -614,7 +612,7 @@ int AdvApp2Var_SysBase::macrdr8_(integer *nbelem, integer *iercod) { - static integer c__8 = 8; + integer c__8 = 8; /* *********************************************************************** */ @@ -657,13 +655,9 @@ int AdvApp2Var_SysBase::macrdr8_(integer *nbelem, /* *********************************************************************** */ - - /* Parameter adjustments */ - --xtablo; - /* Function Body */ if (*iofset != 0) { - AdvApp2Var_SysBase::mcrdelt_(&c__8, nbelem, &xtablo[1], iofset, iercod); + AdvApp2Var_SysBase::mcrdelt_(&c__8, nbelem, xtablo, iofset, iercod); } else { *iercod = 0; } @@ -678,12 +672,12 @@ int macrerr_(intptr_t *,//iad, intptr_t *)//nalloc) { - //static integer c__1 = 1; + //integer c__1 = 1; /* Builtin functions */ //integer /*s__wsfe(),*/ /*do__fio(),*/ e__wsfe(); /* Fortran I/O blocks */ - //static cilist io___1 = { 0, 6, 0, "(X,A,I9,A,I3)", 0 }; + //cilist io___1 = { 0, 6, 0, "(X,A,I9,A,I3)", 0 }; /* *********************************************************************** */ @@ -743,13 +737,18 @@ int macrgfl_(intptr_t *iadfld, { /* Initialized data */ - static integer ifois = 0; + /* original code used static integer ifois=0 which served as static + initialization flag and was only used to call matrsym_() once; now + this flag is not used as matrsym_() always returns 0 and has no + useful contents + */ + integer ifois = 1; - static char cbid[1]; - static integer ibid, ienr; - static doublereal t[1]; - static integer novfl; - static intptr_t ioff,iadrfl, iadt; + char cbid[1]; + integer ibid, ienr; + doublereal* t = 0; + integer novfl; + intptr_t ioff,iadrfl, iadt; /* *********************************************************************** @@ -889,13 +888,13 @@ int macrmsg_(const char *,//crout, { /* Local variables */ - static integer inum, iunite; - static char cfm[80], cln[3]; + integer inum, iunite; + char cfm[80], cln[3]; /* Fortran I/O blocks */ - static cilist io___5 = { 0, 0, 0, cfm, 0 }; - static cilist io___6 = { 0, 0, 0, cfm, 0 }; - static cilist io___7 = { 0, 0, 0, cfm, 0 }; + cilist io___5 = { 0, 0, 0, cfm, 0 }; + cilist io___6 = { 0, 0, 0, cfm, 0 }; + cilist io___7 = { 0, 0, 0, cfm, 0 }; /* *********************************************************************** @@ -1211,8 +1210,8 @@ int magtlog_(const char *cnmlog, { /* Local variables */ - static char cbid[255]; - static integer ibid, ier; + char cbid[255]; + integer ibid, ier; /* ********************************************************************** @@ -1342,6 +1341,7 @@ int magtlog_(const char *cnmlog, int AdvApp2Var_SysBase::mainial_() { mcrgene_.ncore = 0; + mcrgene_.lprot = 0; return 0 ; } /* mainial_ */ @@ -1354,11 +1354,11 @@ int AdvApp2Var_SysBase::maitbr8_(integer *itaill, doublereal *xval) { - static integer c__504 = 504; + integer c__504 = 504; /* Initialized data */ - static doublereal buff0[63] = { + doublereal buff0[63] = { 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., @@ -1369,9 +1369,9 @@ int AdvApp2Var_SysBase::maitbr8_(integer *itaill, integer i__1; /* Local variables */ - static integer i__; - static doublereal buffx[63]; - static integer nbfois, noffst, nreste, nufois; + integer i__; + doublereal buffx[63]; + integer nbfois, noffst, nreste, nufois; /* *********************************************************************** */ @@ -1611,7 +1611,7 @@ int maostrb_() //======================================================================= int maostrd_() { - static integer imod; + integer imod; /* *********************************************************************** */ @@ -1671,15 +1671,15 @@ int maoverf_(integer *nbentr, { /* Initialized data */ - static integer ifois = 0; + integer ifois = 0; /* System generated locals */ integer i__1; /* Local variables */ - static integer ibid; - static doublereal buff[63]; - static integer ioct, indic, nrest, icompt; + integer ibid; + doublereal buff[63]; + integer ioct, indic, nrest, icompt; /* *********************************************************************** */ @@ -1910,7 +1910,7 @@ int matrsym_(const char *cnmsym, { /* Local variables */ - static char chainx[255]; + char chainx[255]; /* *********************************************************************** */ @@ -1999,17 +1999,17 @@ int mcrcomm_(integer *kop, { /* Initialized data */ - static integer ntab = 0; + integer ntab = 0; /* System generated locals */ integer i__1, i__2; /* Local variables */ - static intptr_t ideb; - static doublereal dtab[32000]; - static intptr_t itab[160] /* was [4][40] */; - static intptr_t ipre; - static integer i__, j, k; + intptr_t ideb; + doublereal dtab[32000]; + intptr_t itab[160] /* was [4][40] */; + intptr_t ipre; + integer i__, j, k; /************************************************************************ @@ -2177,12 +2177,12 @@ int AdvApp2Var_SysBase::mcrdelt_(integer *iunit, integer *iercod) { - static integer ibid; - static doublereal xbid; - static integer noct, iver, ksys, i__, n, nrang, + integer ibid; + doublereal xbid; + integer noct, iver, ksys, i__, n, nrang, ibyte, ier; - static intptr_t iadfd, iadff, iaddr, loc; /* Les adrresses en long*/ - static integer kop; + intptr_t iadfd, iadff, iaddr, loc; /* Les adrresses en long*/ + integer kop; /* *********************************************************************** */ @@ -2310,13 +2310,13 @@ int AdvApp2Var_SysBase::mcrdelt_(integer *iunit, /* SEARCH IN MCRGENE */ - n = 0; + n = -1; mcrlocv_(t, &loc); - for (i__ = mcrgene_.ncore; i__ >= 1; --i__) { - if (*iunit == mcrgene_.icore[i__ * 12 - 11] && *isize == - mcrgene_.icore[i__ * 12 - 10] && loc == mcrgene_.icore[i__ * - 12 - 9] && *iofset == mcrgene_.icore[i__ * 12 - 8]) { + for (i__ = mcrgene_.ncore - 1; i__ >= 0; --i__) { + if (*iunit == mcrgene_.icore[i__].unit && *isize == + mcrgene_.icore[i__].reqsize && loc == mcrgene_.icore[i__].loc + && *iofset == mcrgene_.icore[i__].offset) { n = i__; goto L1100; } @@ -2326,18 +2326,18 @@ L1100: /* IF THE ALLOCATION DOES NOT EXIST, LEAVE */ - if (n <= 0) { + if (n < 0) { goto L9003; } /* ALLOCATION RECOGNIZED : RETURN OTHER INFOS */ - ksys = static_cast (mcrgene_.icore[n * 12 - 7]); - ibyte = static_cast (mcrgene_.icore[n * 12 - 6]); - iaddr = mcrgene_.icore[n * 12 - 5]; - iadfd = mcrgene_.icore[n * 12 - 3]; - iadff = mcrgene_.icore[n * 12 - 2]; - nrang = static_cast (mcrgene_.icore[n * 12 - 1]); + ksys = mcrgene_.icore[n].alloctype; + ibyte = mcrgene_.icore[n].size; + iaddr = mcrgene_.icore[n].addr; + iadfd = mcrgene_.icore[n].startaddr; + iadff = mcrgene_.icore[n].endaddr; + nrang = mcrgene_.icore[n].rank; /* Control of flags */ @@ -2346,7 +2346,7 @@ L1100: macrchk_(); } - if (ksys <= 1) { + if (ksys == static_allocation) { /* DE-ALLOCATION ON COMMON */ kop = 2; mcrcomm_(&kop, &ibyte, &iaddr, &ier); @@ -2366,22 +2366,16 @@ L1100: macrclw_(&iadfd, &iadff, &nrang); /* UPDATE OF STATISTICS */ - if (ksys <= 1) { - i__ = 1; - } else { - i__ = 2; - } - ++mcrstac_.ndelt[i__ - 1]; - mcrstac_.nbyte[i__ - 1] -= static_cast (mcrgene_.icore[n * 12 - 11] * - mcrgene_.icore[n * 12 - 10]); + ++mcrstac_.ndelt[ksys]; + mcrstac_.nbyte[ksys] -= mcrgene_.icore[n].unit * + mcrgene_.icore[n].reqsize; /* REMOVAL OF PARAMETERS IN MCRGENE */ - if (n < 1000) { -/* noct = (mcrgene_1.ncore - n) * 48; */ - noct = (mcrgene_.ncore - n) * 12 * sizeof(mcrgene_.icore[0]); + if (n < MAX_ALLOC_NB - 1) { + noct = (mcrgene_.ncore - (n + 1)) * sizeof(mcrgene_.icore[0]); AdvApp2Var_SysBase::mcrfill_(&noct, - &mcrgene_.icore[(n + 1) * 12 - 12], - &mcrgene_.icore[n * 12 - 12]); + &mcrgene_.icore[n + 1], + &mcrgene_.icore[n]); } --mcrgene_.ncore; @@ -2579,7 +2573,7 @@ int mcrgetv_(integer *sz, //function : mcrlist_ //purpose : //======================================================================= -int mcrlist_(integer *ier) +int AdvApp2Var_SysBase::mcrlist_(integer *ier) const { /* System generated locals */ @@ -2588,10 +2582,10 @@ int mcrlist_(integer *ier) /* Builtin functions */ /* Local variables */ - static char cfmt[1]; - static doublereal dfmt; - static integer ifmt, i__, nufmt, ntotal; - static char subrou[7]; + char cfmt[1]; + doublereal dfmt; + integer ifmt, i__, nufmt, ntotal; + char subrou[7]; /************************************************************************ @@ -2703,9 +2697,9 @@ int mcrlist_(integer *ier) ntotal = 0; i__1 = mcrgene_.ncore; - for (i__ = 1; i__ <= i__1; ++i__) { + for (i__ = 0; i__ < i__1; ++i__) { nufmt = 2; - ifmt = static_cast (mcrgene_.icore[i__ * 12 - 11] * mcrgene_.icore[i__ * 12 - 10]) + ifmt = mcrgene_.icore[i__].unit * mcrgene_.icore[i__].reqsize ; macrmsg_(subrou, &nufmt, &ifmt, &dfmt, cfmt, 7L, 1L); ntotal += ifmt; @@ -2747,12 +2741,12 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit, integer i__1, i__2; /* Local variables */ - static doublereal dfmt; - static integer ifmt, iver; - static char subr[7]; - static integer ksys , ibyte, irest, isyst, ier; - static intptr_t iadfd, iadff, iaddr,lofset, loc; - static integer izu; + doublereal dfmt; + integer ifmt, iver; + char subr[7]; + integer ksys , ibyte, irest, isyst, ier; + intptr_t iadfd, iadff, iaddr,lofset, loc; + integer izu; /* ********************************************************************** @@ -2904,7 +2898,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit, /* Function Body */ *iercod = 0; - if (mcrgene_.ncore >= 1000) { + if (mcrgene_.ncore >= MAX_ALLOC_NB) { goto L9001; } if (*iunit != 1 && *iunit != 2 && *iunit != 4 && *iunit != 8) { @@ -2972,7 +2966,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit, /* ENDIF */ /* ELSE */ /* ALLOCATION SYSTEME */ - ksys = 2; + ksys = heap_allocation; mcrgetv_(&ibyte, reinterpret_cast (&iaddr), &ier); if (ier != 0) { goto L9003; @@ -3004,19 +2998,19 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit, /* RANGING OF PARAMETERS IN MCRGENE */ + mcrgene_.icore[mcrgene_.ncore].prot = mcrgene_.lprot; + mcrgene_.icore[mcrgene_.ncore].unit = *iunit; + mcrgene_.icore[mcrgene_.ncore].reqsize = *isize; + mcrgene_.icore[mcrgene_.ncore].loc = loc; + mcrgene_.icore[mcrgene_.ncore].offset = *iofset; + mcrgene_.icore[mcrgene_.ncore].alloctype = ksys; + mcrgene_.icore[mcrgene_.ncore].size = ibyte; + mcrgene_.icore[mcrgene_.ncore].addr = iaddr; + mcrgene_.icore[mcrgene_.ncore].userzone = mcrgene_.ncore; + mcrgene_.icore[mcrgene_.ncore].startaddr = iadfd; + mcrgene_.icore[mcrgene_.ncore].endaddr = iadff; + mcrgene_.icore[mcrgene_.ncore].rank = mcrgene_.ncore + 1; ++mcrgene_.ncore; - mcrgene_.icore[mcrgene_.ncore * 12 - 12] = mcrgene_.lprot; - mcrgene_.icore[mcrgene_.ncore * 12 - 11] = *iunit; - mcrgene_.icore[mcrgene_.ncore * 12 - 10] = *isize; - mcrgene_.icore[mcrgene_.ncore * 12 - 9] = loc; - mcrgene_.icore[mcrgene_.ncore * 12 - 8] = *iofset; - mcrgene_.icore[mcrgene_.ncore * 12 - 7] = ksys; - mcrgene_.icore[mcrgene_.ncore * 12 - 6] = ibyte; - mcrgene_.icore[mcrgene_.ncore * 12 - 5] = iaddr; - mcrgene_.icore[mcrgene_.ncore * 12 - 4] = mcrgene_.ncore; - mcrgene_.icore[mcrgene_.ncore * 12 - 3] = iadfd; - mcrgene_.icore[mcrgene_.ncore * 12 - 2] = iadff; - mcrgene_.icore[mcrgene_.ncore * 12 - 1] = mcrgene_.ncore; mcrgene_.lprot = 0; @@ -3026,12 +3020,12 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit, /* STATISTICS */ - ++mcrstac_.nrqst[ksys - 1]; - mcrstac_.nbyte[ksys - 1] += static_cast (mcrgene_.icore[mcrgene_.ncore * 12 - 11] * - mcrgene_.icore[mcrgene_.ncore * 12 - 10]); + ++mcrstac_.nrqst[ksys]; + mcrstac_.nbyte[ksys] += mcrgene_.icore[mcrgene_.ncore - 1].unit * + mcrgene_.icore[mcrgene_.ncore - 1].reqsize; /* Computing MAX */ - i__1 = mcrstac_.mbyte[ksys - 1], i__2 = mcrstac_.nbyte[ksys - 1]; - mcrstac_.mbyte[ksys - 1] = advapp_max(i__1,i__2); + i__1 = mcrstac_.mbyte[ksys], i__2 = mcrstac_.nbyte[ksys]; + mcrstac_.mbyte[ksys] = advapp_max(i__1,i__2); goto L9900; @@ -3042,7 +3036,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit, /* MAX NB OF ALLOC REACHED : */ L9001: *iercod = 1; - ifmt = 1000; + ifmt = MAX_ALLOC_NB; //__s__copy(subr, "MCRRQST", 7L, 7L); macrmsg_(subr, iercod, &ifmt, &dfmt, " ", 7L, 1L); maostrd_(); @@ -3175,7 +3169,7 @@ int AdvApp2Var_SysBase::msifill_(integer *nbintg, integer *ivecin, integer *ivecou) { - static integer nocte; + integer nocte; /* *********************************************************************** */ @@ -3230,7 +3224,7 @@ int AdvApp2Var_SysBase::msrfill_(integer *nbreel, doublereal *vecent, doublereal * vecsor) { - static integer nocte; + integer nocte; /* *********************************************************************** @@ -3287,7 +3281,7 @@ int AdvApp2Var_SysBase::mswrdbg_(const char *,//ctexte, { - static cilist io___1 = { 0, 0, 0, 0, 0 }; + cilist io___1 = { 0, 0, 0, 0, 0 }; /* *********************************************************************** diff --git a/src/AdvApp2Var/AdvApp2Var_SysBase.hxx b/src/AdvApp2Var/AdvApp2Var_SysBase.hxx index bc6ecb1519..249a7f9e70 100755 --- a/src/AdvApp2Var/AdvApp2Var_SysBase.hxx +++ b/src/AdvApp2Var/AdvApp2Var_SysBase.hxx @@ -28,14 +28,17 @@ #endif class AdvApp2Var_SysBase { - public: + public: + Standard_EXPORT AdvApp2Var_SysBase(); + Standard_EXPORT ~AdvApp2Var_SysBase(); + // - Standard_EXPORT static int mainial_(); + Standard_EXPORT int mainial_(); Standard_EXPORT static int macinit_(int *, int *); // - Standard_EXPORT static int mcrdelt_(integer *iunit, + Standard_EXPORT int mcrdelt_(integer *iunit, integer *isize, void *t, intptr_t *iofset, @@ -45,7 +48,7 @@ class AdvApp2Var_SysBase { void *tin, void *tout); - Standard_EXPORT static int mcrrqst_(integer *iunit, + Standard_EXPORT int mcrrqst_(integer *iunit, integer *isize, void *t, intptr_t *iofset, @@ -59,23 +62,23 @@ class AdvApp2Var_SysBase { Standard_EXPORT static int e__wsle (); Standard_EXPORT static int s__wsfe (); Standard_EXPORT static int s__wsle (); - Standard_EXPORT static int macrai4_(integer *nbelem, + Standard_EXPORT int macrai4_(integer *nbelem, integer *maxelm, integer *itablo, intptr_t *iofset, integer *iercod); - Standard_EXPORT static int macrar8_(integer *nbelem, + Standard_EXPORT int macrar8_(integer *nbelem, integer *maxelm, doublereal *xtablo, intptr_t *iofset, integer *iercod); - Standard_EXPORT static int macrdi4_(integer *nbelem, + Standard_EXPORT int macrdi4_(integer *nbelem, integer *maxelm, integer *itablo, intptr_t *iofset, integer *iercod); - Standard_EXPORT static int macrdr8_(integer *nbelem, + Standard_EXPORT int macrdr8_(integer *nbelem, integer *maxelm, doublereal *xtablo, intptr_t *iofset, @@ -105,6 +108,64 @@ class AdvApp2Var_SysBase { Standard_EXPORT static void mvriraz_(integer *taille, void*adt); +private: + int macrchk_(); + int mcrlist_(integer *ier) const; + + /* Maximum number of allowed allocation requests. + Currently the maximum known number of requests is 7 - see + AdvApp2Var_MathBase::mmresol_(). So the current value is a safe margin and + a reasonable balance to not provoke stack overflow (especially in + multi-threaded execution). Previous number of 1000 was excessive but + tolerable when used for static memory. + */ + static const int MAX_ALLOC_NB = 32; + + enum { + static_allocation = 0, /* indicates static allocation, currently not used */ + heap_allocation = 1 /* indicates heap allocation */ + }; + + /* Describes an individual memory allocation request. + See format description in the AdvApp2Var_SysBase.cxx. + The field order is preserved and the sizes are chosen to minimize + memory footprint. Fields containing address have the intptr_t type + for easier arithmetic and to avoid casts in the source code. + + No initialization constructor should be provided to avoid wasting + time when allocating a field mcrgene_. + */ + struct mitem { + unsigned char prot; + unsigned char unit; //unit of allocation: 1, 2, 4 or 8 + integer reqsize; + intptr_t loc; + intptr_t offset; + unsigned char alloctype; // static_allocation or heap_allocation + integer size; + intptr_t addr; + integer userzone; //not used + intptr_t startaddr; + intptr_t endaddr; + integer rank; + }; + + struct { + mitem icore[MAX_ALLOC_NB]; + integer ncore; + unsigned char lprot; + } mcrgene_; + + /* Contains statistics on allocation requests. + Index 0 corresponds to static_allocation, 1 - to heap allocation. + nrqst - number of allocation requests; + ndelt - number of deallocation requests; + nbyte - current number of allocated bytes; + mbyte - maximum number of ever allocated bytes. + */ + struct { + integer nrqst[2], ndelt[2], nbyte[2], mbyte[2]; + } mcrstac_; }; #endif diff --git a/src/AdvApp2Var/AdvApp2Var_SysBase_baseinit.cxx b/src/AdvApp2Var/AdvApp2Var_SysBase_baseinit.cxx index 65ae1806a7..19bdc1c314 100755 --- a/src/AdvApp2Var/AdvApp2Var_SysBase_baseinit.cxx +++ b/src/AdvApp2Var/AdvApp2Var_SysBase_baseinit.cxx @@ -25,8 +25,11 @@ static int init_STBAS(void) { int ICODE = 0; + //allocation tables are now local, so no global initialization is required +#if 0 // Init du Tableau des allocs AdvApp2Var_SysBase::mainial_(); +#endif // Init de LEC IBB IMP AdvApp2Var_SysBase::macinit_(&ICODE, &ICODE); // diff --git a/src/ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx b/src/ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx index 777c8a46b6..7da7054013 100755 --- a/src/ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx +++ b/src/ApproxInt/ApproxInt_ImpPrmSvSurfaces.gxx @@ -185,8 +185,11 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1 } - static math_Vector BornInf(1,2),BornSup(1,2),F(1,1),X(1,2),Tolerance(1,2); - static math_Matrix D(1, 1, 1, 2); + Standard_Real aBornInf[2],aBornSup[2],aF[1],aX[2],aTolerance[2]; + math_Vector BornInf(aBornInf,1,2),BornSup(aBornSup,1,2),F(aF,1,1), + X(aX,1,2),Tolerance(aTolerance,1,2); + Standard_Real aD[1][2]; + math_Matrix D(aD,1, 1, 1, 2); Standard_Real binfu,bsupu,binfv,bsupv; binfu = ThePSurfaceTool::FirstUParameter(MyPSurf); diff --git a/src/ApproxInt/ApproxInt_PrmPrmSvSurfaces.gxx b/src/ApproxInt/ApproxInt_PrmPrmSvSurfaces.gxx index 785069b232..d8e22f130c 100755 --- a/src/ApproxInt/ApproxInt_PrmPrmSvSurfaces.gxx +++ b/src/ApproxInt/ApproxInt_PrmPrmSvSurfaces.gxx @@ -105,7 +105,8 @@ Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1 MyIsTangent = Standard_True; - static TColStd_Array1OfReal Param(1,4); + Standard_Real aParam[4];//stack vs heap allocation + TColStd_Array1OfReal Param (aParam[0],1,4); Param(1) = u1; Param(2) = v1; Param(3) = u2; Param(4) = v2; math_FunctionSetRoot Rsnld(MyIntersectionOn2S.Function()); diff --git a/src/IntAna/IntAna_Curve.cxx b/src/IntAna/IntAna_Curve.cxx index d21ff7c84a..d356438de8 100755 --- a/src/IntAna/IntAna_Curve.cxx +++ b/src/IntAna/IntAna_Curve.cxx @@ -378,7 +378,7 @@ InternalUVValue(theta,U,V,A,B,C,cost,sint,SigneSqrtDis); // Pt = Value(theta); - if(Abs(SigneSqrtDis)<0.0000000001 || Abs(A)<0.0000001) return(Standard_False); + if(Abs(A)<0.0000001 || Abs(SigneSqrtDis)<0.0000000001) return(Standard_False); //-- Approximation de la derivee (mieux que le calcul mathematique!) diff --git a/src/IntPatch/IntPatch_HInterTool.cdl b/src/IntPatch/IntPatch_HInterTool.cdl index b1a08de01c..102f512c6f 100755 --- a/src/IntPatch/IntPatch_HInterTool.cdl +++ b/src/IntPatch/IntPatch_HInterTool.cdl @@ -34,6 +34,7 @@ uses is + Create returns HInterTool from IntPatch; -- Pour polyedres @@ -61,12 +62,12 @@ is -- Methodes pour recherche des points interieurs - NbSamplePoints(myclass; S: HSurface from Adaptor3d) + NbSamplePoints(me: in out; S: HSurface from Adaptor3d) returns Integer from Standard; - SamplePoint(myclass; S : HSurface from Adaptor3d; + SamplePoint(me; S: HSurface from Adaptor3d; Index: Integer from Standard; U,V: out Real from Standard); @@ -220,5 +221,8 @@ is returns Boolean from Standard; +fields + + uinf,vinf,usup,vsup: Real from Standard; end HInterTool; diff --git a/src/IntPatch/IntPatch_HInterTool.cxx b/src/IntPatch/IntPatch_HInterTool.cxx index c977b48b53..fbb27d66ff 100755 --- a/src/IntPatch/IntPatch_HInterTool.cxx +++ b/src/IntPatch/IntPatch_HInterTool.cxx @@ -37,8 +37,10 @@ #include #include -static Standard_Real uinf,vinf,usup,vsup; - +IntPatch_HInterTool::IntPatch_HInterTool() : + uinf (0.), vinf (0.), usup (0.), vsup (0.) +{ +} Standard_Integer IntPatch_HInterTool::NbSamplesV (const Handle(Adaptor3d_HSurface)& S, const Standard_Real, const Standard_Real) @@ -136,7 +138,7 @@ Standard_Integer IntPatch_HInterTool::NbSamplePoints (const Handle(Adaptor3d_HSu void IntPatch_HInterTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, - Standard_Real& V ) + Standard_Real& V ) const { Standard_Integer nbIntU = 1+NbSamplesU(S,uinf,usup); nbIntU>>=1; diff --git a/src/IntPatch/IntPatch_ImpPrmIntersection.cxx b/src/IntPatch/IntPatch_ImpPrmIntersection.cxx index a54ebc96d7..99f2c20f99 100755 --- a/src/IntPatch/IntPatch_ImpPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_ImpPrmIntersection.cxx @@ -163,9 +163,10 @@ void ComputeTangency (const IntPatch_TheSOnBounds& solrst, gp_Pnt2d p2d; gp_Vec2d d2d; // - static math_Vector X(1, 2); - static math_Vector F(1, 1); - static math_Matrix D(1, 1, 1, 2); + double aX[2], aF[1], aD[1][2]; + math_Vector X(aX, 1, 2); + math_Vector F(aF, 1, 1); + math_Matrix D(aD, 1, 1, 1, 2); // seqlength = 0; NbPoints = solrst.NbPoints(); diff --git a/src/IntPatch/IntPatch_RstInt.cxx b/src/IntPatch/IntPatch_RstInt.cxx index 89b3557eae..18d1e4c3db 100755 --- a/src/IntPatch/IntPatch_RstInt.cxx +++ b/src/IntPatch/IntPatch_RstInt.cxx @@ -457,7 +457,7 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L, // Si OnFirst = True, c est que la surface Surf correspond a la 1ere // surface donnee aux algo d intersection. - static IntPatch_SearchPnt Commun; + IntPatch_SearchPnt Commun; Standard_Real U,V,W; Standard_Real U1,V1,U2,V2; diff --git a/src/IntStart/IntStart_SearchInside.gxx b/src/IntStart/IntStart_SearchInside.gxx index b576fac318..4add1fdd95 100755 --- a/src/IntStart/IntStart_SearchInside.gxx +++ b/src/IntStart/IntStart_SearchInside.gxx @@ -54,7 +54,8 @@ void IntStart_SearchInside::Perform (TheFunction& Func, done = Standard_False; list.Clear(); - static math_Vector Binf(1,2), Bsup(1,2), UVap(1,2),toler(1,2); + Standard_Real aBinf[2], aBsup[2], aUVap[2], atoler[2]; + math_Vector Binf(aBinf,1,2), Bsup(aBsup,1,2), UVap(aUVap,1,2), toler(atoler,1,2); gp_Pnt psol; Standard_Boolean testpnt; Standard_Integer i,j,nbpt; @@ -140,7 +141,8 @@ void IntStart_SearchInside::Perform (TheFunction& Func, //-- gp_Pnt Pmilieu = ThePSurfaceTool::Value(PS,0.5*(u1+u2),0.5*(v1+v2)); gp_Pnt Pextrm1 = ThePSurfaceTool::Value(PS,u1,v1); gp_Pnt Pextrm2 = ThePSurfaceTool::Value(PS,u2,v2); - static math_Vector Valf(1,1); + Standard_Real aValf[1]; + math_Vector Valf(aValf,1,1); Func.Value(UVap,Valf); Standard_Real rvalf = Valf(1); Standard_Real DistPP = Pextrm1.SquareDistance(Pextrm2); diff --git a/src/IntTools/IntTools_SurfaceRangeLocalizeData.cxx b/src/IntTools/IntTools_SurfaceRangeLocalizeData.cxx index 078bc482d2..8e8da46f67 100755 --- a/src/IntTools/IntTools_SurfaceRangeLocalizeData.cxx +++ b/src/IntTools/IntTools_SurfaceRangeLocalizeData.cxx @@ -225,13 +225,11 @@ const gp_Pnt &IntTools_SurfaceRangeLocalizeData::GetPointInFrame (const Standard_Integer theUIndex, const Standard_Integer theVIndex) const { - static gp_Pnt aNullPnt(0., 0., 0.); - Standard_Integer aFrmUInd = theUIndex + myUIndMin - 1; Standard_Integer aFrmVInd = theVIndex + myVIndMin - 1; if (aFrmUInd > myUIndMax || aFrmVInd > myVIndMax) - return aNullPnt; + return gp::Origin(); return myGridPoints->Value(aFrmUInd, aFrmVInd); } diff --git a/src/IntWalk/IntWalk_IWalking.cdl b/src/IntWalk/IntWalk_IWalking.cdl index f035987ed1..748f1919b6 100755 --- a/src/IntWalk/IntWalk_IWalking.cdl +++ b/src/IntWalk/IntWalk_IWalking.cdl @@ -62,11 +62,6 @@ raises NotDone from StdFail, is - Create - - returns IWalking from IntWalk; - - Create(Epsilon, Deflection, Step : Real from Standard) ---Purpose: Deflection is the maximum deflection admitted between two @@ -303,6 +298,7 @@ fields previousd2d : Dir2d from gp; seqAjout : SequenceOfInteger from TColStd; lines : SequenceOfIWLine; - + NbPointsConfondusConsecutifs: Integer from Standard; + EpsilonSembleTropGrand : Integer from Standard; end IWalking; diff --git a/src/IntWalk/IntWalk_IWalking_1.gxx b/src/IntWalk/IntWalk_IWalking_1.gxx index 51a83e1bb0..503d1b2ce5 100755 --- a/src/IntWalk/IntWalk_IWalking_1.gxx +++ b/src/IntWalk/IntWalk_IWalking_1.gxx @@ -31,7 +31,9 @@ IntWalk_IWalking::IntWalk_IWalking (const Standard_Real Epsilon, fleche(Deflection), pas(Increment), tolerance(1,2), - epsilon(Epsilon*Epsilon) + epsilon(Epsilon*Epsilon), + NbPointsConfondusConsecutifs(0), + EpsilonSembleTropGrand(0) { } diff --git a/src/IntWalk/IntWalk_IWalking_2.gxx b/src/IntWalk/IntWalk_IWalking_2.gxx index 61b23c5a7e..5d48b1f08d 100755 --- a/src/IntWalk/IntWalk_IWalking_2.gxx +++ b/src/IntWalk/IntWalk_IWalking_2.gxx @@ -328,8 +328,9 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage } } if (Arrive) { - static math_Vector bidF(1,1); - static math_Matrix bidD(1,1,1,2); + Standard_Real abidF[1], abidD[1][2]; + math_Vector bidF(abidF,1,1); + math_Matrix bidD(abidD,1,1,1,2); sp.Values(UV,bidF,bidD); break; } @@ -570,8 +571,9 @@ Standard_Boolean IntWalk_IWalking::TestArretAjout Arrive = Standard_True; UV(1) = U1; UV(2) = V1; - static math_Vector bidF(1,1); - static math_Matrix bidD(1,1,1,2); + Standard_Real abidF[1], abidD[1][2]; + math_Vector bidF(abidF,1,1); + math_Matrix bidD(abidD,1,1,1,2); sp.Values(UV,bidF,bidD); break; } @@ -667,8 +669,9 @@ void IntWalk_IWalking::TestArretCadre } } if (Found) { - static math_Vector bidF(1,1); - static math_Matrix bidD(1,1,1,2); + Standard_Real abidF[1], abidD[1][2]; + math_Vector bidF(abidF,1,1); + math_Matrix bidD(abidD,1,1,1,2); sp.Values(UV,bidF,bidD); Standard_Integer NBP = Line->NbPoints(); Standard_Integer Indextg; @@ -742,8 +745,9 @@ void IntWalk_IWalking::TestArretCadre } if (Found) { Irang = -Irang; // jag 941017 - static math_Vector bidF(1,1); - static math_Matrix bidD(1,1,1,2); + Standard_Real abidF[1], abidD[1][2]; + math_Vector bidF(abidF,1,1); + math_Matrix bidD(abidD,1,1,1,2); sp.Values(UV,bidF,bidD); return; } diff --git a/src/IntWalk/IntWalk_IWalking_3.gxx b/src/IntWalk/IntWalk_IWalking_3.gxx index 135ede546a..9fe626d6b6 100755 --- a/src/IntWalk/IntWalk_IWalking_3.gxx +++ b/src/IntWalk/IntWalk_IWalking_3.gxx @@ -73,7 +73,8 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult, { Standard_Integer I, N; - static math_Vector BornInf(1,2), BornSup(1,2), UVap(1,2); + Standard_Real aBornInf[2], aBornSup[2], aUVap[2]; + math_Vector BornInf(aBornInf,1,2), BornSup(aBornSup,1,2), UVap(aUVap,1,2); Standard_Real PasC, PasCu, PasCv; Standard_Boolean Arrive; // shows if the line ends Standard_Boolean Cadre; // shows if one is on border of the domain @@ -498,8 +499,9 @@ static Standard_Boolean TestPassedSolutionWithNegativeState(const TColStd_Sequen } } if (Arrive) { - static math_Vector bidF(1,1); - static math_Matrix bidD(1,1,1,2); + Standard_Real abidF[1], abidD[1][2]; + math_Vector bidF(abidF,1,1); + math_Matrix bidD(abidD,1,1,1,2); sp.Values(UV,bidF,bidD); break; } diff --git a/src/IntWalk/IntWalk_IWalking_4.gxx b/src/IntWalk/IntWalk_IWalking_4.gxx index d9d1ddf9ca..94595bab69 100755 --- a/src/IntWalk/IntWalk_IWalking_4.gxx +++ b/src/IntWalk/IntWalk_IWalking_4.gxx @@ -52,8 +52,9 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult, { Standard_Integer I,N; - static math_Vector BornInf(1,2),BornSup(1,2); - static math_Vector Uvap(1,2);// parameters of current approach + Standard_Real aBornInf[2], aBornSup[2], aUVap[2]; + math_Vector BornInf(aBornInf,1,2), BornSup(aBornSup,1,2); + math_Vector Uvap(aUVap,1,2);// parameters of current approach Standard_Real PasC; // rate of advancement on the tangent Standard_Real PasCu; // rate of advancement current by U Standard_Real PasCv; // step of advancement current by V diff --git a/src/IntWalk/IntWalk_IWalking_5.gxx b/src/IntWalk/IntWalk_IWalking_5.gxx index 4c9bf9e554..703f2065ac 100755 --- a/src/IntWalk/IntWalk_IWalking_5.gxx +++ b/src/IntWalk/IntWalk_IWalking_5.gxx @@ -16,6 +16,15 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. +namespace { + static const Standard_Real CosRef3D = 0.98;// regle par tests dans U4 + // correspond a 11.478 d + static const Standard_Real CosRef2D = 0.88; // correspond a 25 d + static const Standard_Integer MaxDivision = 60; // nombre maxi de division + // du pas a cause de + // l angle trop grand en 2d (U4) +} + IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection (TheIWFunction& sp, const Standard_Boolean Finished, @@ -49,18 +58,10 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection IntWalk_StatusDeflection Status = IntWalk_OK; - static const Standard_Real CosRef3D = 0.98;// regle par tests dans U4 - // correspond a 11.478 d - static const Standard_Real CosRef2D = 0.88; // correspond a 25 d - static const Standard_Integer MaxDivision = 60; // nombre maxi de division - // du pas a cause de - // l angle trop grand en 2d (U4) //--------------------------------------------------------------------------------- //-- lbr le 4 Avril 95 : On peut se trouver ds le cas ou Status renvoie point //-- confondus si epsilon est assez grand (1e-11) . Dans ce cas on boucle //-- sans jamais changer les valeurs envoyees a Rsnld. - static Standard_Integer NbPointsConfondusConsecutifs = 0 ; - static Standard_Integer EpsilonSembleTropGrand = 0 ; //--------------------------------------------------------------------------------- Standard_Real Paramu, Paramv, StepU,StepV; Standard_Real Cosi, Cosi2, Norme; diff --git a/src/IntWalk/IntWalk_IWalking_6.gxx b/src/IntWalk/IntWalk_IWalking_6.gxx index 67d44f0fe2..4d78dfe80d 100755 --- a/src/IntWalk/IntWalk_IWalking_6.gxx +++ b/src/IntWalk/IntWalk_IWalking_6.gxx @@ -58,9 +58,10 @@ void IntWalk_IWalking::MakeWalkingPoint Psol.SetValue(sp.Point(),reversed, U, V); } else if (Case == 11 || Case == 12 ) { - static math_Vector UV(1, 2); - static math_Vector FF(1, 1); - static math_Matrix DD(1, 1, 1, 2); + Standard_Real aUV[2], aFF[1], aDD[1][2]; + math_Vector UV(aUV,1, 2); + math_Vector FF(aFF,1, 1); + math_Matrix DD(aDD,1, 1, 1, 2); UV(1) = U; UV(2) = V; sp.Values(UV, FF, DD); @@ -85,9 +86,10 @@ void IntWalk_IWalking::OpenLine(const Standard_Integer N, { ThePointOfPath PathPnt; - static math_Vector UV(1, 2); - static math_Vector FF(1, 1); - static math_Matrix DD(1, 1, 1, 2); + Standard_Real aUV[2], aFF[1], aDD[1][2]; + math_Vector UV(aUV,1, 2); + math_Vector FF(aFF,1, 1); + math_Matrix DD(aDD,1, 1, 1, 2); previousPoint = Line->Value(1); if (!reversed) { diff --git a/src/IntWalk/IntWalk_PWalking.cdl b/src/IntWalk/IntWalk_PWalking.cdl index 4cd56ba9d5..26a4d3b93a 100755 --- a/src/IntWalk/IntWalk_PWalking.cdl +++ b/src/IntWalk/IntWalk_PWalking.cdl @@ -310,5 +310,6 @@ fields firstd2 : Dir2d from gp; myIntersectionOn2S : TheInt2S ; - + STATIC_BLOCAGE_SUR_PAS_TROP_GRAND : Integer from Standard; + STATIC_PRECEDENT_INFLEXION : Integer from Standard; end PWalking; diff --git a/src/IntWalk/IntWalk_PWalking_1.gxx b/src/IntWalk/IntWalk_PWalking_1.gxx index a2614394ea..f65b202f50 100755 --- a/src/IntWalk/IntWalk_PWalking_1.gxx +++ b/src/IntWalk/IntWalk_PWalking_1.gxx @@ -84,7 +84,9 @@ IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1, fleche(Deflection), tolconf(Epsilon), sensCheminement(1), - myIntersectionOn2S(Caro1,Caro2,TolTangency) + myIntersectionOn2S(Caro1,Caro2,TolTangency), + STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0), + STATIC_PRECEDENT_INFLEXION(0) { Standard_Real KELARG=20.; // @@ -222,7 +224,9 @@ IntWalk_PWalking::IntWalk_PWalking(const ThePSurface& Caro1, fleche(Deflection), tolconf(Epsilon), sensCheminement(1), - myIntersectionOn2S(Caro1,Caro2,TolTangency) + myIntersectionOn2S(Caro1,Caro2,TolTangency), + STATIC_BLOCAGE_SUR_PAS_TROP_GRAND(0), + STATIC_PRECEDENT_INFLEXION(0) { Standard_Real KELARG=20.; // diff --git a/src/IntWalk/IntWalk_PWalking_3.gxx b/src/IntWalk/IntWalk_PWalking_3.gxx index 0c28cd4ad3..054377e891 100755 --- a/src/IntWalk/IntWalk_PWalking_3.gxx +++ b/src/IntWalk/IntWalk_PWalking_3.gxx @@ -21,6 +21,13 @@ //#define DEBUG 0 +namespace { +//OCC431(apo): modified -> +static const Standard_Real CosRef2D = Cos(M_PI/9.0), AngRef2D = M_PI/2.0; + +static const Standard_Real d = 7.0; +} + IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() // tester si fleche respectee en calculant un majorant de fleche @@ -37,9 +44,6 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() // tester s il n y a pas changement de rive // { - static Standard_Integer STATIC_BLOCAGE_SUR_PAS_TROP_GRAND = 0; - static Standard_Integer STATIC_PRECEDENT_INFLEXION = 0; - if(line->NbPoints() ==1 ) { STATIC_BLOCAGE_SUR_PAS_TROP_GRAND=STATIC_PRECEDENT_INFLEXION=0; } @@ -126,10 +130,7 @@ IntWalk_StatusDeflection IntWalk_PWalking::TestDeflection() return(IntWalk_ArretSurPointPrecedent); } //================================================================================== - //OCC431(apo): modified -> - static Standard_Real CosRef2D = Cos(M_PI/9.0), AngRef2D = M_PI/2.0; - - static Standard_Real /*tolArea = 100.0,*/ d = 7.0; + Standard_Real tolArea = 100.0; if (ResoU1 < Precision::PConfusion() || ResoV1 < Precision::PConfusion() || diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 492b375dd9..70d1025f47 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -387,8 +387,107 @@ static Standard_Integer OCC23774(Draw_Interpretor& di, Standard_Integer n, const return 0; } -#include +#include +#include +#include +#include +static void GeomConvertTest (Draw_Interpretor& di, Standard_Integer theTargetNbUPoles, Standard_CString theFileName) +{ + Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theFileName); + GeomConvert_ApproxSurface aGAS (aSurf, 1e-4, GeomAbs_C1, GeomAbs_C1, 9, 9, 100, 1); + if (!aGAS.IsDone()) { + di << "ApproxSurface is not done!" << "\n"; + return; + } + const Handle(Geom_BSplineSurface)& aBSurf = aGAS.Surface(); + if (aBSurf.IsNull()) { + di << "BSplineSurface is not created!" << "\n"; + return; + } + di << "Number of UPoles:" << aBSurf->NbUPoles() << "\n"; + QCOMPARE (aBSurf->NbUPoles(), theTargetNbUPoles); +} + +struct aData { + Draw_Interpretor* di; + Standard_Integer nbupoles; + Standard_CString filename; +}; + +Standard_EXPORT Standard_Address convert(Standard_Address data) +{ + aData* info = (aData*) data; + GeomConvertTest(*(info->di),info->nbupoles,info->filename); + return NULL; +} + +static Standard_Integer OCC23952sweep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) +{ + if (argc != 3) { + di << "Usage: " << argv[0] << " invalid number of arguments" << "\n"; + return 1; + } + struct aData aStorage; + aStorage.di = &di; + aStorage.nbupoles = Draw::Atoi(argv[1]); + aStorage.filename = argv[2]; + + OSD_Thread aThread1(convert); + aThread1.Run(&aStorage); + GeomConvertTest(di,aStorage.nbupoles,aStorage.filename); + + return 0; +} +#include +static void GeomIntSSTest (Draw_Interpretor& di, Standard_Integer theNbSol, Standard_CString theFileName1, Standard_CString theFileName2) +{ + Handle(Geom_Surface) aSurf1 = DrawTrSurf::GetSurface(theFileName1); + Handle(Geom_Surface) aSurf2 = DrawTrSurf::GetSurface(theFileName2); + GeomInt_IntSS anInter; + anInter.Perform(aSurf1, aSurf2, Precision::Confusion(), Standard_True); + if (!anInter.IsDone()) { + di << "An intersection is not done!" << "\n"; + return; + } + + di << "Number of Lines:" << anInter.NbLines() << "\n"; + QCOMPARE (anInter.NbLines(), theNbSol); +} + +struct aNewData { + Draw_Interpretor* di; + Standard_Integer nbsol; + Standard_CString filename1; + Standard_CString filename2; +}; +Standard_EXPORT Standard_Address convert_inter(Standard_Address data) +{ + aNewData* info = (aNewData*) data; + GeomIntSSTest(*(info->di),info->nbsol,info->filename1,info->filename2); + return NULL; +} + +static Standard_Integer OCC23952intersect (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) +{ + if (argc != 4) { + di << "Usage: " << argv[0] << " invalid number of arguments" << "\n"; + return 1; + } + struct aNewData aStorage; + aStorage.di = &di; + aStorage.nbsol = Draw::Atoi(argv[1]); + aStorage.filename1 = argv[2]; + aStorage.filename2 = argv[3]; + + OSD_Thread aThread1(convert_inter); + aThread1.Run(&aStorage); + GeomIntSSTest(di,aStorage.nbsol,aStorage.filename1,aStorage.filename2); + + return 0; +} + +#include static Standard_Integer OCC23683 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv) { if (argc < 2) { @@ -479,7 +578,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group); theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group); theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group); + theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group); + theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group); theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group); - return; } diff --git a/src/math/math_FunctionRoots.cxx b/src/math/math_FunctionRoots.cxx index 07a7cf8ae7..7063fd6b10 100755 --- a/src/math/math_FunctionRoots.cxx +++ b/src/math/math_FunctionRoots.cxx @@ -201,10 +201,7 @@ static void Solve(math_FunctionWithDerivative& F, #define NEWSEQ 1 -#if NEWSEQ -TColStd_SequenceOfReal StaticSol; - -#endif +static const Standard_Integer methode = 1; //-- 1:(Nv Traitement) 3:(Nv + Ancien +check) 2:(Ancien) math_FunctionRoots::math_FunctionRoots(math_FunctionWithDerivative& F, const Standard_Real A, @@ -222,7 +219,9 @@ math_FunctionRoots::math_FunctionRoots(math_FunctionWithDerivative& F, } #endif - static Standard_Integer methode = 1; //-- 1:(Nv Traitement) 3:(Nv + Ancien +check) 2:(Ancien) +#if NEWSEQ + TColStd_SequenceOfReal StaticSol; +#endif Sol.Clear(); NbStateSol.Clear(); if(methode & 1) { diff --git a/src/math/math_Powell.cxx b/src/math/math_Powell.cxx index f892764817..a7fd91a54e 100755 --- a/src/math/math_Powell.cxx +++ b/src/math/math_Powell.cxx @@ -29,8 +29,12 @@ #include -static Standard_Real sqrarg; -#define SQR(a) (sqrarg=(a), sqrarg*sqrarg) +namespace { +static inline Standard_Real SQR (const Standard_Real a) +{ + return a * a; +} +} class DirFunctionBis : public math_Function { diff --git a/src/math/math_Recipes.cxx b/src/math/math_Recipes.cxx index 462c87b08c..777c99a9f5 100755 --- a/src/math/math_Recipes.cxx +++ b/src/math/math_Recipes.cxx @@ -42,9 +42,20 @@ #include #include -static Standard_Real at, bt, ct; -#define PYTHAG(a,b) ((at=fabs(a)) > (bt=fabs(b)) ? \ -(ct=bt/at,at*sqrt(1.0+ct*ct)) : (bt ? (ct=at/bt,bt*sqrt(1.0+ct*ct)) : 0.0)) +namespace { +static inline Standard_Real PYTHAG (const Standard_Real a, const Standard_Real b) +{ + Standard_Real at = fabs (a), bt = fabs (b), ct = 0.; + if (at > bt) { + ct = bt / at; + ct = at * sqrt (1.0 + ct * ct); + } else if (bt) { + ct = at / bt; + ct = bt * sqrt (1.0 + ct * ct); + } + return ct; +} +} #define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a)) diff --git a/tests/bugs/modalg_5/bug23952_1 b/tests/bugs/modalg_5/bug23952_1 new file mode 100644 index 0000000000..4007be367f --- /dev/null +++ b/tests/bugs/modalg_5/bug23952_1 @@ -0,0 +1,19 @@ +puts "================" +puts "OCC23952" +puts "================" +puts "" +########################################################################################### +# Improving thread-safety of intersections, approximations and other modeling algorithms +########################################################################################### + +pload QAcommands +restore [locate_data_file bug23952_trim-torus.draw] res + +set NbUPoles 18 +set info [OCC23952sweep $NbUPoles res] + +if { [regexp "theTargetNbUPoles: OK" $info] != 1 } { + puts "Error : Number of UPoles is incorrect" +} else { + puts "OK: Number of UPoles is correct" +} diff --git a/tests/bugs/modalg_5/bug23952_2 b/tests/bugs/modalg_5/bug23952_2 new file mode 100644 index 0000000000..85e5958ae2 --- /dev/null +++ b/tests/bugs/modalg_5/bug23952_2 @@ -0,0 +1,21 @@ +puts "================" +puts "OCC23952" +puts "================" +puts "" +########################################################################################### +# Improving thread-safety of intersections, approximations and other modeling algorithms +########################################################################################### + +pload QAcommands +restore [locate_data_file bug23952_s1.draw] a +restore [locate_data_file bug23952_s2.draw] b + +set NbLines 5 +set info [OCC23952intersect $NbLines a b] + +if { [regexp "theNbSol: OK" $info] != 1 } { + puts "Error : Number of intersections is incorrect" +} else { + puts "OK: Number of intersections is correct" +} +