| [165] | 1 | //  Adaptateurs et Drawers divers pour Outils PEIDA++
 | 
|---|
 | 2 | //                             R. Ansari  06-08/98
 | 
|---|
 | 3 | // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
 | 
|---|
 | 4 | 
 | 
|---|
| [2615] | 5 | #include "sopnamsp.h"
 | 
|---|
| [165] | 6 | #include "pipodrw.h"
 | 
|---|
 | 7 | #include "generalfit.h"
 | 
|---|
 | 8 | 
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | //================================================================
 | 
|---|
 | 11 | // PIGFFDrawer
 | 
|---|
 | 12 | //================================================================
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | PIGFFDrawer::PIGFFDrawer(GeneralFunction* f)
 | 
|---|
 | 15 | : mFunc(f), mNParms(f->NPar()), mParms(new double[mNParms])
 | 
|---|
 | 16 | {
 | 
|---|
 | 17 |   ASSERT(f->NVar() == 1);
 | 
|---|
 | 18 | }
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | PIGFFDrawer::~PIGFFDrawer()
 | 
|---|
 | 21 | {
 | 
|---|
 | 22 |   delete[] mParms;
 | 
|---|
 | 23 | }
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | void
 | 
|---|
 | 26 | PIGFFDrawer::SetParms(double const* p)
 | 
|---|
 | 27 | {
 | 
|---|
 | 28 |   for (int i=0; i<mNParms; i++)
 | 
|---|
 | 29 |     mParms[i] = p[i];
 | 
|---|
 | 30 | }
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | void
 | 
|---|
| [205] | 34 | PIGFFDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/)
 | 
|---|
| [165] | 35 | {
 | 
|---|
 | 36 |   PIGrCoord x1, x2, y1, y2;
 | 
|---|
 | 37 |   g->GetGrSpace(x1, x2, y1, y2);
 | 
|---|
| [205] | 38 |   double xMax = x2;
 | 
|---|
 | 39 |   double xMin = x1;
 | 
|---|
 | 40 |   double yMax = y2;
 | 
|---|
 | 41 |   double yMin = y1;
 | 
|---|
 | 42 |   double xStep = (xMax - xMin)/100;
 | 
|---|
 | 43 |   double xOld = xMin;
 | 
|---|
 | 44 |   double yOld = 0;
 | 
|---|
 | 45 | //  double yOld = f->Value(&xMin, mParms);
 | 
|---|
 | 46 |   for (double x = xMin+xStep; x<xMax; x+=xStep) {
 | 
|---|
 | 47 |    double y = 0; // $CHECK$
 | 
|---|
 | 48 | //    double y = f->Value(&x, mParms);
 | 
|---|
| [165] | 49 |     if (y>yMin && yOld>yMin && 
 | 
|---|
 | 50 |         y<yMax && yOld<yMax) 
 | 
|---|
 | 51 |            g->DrawLine(xOld, yOld, x, y);
 | 
|---|
 | 52 |     xOld = x;
 | 
|---|
 | 53 |     yOld = y;
 | 
|---|
 | 54 |   }
 | 
|---|
 | 55 | }
 | 
|---|
 | 56 | 
 | 
|---|
| [584] | 57 | 
 | 
|---|
 | 58 | #ifdef SANS_EVOLPLANCK
 | 
|---|
 | 59 | 
 | 
|---|
| [165] | 60 | // ----------------------------------------------------------
 | 
|---|
| [584] | 61 | // Adaptateur de vecteurs Peida++ a P1DArrayAdapter
 | 
|---|
| [165] | 62 | // ----------------------------------------------------------
 | 
|---|
 | 63 | 
 | 
|---|
 | 64 | /* --Methode-- */
 | 
|---|
| [584] | 65 | POVectorAdapter::POVectorAdapter(Vector* v, bool ad)
 | 
|---|
 | 66 |         : P1DArrayAdapter(v->NElts())
 | 
|---|
| [165] | 67 | {
 | 
|---|
| [584] | 68 | aDel = ad; mVec = v;
 | 
|---|
| [165] | 69 | }
 | 
|---|
 | 70 | 
 | 
|---|
 | 71 | /* --Methode-- */
 | 
|---|
| [584] | 72 | POVectorAdapter::~POVectorAdapter()
 | 
|---|
| [165] | 73 | {
 | 
|---|
| [584] | 74 | if (aDel) delete mVec;
 | 
|---|
| [165] | 75 | }
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | /* --Methode-- */
 | 
|---|
| [584] | 78 | double POVectorAdapter::Value(int i)
 | 
|---|
 | 79 | { 
 | 
|---|
 | 80 | return((*mVec)(i)); 
 | 
|---|
| [165] | 81 | }
 | 
|---|
 | 82 | 
 | 
|---|
| [3145] | 83 | ------- FIN SUPPRESSION */
 | 
|---|
 | 84 | 
 | 
|---|
| [165] | 85 | // ----------------------------------------------------------
 | 
|---|
 | 86 | // Adaptateur de matrice Peida++ a P2DArrayAdapter
 | 
|---|
 | 87 | // Attention  Y: Lignes (rows)  X: Colonnes
 | 
|---|
 | 88 | // ----------------------------------------------------------
 | 
|---|
 | 89 | 
 | 
|---|
 | 90 | /* --Methode-- */
 | 
|---|
 | 91 | POMatrixAdapter::POMatrixAdapter(Matrix* mtx, bool ad)
 | 
|---|
 | 92 |         : P2DArrayAdapter(mtx->NCol(), mtx->NRows())
 | 
|---|
 | 93 | {
 | 
|---|
 | 94 | aDel = ad; mMtx = mtx;
 | 
|---|
 | 95 | }
 | 
|---|
 | 96 | 
 | 
|---|
 | 97 | /* --Methode-- */
 | 
|---|
 | 98 | POMatrixAdapter::~POMatrixAdapter()
 | 
|---|
 | 99 | {
 | 
|---|
 | 100 | if (aDel)  delete mMtx;
 | 
|---|
 | 101 | }
 | 
|---|
 | 102 | 
 | 
|---|
 | 103 | /* --Methode-- */
 | 
|---|
| [205] | 104 | double POMatrixAdapter::Value(int ix, int iy)
 | 
|---|
| [165] | 105 | {
 | 
|---|
 | 106 | // Attention MatrixAdapter(X=Colonne, Y= Row) = Matrix(row, col)  
 | 
|---|
 | 107 | return((*mMtx)(iy, ix));
 | 
|---|
 | 108 | }
 | 
|---|
 | 109 | 
 | 
|---|
| [584] | 110 | #endif   // SANS_EVOLPLANCK
 | 
|---|
| [165] | 111 | 
 | 
|---|