Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

arraygph.cpp

Go to the documentation of this file.
00001 #include "arraybse.h"
00002 //
00003 //******************************************************************************
00004 //                    ARRAYGPH.CPP
00005 //******************************************************************************
00006 //
00007 //        BINDINGS TO THE UC GRAHPICS CLASSES
00008 //
00009 //********************************************************************************
00010 //
00011 //            Chris Anderson  (C) UCLA
00012 //
00013 //            Tue Sep 26 14:40:00 1995
00014 //
00015 //********************************************************************************
00016 //
00017 
00018 void  CAMarrayBase::plot() const
00019 {
00020 //
00021 //  Need Conversion Check
00022 //
00023         long dimension;
00024         long M,N;
00025 
00026         const CAMarrayBase* InputPtr;
00027         CAMarrayBase A;
00028 
00029         double* AdataPtr; double* BdataPtr;
00030 
00031         long j; int autoFlag;
00032         double x_min, x_max, y_min, y_max;
00033 
00034         if(Structure.isSubset() == 1)
00035         {
00036         A.initializeMinDuplicate(*this);
00037         dimension   = A.getDimension();
00038         AdataPtr    = (double*)A.getDataPointer();
00039         if(dimension >= 1) M = A[1].getIndexCount();
00040         if(dimension == 2) N = A[2].getIndexCount();
00041         InputPtr = &A;
00042         }
00043         else
00044         {
00045         dimension = getDimension();
00046         AdataPtr  = (double*)getDataPointer();
00047         if(dimension >= 1) M = Structure[1].getIndexCount();
00048         if(dimension == 2) N = Structure[2].getIndexCount();
00049         InputPtr =  this;
00050         }
00051 
00052         switch (dimension)
00053         {
00054         case 1  :
00055         CAMgraphics::plot(AdataPtr,M);
00056 
00057         break;
00058 
00059         case 2  :
00060         autoFlag = CAMgraphics::getAutoScaleFlag();
00061         x_min = 1;
00062         x_max = M;
00063         y_min = InputPtr->min();
00064         y_max = InputPtr->max();
00065         CAMgraphics::axis(x_min,x_max,y_min,y_max);
00066         for(j = 1; j <= N; j++)
00067         {
00068         BdataPtr = AdataPtr + (j-1)*M;
00069         CAMgraphics::plot(BdataPtr,M);
00070         }
00071         CAMgraphics::axis(autoFlag);
00072 
00073         break;
00074         default :
00075         CAMarrayBase::plotDimensionError(A.Structure);
00076         }
00077 
00078 }
00079 
00080 void  CAMarrayBase::plot(int p_arg) const
00081 {
00082         char point_type_save = CAMgraphics::getPointType();
00083         int  plot_style_save = CAMgraphics::getPlotStyle();
00084     if(p_arg < 32) 
00085         { CAMgraphics::setPlotStyle(p_arg);}
00086     else
00087         { CAMgraphics::setPointType(char(p_arg));
00088           CAMgraphics::setPlotStyle(CAMgraphics::POINTS);
00089         }
00090 
00091         this->plot();
00092 
00093         CAMgraphics::setPointType(point_type_save);
00094         CAMgraphics::setPlotStyle(plot_style_save);
00095 }
00096 void  CAMarrayBase::plot(int p_style, int p_arg) const
00097 {
00098         char point_type_save = CAMgraphics::getPointType();
00099         int  plot_style_save = CAMgraphics::getPlotStyle();
00100         CAMgraphics::setPointType(char(p_arg));
00101         CAMgraphics::setPlotStyle(p_style);
00102 
00103         this->plot();
00104 
00105         CAMgraphics::setPointType(point_type_save);
00106         CAMgraphics::setPlotStyle(plot_style_save);
00107 }
00108 void  CAMarrayBase::plot(const CAMarrayBase& Ordinates) const
00109 {
00110 //
00111 //  Need Conversion Check
00112 //
00113         long dimension;
00114         long M,N;
00115 
00116         CAMarrayBase A;
00117         const CAMarrayBase* InputPtr;
00118         double* AdataPtr; double* BdataPtr;
00119 
00120         long j; int autoFlag;
00121         double x_min, x_max, y_min, y_max;
00122 
00123         CAMarrayBase O;
00124     double* OdataPtr;
00125         long    Odimension;
00126         long    Ocount;
00127 //
00128         if(Structure.isSubset() == 1)
00129         {
00130         A.initializeMinDuplicate(*this);
00131         dimension   = A.getDimension();
00132         AdataPtr    = (double*)A.getDataPointer();
00133         if(dimension >= 1) M = A[1].getIndexCount();
00134         if(dimension == 2) N = A[2].getIndexCount();
00135         InputPtr = &A;
00136         }
00137         else
00138         {
00139         dimension = getDimension();
00140         AdataPtr  = (double*)getDataPointer();
00141         if(dimension >= 1) M = Structure[1].getIndexCount();
00142         if(dimension == 2) N = Structure[2].getIndexCount();
00143         InputPtr = this;
00144         }
00145 
00146         if(Ordinates.Structure.isSubset() == 1)
00147         {
00148         O.initializeMinDuplicate(Ordinates);
00149         Odimension  = O.getDimension();
00150         OdataPtr    = (double*)O.getDataPointer();
00151         Ocount      = O[1].getIndexCount();
00152         }
00153         else
00154         {
00155         Odimension  = Ordinates.getDimension();
00156         OdataPtr    = (double*)Ordinates.getDataPointer();
00157         Ocount      = Ordinates[1].getIndexCount();
00158         }
00159 
00160         if(Odimension != 1)
00161         {CAMarrayBase::ordinateError(Ordinates.Structure);}
00162 
00163         if(M != Ocount)
00164         {CAMarrayBase::ordinateError(Ordinates.Structure);}
00165 
00166         switch (dimension)
00167         {
00168         case 1  :
00169         CAMgraphics::plot(OdataPtr,AdataPtr,M);
00170 
00171         break;
00172 
00173         case 2  :
00174 
00175         autoFlag = CAMgraphics::getAutoScaleFlag();
00176         x_min = *OdataPtr;
00177         x_max = *(OdataPtr +(M-1));
00178         y_min = InputPtr->min();
00179         y_max = InputPtr->max();
00180         CAMgraphics::axis(x_min,x_max,y_min,y_max);
00181         for(j = 1; j <= N; j++)
00182         {
00183         BdataPtr = AdataPtr + (j-1)*M;
00184         CAMgraphics::plot(OdataPtr, BdataPtr,M);
00185         }
00186         CAMgraphics::axis(autoFlag);
00187 
00188         break;
00189         default :
00190         CAMarrayBase::plotDimensionError(A.Structure);
00191         }
00192 
00193 }
00194 
00195 void  CAMarrayBase::plot(const CAMarrayBase& Ordinates, int p_arg) const
00196 {
00197         char point_type_save = CAMgraphics::getPointType();
00198         int  plot_style_save = CAMgraphics::getPlotStyle();
00199     if(p_arg < 32) 
00200         { CAMgraphics::setPlotStyle(p_arg);}
00201     else
00202         { CAMgraphics::setPointType(char(p_arg));
00203           CAMgraphics::setPlotStyle(CAMgraphics::POINTS);
00204         }
00205 
00206         this->plot(Ordinates);
00207 
00208         CAMgraphics::setPointType(point_type_save);
00209         CAMgraphics::setPlotStyle(plot_style_save);
00210 }
00211 
00212 void  CAMarrayBase::plot(const CAMarrayBase& Ordinates, int p_arg, int p_style) const
00213 {
00214         char point_type_save = CAMgraphics::getPointType();
00215         int  plot_style_save = CAMgraphics::getPlotStyle();
00216         CAMgraphics::setPointType(char(p_arg));
00217         CAMgraphics::setPlotStyle(p_style);
00218 
00219         this->plot(Ordinates);
00220 
00221         CAMgraphics::setPointType(point_type_save);
00222         CAMgraphics::setPlotStyle(plot_style_save);
00223 }
00224 
00225 void  CAMarrayBase::contour() const
00226 {
00227 //
00228 //  Need Conversion Check
00229 //
00230         CAMarrayBase A;
00231         double* AdataPtr;
00232 
00233         long dimension;
00234         long M,N;
00235         int  Fflag;
00236 
00237         if(Structure.isSubset() == 1)
00238         {
00239         A.initializeMinDuplicate(*this);
00240         dimension   = A.getDimension();
00241         AdataPtr    = (double*)A.getDataPointer();
00242         if(dimension >= 1) M = A[1].getIndexCount();
00243         if(dimension == 2) N = A[2].getIndexCount();
00244         }
00245         else
00246         {
00247         dimension = getDimension();
00248         AdataPtr  = (double*)getDataPointer();
00249         if(dimension >= 1) M = Structure[1].getIndexCount();
00250         if(dimension == 2) N = Structure[2].getIndexCount();
00251         }
00252 
00253         if(dimension == 2)
00254         {
00255         Fflag = CAMgraphics::getFortranArrayFlag();
00256         CAMgraphics::fortranArrayFlagOn();
00257         CAMgraphics::contour(AdataPtr,M,N);
00258         if(Fflag == 0) CAMgraphics::fortranArrayFlagOff();
00259         }
00260         else
00261         {CAMarrayBase::plotDimensionError(A.Structure);}
00262 
00263 }
00264 
00265 void  CAMarrayBase::contour(int nContour)  const
00266 {
00267         CAMgraphics::setContourLevel(nContour);
00268         this->contour();
00269 }
00270 
00271 void  CAMarrayBase::contour(long nContour)  const
00272 {
00273         CAMgraphics::setContourLevel(nContour);
00274         this->contour();
00275 }
00276 void  CAMarrayBase::contour(double increment) const
00277 {
00278         CAMgraphics::setContourLevel(increment);
00279         this->contour();
00280 }
00281 
00282 void  CAMarrayBase::contour(double low_value, double high_value) const
00283 {
00284         CAMgraphics::setContourLevel(low_value, high_value);
00285         this->contour();
00286 }
00287 
00288 void  CAMarrayBase::contour(long nContour, double low_value, double high_value) const
00289 {
00290         CAMgraphics::setContourLevel(nContour, low_value, high_value);
00291         this->contour();
00292 }
00293 
00294 void  CAMarrayBase::contour(int nContour, double low_value, double high_value) const
00295 {
00296         CAMgraphics::setContourLevel(nContour, low_value, high_value);
00297         this->contour();
00298 }
00299 
00300 void  CAMarrayBase::contour(double increment, double low_value, double high_value) const
00301 {
00302         CAMgraphics::setContourLevel(increment, low_value, high_value);
00303         this->contour();
00304 }
00305 
00306 void  CAMarrayBase::contour(const CAMarrayBase& contourValues) const
00307 {
00308 //
00309 //  Need Conversion Check
00310 //
00311         CAMarrayBase A;
00312         double* AdataPtr;
00313 
00314         long dimension;
00315         long M,N;
00316         int  Fflag;
00317 
00318         CAMarrayBase CV;
00319         double* CVdataPtr;
00320         long    CVdimension;
00321         long    CVcount;
00322 
00323         if(Structure.isSubset() == 1)
00324         {
00325         A.initializeMinDuplicate(*this);
00326         dimension   = A.getDimension();
00327         AdataPtr    = (double*)A.getDataPointer();
00328         if(dimension >= 1) M = A[1].getIndexCount();
00329         if(dimension == 2) N = A[2].getIndexCount();
00330         }
00331         else
00332         {
00333         dimension = getDimension();
00334         AdataPtr  = (double*)getDataPointer();
00335         if(dimension >= 1) M = Structure[1].getIndexCount();
00336         if(dimension == 2) N = Structure[2].getIndexCount();
00337         }
00338 
00339         if(contourValues.Structure.isSubset() == 1)
00340         {
00341         CV.initializeMinDuplicate(contourValues);
00342         CVdimension  = CV.getDimension();
00343         CVdataPtr    = (double*)CV.getDataPointer();
00344         CVcount      = CV[1].getIndexCount();
00345         }
00346         else
00347         {
00348         CVdimension  = contourValues.getDimension();
00349         CVdataPtr    = (double*)contourValues.getDataPointer();
00350         CVcount      = contourValues[1].getIndexCount();
00351         }
00352 
00353 
00354         if(CVdimension != 1)
00355         {CAMarrayBase::ordinateError(contourValues.Structure);}
00356 
00357         if(dimension == 2)
00358         {
00359         Fflag = CAMgraphics::getFortranArrayFlag();
00360         CAMgraphics::fortranArrayFlagOn();
00361         CAMgraphics::contour(AdataPtr,M,N,CVdataPtr,CVcount);
00362         if(Fflag == 0) CAMgraphics::fortranArrayFlagOff();
00363         }
00364         else
00365         {CAMarrayBase::plotDimensionError(A.Structure);}
00366 
00367 }
00368 
00369 void  CAMarrayBase::surface() const
00370 {
00371 //
00372 //  Need Conversion Check
00373 //
00374         CAMarrayBase A;
00375         double* AdataPtr;
00376 
00377         long dimension;
00378         long M,N;
00379         int  Fflag;
00380 
00381 
00382         if(Structure.isSubset() == 1)
00383         {
00384         A.initializeMinDuplicate(*this);
00385         dimension   = A.getDimension();
00386         AdataPtr    = (double*)A.getDataPointer();
00387         if(dimension >= 1) M = A[1].getIndexCount();
00388         if(dimension == 2) N = A[2].getIndexCount();
00389         }
00390         else
00391         {
00392         dimension = getDimension();
00393         AdataPtr  = (double*)getDataPointer();
00394         if(dimension >= 1) M = Structure[1].getIndexCount();
00395         if(dimension == 2) N = Structure[2].getIndexCount();
00396         }
00397 
00398         if(dimension == 2)
00399         {
00400         Fflag = CAMgraphics::getFortranArrayFlag();
00401         CAMgraphics::fortranArrayFlagOn();
00402         CAMgraphics::surface(AdataPtr,M,N);
00403         if(Fflag == 0) CAMgraphics::fortranArrayFlagOff();
00404         }
00405         else
00406         {CAMarrayBase::plotDimensionError(A.Structure);}
00407 }
00408 
00409 void  CAMarrayBase::surface(const CAMarrayBase& x, const CAMarrayBase& y) const
00410 {
00411 //
00412 //  Need Conversion Check
00413 //
00414         CAMarrayBase A;
00415         double* AdataPtr;
00416 
00417         long dimension;
00418         long M,N;
00419         int  Fflag;
00420 
00421         CAMarrayBase XC;
00422         double* XCdataPtr;
00423         long    XCdimension;
00424         long    XCcount;
00425 
00426         CAMarrayBase YC;
00427         double* YCdataPtr;
00428         long    YCdimension;
00429         long    YCcount;
00430 
00431         if(Structure.isSubset() == 1)
00432         {
00433         A.initializeMinDuplicate(*this);
00434         dimension   = A.getDimension();
00435         AdataPtr    = (double*)A.getDataPointer();
00436         if(dimension >= 1) M = A[1].getIndexCount();
00437         if(dimension == 2) N = A[2].getIndexCount();
00438         }
00439         else
00440         {
00441         dimension = getDimension();
00442         AdataPtr  = (double*)getDataPointer();
00443         if(dimension >= 1) M = Structure[1].getIndexCount();
00444         if(dimension == 2) N = Structure[2].getIndexCount();
00445         }
00446 
00447         if(x.Structure.isSubset() == 1)
00448         {
00449         XC.initializeMinDuplicate(x);
00450         XCdimension  = x.getDimension();
00451         XCdataPtr    = (double*)x.getDataPointer();
00452         XCcount      = x[1].getIndexCount();
00453         }
00454         else
00455         {
00456         XCdimension  = x.getDimension();
00457         XCdataPtr    = (double*)x.getDataPointer();
00458         XCcount      = x[1].getIndexCount();
00459         }
00460 
00461         if(y.Structure.isSubset() == 1)
00462         {
00463         YC.initializeMinDuplicate(y);
00464         YCdimension  = y.getDimension();
00465         YCdataPtr    = (double*)y.getDataPointer();
00466         YCcount      = y[1].getIndexCount();
00467         }
00468         else
00469         {
00470         YCdimension  = y.getDimension();
00471         YCdataPtr    = (double*)y.getDataPointer();
00472         YCcount      = y[1].getIndexCount();
00473         }
00474 
00475         if(XCdimension != 1)
00476         {CAMarrayBase::ordinateError(x.Structure);}
00477 
00478         if(YCdimension != 1)
00479         {CAMarrayBase::ordinateError(y.Structure);}
00480 
00481         if(M != XCcount)
00482         {CAMarrayBase::ordinateError(x.Structure);}
00483 
00484         if(N != YCcount)
00485         {CAMarrayBase::ordinateError(y.Structure);}
00486 
00487 
00488         if(dimension == 2)
00489         {
00490         Fflag = CAMgraphics::getFortranArrayFlag();
00491         CAMgraphics::fortranArrayFlagOn();
00492         CAMgraphics::surface(AdataPtr,M, N, XCdataPtr, YCdataPtr);
00493         if(Fflag == 0) CAMgraphics::fortranArrayFlagOff();
00494         }
00495         else
00496         {CAMarrayBase::plotDimensionError(A.Structure);}
00497 
00498 }
00499 
00500 void CAMarrayBase::ordinateError(const CAMstructureBase & A) 
00501 {
00502         long i;
00503     cerr << endl;
00504         cerr << "    Ordinates in Plot Command Incorrectly Specified " << endl << endl;
00505         cerr << " Error in Number of Ordinates or Ordinate Array Dimension  " << endl;
00506         cerr << " Ordinates Size :      ";
00507         cerr << A[1].getIndexCount();
00508         for(i = 2; i <= A.dataDimension; i++)
00509         cerr <<  " x " << A[i].getIndexCount() ;
00510         cerr << endl << endl;
00511         CAMmvaExit();
00512 }
00513 void CAMarrayBase::plotDimensionError(const CAMstructureBase& A)
00514 {
00515         long i;
00516     cerr << endl;
00517         cerr << "Error :  Object Dimensions not Compatable with Plot Operation " << endl << endl;
00518         cerr << "    Operand Dimensions :   ";
00519         cerr << A[1].getIndexCount();
00520         for(i = 2; i <= A.dataDimension; i++)
00521         cerr <<  " x " << A[i].getIndexCount() ;
00522         cerr << endl << endl;
00523         CAMmvaExit();
00524 }
00525 //
00526 //********************************************************************************
00527 //                     CPP File End 
00528 //********************************************************************************
00529 //
00530 

Generated on Wed Sep 5 12:54:17 2007 for DSACSS Operational Code by  doxygen 1.3.9.1