00001
00002
00003
00004
00005
00006 #include "mvagph.h"
00007 #include "math.h"
00008 #include "string.h"
00009 #define CAM_PI 3.14159265359
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 CAMmvaGraphics::CAMmvaGraphics() : CAMgraphicsProcess() {}
00020
00021
00022
00023
00024
00025
00026
00027 void CAMmvaGraphics::plot(const CAMvectorBase& V)
00028 {
00029 int p_arg = 0;
00030 int p_style = 0;
00031 int callType = 0;
00032 vectorBasePlot(V,callType, p_arg, p_style);
00033 }
00034
00035 void CAMmvaGraphics::plot(const CAMvectorBase& V, int p_arg)
00036 {
00037 int p_style = 0;
00038 int callType = 1;
00039 vectorBasePlot(V,callType, p_arg, p_style);
00040 }
00041
00042 void CAMmvaGraphics::plot(const CAMvectorBase& V, int p_arg, int p_style)
00043 {
00044 int callType = 2;
00045 vectorBasePlot(V,callType, p_arg, p_style);
00046 }
00047
00048 void CAMmvaGraphics::vectorBasePlot(const CAMvectorBase& V, int callType, int p_arg, int p_style)
00049 {
00050
00051
00052
00053
00054
00055
00056 long M;
00057 CAMvectorBase A;
00058 double* AdataPtr;
00059
00060 if(V.Structure.isSubset() == 1)
00061 {
00062 A.initializeMinDuplicate(V);
00063 AdataPtr = (double*)A.getDataPointer();
00064 M = A.getIndexCount();
00065 }
00066 else
00067 {
00068 AdataPtr = (double*)(V.getDataPointer());
00069 M = V.getIndexCount();
00070 }
00071
00072
00073
00074 CAMgraphicsProcess& G = *this;
00075
00076
00077
00078 switch(callType)
00079 {
00080 case 0 : G.plot(AdataPtr,M); break;
00081 case 1 : G.plot(AdataPtr,M,p_arg); break;
00082 case 2 : G.plot(AdataPtr,M,p_arg,p_style); break;
00083 }
00084 }
00085
00086 void CAMmvaGraphics::plot(const CAMvectorBase& Vx, const CAMvectorBase& Vy)
00087 {
00088 int p_arg = 0;
00089 int p_style = 0;
00090 int callType = 0;
00091 vectorBasePlot(Vx,Vy,callType, p_arg, p_style);
00092 }
00093
00094 void CAMmvaGraphics::plot(const CAMvectorBase& Vx, const CAMvectorBase& Vy, int p_arg)
00095 {
00096 int p_style = 0;
00097 int callType = 1;
00098 vectorBasePlot(Vx,Vy,callType, p_arg, p_style);
00099 }
00100
00101 void CAMmvaGraphics::plot(const CAMvectorBase& Vx, const CAMvectorBase& Vy, int p_arg, int p_style)
00102 {
00103 int callType = 2;
00104 vectorBasePlot(Vx,Vy,callType, p_arg, p_style);
00105 }
00106
00107 void CAMmvaGraphics::vectorBasePlot(const CAMvectorBase& Vx, const CAMvectorBase& Vy,
00108 int callType, int p_arg, int p_style)
00109 {
00110
00111
00112
00113 long M;
00114
00115 CAMvectorBase A;
00116 double* AdataPtr;
00117
00118 CAMvectorBase O;
00119 double* OdataPtr;
00120 long Ocount;
00121
00122 if(Vx.Structure.isSubset() == 1)
00123 {
00124 A.initializeMinDuplicate(Vx);
00125 AdataPtr = (double*)A.getDataPointer();
00126 M = A.getIndexCount();
00127 }
00128 else
00129 {
00130 AdataPtr = (double*)Vx.getDataPointer();
00131 M = Vx.getIndexCount();
00132 }
00133
00134 if(Vy.Structure.isSubset() == 1)
00135 {
00136 O.initializeMinDuplicate(Vy);
00137 OdataPtr = (double*)O.getDataPointer();
00138 Ocount = O.getIndexCount();
00139 }
00140 else
00141 {
00142 OdataPtr = (double*)Vy.getDataPointer();
00143 Ocount = Vy.getIndexCount();
00144 }
00145
00146 if(M != Ocount)
00147 {CAMmvaGraphics::ordinateError(Vy.Structure);}
00148
00149
00150
00151 CAMgraphicsProcess& G = *this;
00152
00153
00154
00155 switch(callType)
00156 {
00157 case 0 : G.plot(AdataPtr,OdataPtr,M); break;
00158 case 1 : G.plot(AdataPtr,OdataPtr,M,p_arg); break;
00159 case 2 : G.plot(AdataPtr,OdataPtr,M,p_arg,p_style); break;
00160 }
00161
00162 }
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 void CAMmvaGraphics::plot(const CAMarrayBase& V)
00181 {
00182 int p_arg = 0;
00183 int p_style = 0;
00184 int callType = 0;
00185 arrayBasePlot(V,callType, p_arg, p_style);
00186 }
00187
00188 void CAMmvaGraphics::plot(const CAMarrayBase& V, int p_arg)
00189 {
00190 int p_style = 0;
00191 int callType = 1;
00192 arrayBasePlot(V,callType, p_arg, p_style);
00193 }
00194
00195 void CAMmvaGraphics::plot(const CAMarrayBase& V, int p_arg, int p_style)
00196 {
00197 int callType = 2;
00198 arrayBasePlot(V,callType, p_arg, p_style);
00199 }
00200
00201 void CAMmvaGraphics::arrayBasePlot(const CAMarrayBase& V, int callType,
00202 int p_arg, int p_style)
00203 {
00204
00205
00206
00207
00208
00209
00210 long M;
00211 CAMarrayBase A;
00212 double* AdataPtr;
00213
00214 long dimension;
00215
00216 if(V.Structure.isSubset() == 1)
00217 {
00218 A.initializeMinDuplicate(V);
00219 dimension = A.getDimension();
00220 AdataPtr = (double*)A.getDataPointer();
00221 M = A[1].getIndexCount();
00222 }
00223 else
00224 {
00225 dimension = V.getDimension();
00226 AdataPtr = (double*)(V.getDataPointer());
00227 M = V[1].getIndexCount();
00228 }
00229
00230 if(dimension != 1) return;
00231
00232
00233
00234 CAMgraphicsProcess& G = *this;
00235
00236
00237
00238 switch(callType)
00239 {
00240 case 0 : G.plot(AdataPtr,M); break;
00241 case 1 : G.plot(AdataPtr,M,p_arg); break;
00242 case 2 : G.plot(AdataPtr,M,p_arg,p_style); break;
00243 }
00244 }
00245
00246 void CAMmvaGraphics::plot(const CAMarrayBase& Vx, const CAMarrayBase& Vy)
00247 {
00248 int p_arg = 0;
00249 int p_style = 0;
00250 int callType = 0;
00251 arrayBasePlot(Vx,Vy,callType, p_arg, p_style);
00252 }
00253
00254 void CAMmvaGraphics::plot(const CAMarrayBase& Vx, const CAMarrayBase& Vy,
00255 int p_arg)
00256 {
00257 int p_style = 0;
00258 int callType = 1;
00259 arrayBasePlot(Vx,Vy,callType, p_arg, p_style);
00260 }
00261
00262 void CAMmvaGraphics::plot(const CAMarrayBase& Vx, const CAMarrayBase& Vy,
00263 int p_arg, int p_style)
00264 {
00265 int callType = 2;
00266 arrayBasePlot(Vx,Vy,callType, p_arg, p_style);
00267 }
00268
00269 void CAMmvaGraphics::arrayBasePlot(const CAMarrayBase& Vx, const CAMarrayBase& Vy,
00270 int callType, int p_arg, int p_style)
00271 {
00272
00273
00274
00275 long dimensionX;
00276 long dimensionY;
00277
00278 long M;
00279
00280 CAMarrayBase A;
00281 double* AdataPtr;
00282
00283 CAMarrayBase O;
00284 double* OdataPtr;
00285 long Ocount;
00286
00287 if(Vx.Structure.isSubset() == 1)
00288 {
00289 A.initializeMinDuplicate(Vx);
00290 dimensionX = A.getDimension();
00291 AdataPtr = (double*)A.getDataPointer();
00292 M = A[1].getIndexCount();
00293 }
00294 else
00295 {
00296 dimensionX = Vx.getDimension();
00297 AdataPtr = (double*)Vx.getDataPointer();
00298 M = Vx[1].getIndexCount();
00299 }
00300
00301 if(Vy.Structure.isSubset() == 1)
00302 {
00303 O.initializeMinDuplicate(Vy);
00304 dimensionY = O.getDimension();
00305 OdataPtr = (double*)O.getDataPointer();
00306 Ocount = O[1].getIndexCount();
00307 }
00308 else
00309 {
00310 dimensionY = Vy.getDimension();
00311 OdataPtr = (double*)Vy.getDataPointer();
00312 Ocount = Vy[1].getIndexCount();
00313 }
00314
00315 if(M != Ocount)
00316 {CAMmvaGraphics::ordinateError(Vy.Structure);}
00317
00318
00319 if((dimensionX != 1)||(dimensionY != 1)) return;
00320
00321
00322
00323
00324 CAMgraphicsProcess& G = *this;
00325
00326
00327
00328 switch(callType)
00329 {
00330 case 0 : G.plot(AdataPtr,OdataPtr,M); break;
00331 case 1 : G.plot(AdataPtr,OdataPtr,M,p_arg); break;
00332 case 2 : G.plot(AdataPtr,OdataPtr,M,p_arg,p_style); break;
00333 }
00334
00335 }
00336
00337
00338
00339
00340
00341
00342
00343 void CAMmvaGraphics::arrayBaseContour(const CAMarrayBase& V, int callType,
00344 int nCntr, double cIncr, double lVal, double hVal, const CAMarrayBase* contourValues)
00345 {
00346
00347
00348
00349
00350
00351
00352 long M; long N;
00353 CAMarrayBase A;
00354 double* AdataPtr;
00355
00356 long dimension;
00357
00358 if(V.Structure.isSubset() == 1)
00359 {
00360 A.initializeMinDuplicate(V);
00361 dimension = A.getDimension();
00362 AdataPtr = (double*)A.getDataPointer();
00363 if(dimension != 2) return;
00364 M = A[1].getIndexCount();
00365 N = A[2].getIndexCount();
00366 }
00367 else
00368 {
00369 dimension = V.getDimension();
00370 AdataPtr = (double*)(V.getDataPointer());
00371 if(dimension != 2) return;
00372 M = V[1].getIndexCount();
00373 N = V[2].getIndexCount();
00374 }
00375
00376
00377
00378 long Ncntr;
00379 CAMarrayBase cntrVal;
00380 double* cntrValDataPtr;
00381
00382 if(contourValues != 0)
00383 {
00384 if((*contourValues).Structure.isSubset() == 1)
00385 {
00386 cntrVal.initializeMinDuplicate(V);
00387 cntrValDataPtr = (double*)cntrVal.getDataPointer();
00388 Ncntr = cntrVal[1].getIndexCount();
00389 }
00390 else
00391 {
00392 cntrValDataPtr = (double*)((*contourValues).getDataPointer());
00393 Ncntr = (*contourValues)[1].getIndexCount();
00394 }
00395 }
00396
00397
00398
00399
00400
00401
00402 double* Cdata = new double[M*N];
00403 long i; long j;
00404 for(i = 0; i < M; i++)
00405 {
00406 for(j = 0; j < N; j++)
00407 {
00408 *(Cdata + j + i*N) = *(AdataPtr + i + j*M);
00409 }}
00410 CAMgraphicsProcess& G = *this;
00411 switch(callType)
00412 {
00413 case 0 : G.contour(Cdata,M,N); break;
00414 case 1 : G.contour(Cdata,M,N,nCntr); break;
00415 case 2 : G.contour(Cdata,M,N,cIncr); break;
00416 case 3 : G.contour(Cdata,M,N,lVal,hVal); break;
00417 case 4 : G.contour(Cdata,M,N,nCntr,lVal,hVal); break;
00418 case 5 : G.contour(Cdata,M,N,cIncr,lVal,hVal); break;
00419 case 6 : G.contour(Cdata,M,N,cntrValDataPtr,Ncntr); break;
00420 }
00421 delete [] Cdata;
00422 }
00423
00424 void CAMmvaGraphics::contour(const CAMarrayBase& V)
00425 {
00426 int callType = 0;
00427 int nCntr = 0;
00428 double cIncr = 0.0;
00429 double lVal = 0.0;
00430 double hVal = 0.0;
00431 CAMarrayBase* contourValues = 0;
00432
00433 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00434
00435 }
00436 void CAMmvaGraphics::contour(const CAMarrayBase& V, int nContour)
00437 {
00438 int callType = 1;
00439 int nCntr = nContour;
00440 double cIncr = 0.0;
00441 double lVal = 0.0;
00442 double hVal = 0.0;
00443 CAMarrayBase* contourValues = 0;
00444
00445 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00446
00447 }
00448
00449 void CAMmvaGraphics::contour(const CAMarrayBase& V, long nContour)
00450 {
00451 int callType = 1;
00452 int nCntr = (int)nContour;
00453 double cIncr = 0.0;
00454 double lVal = 0.0;
00455 double hVal = 0.0;
00456 CAMarrayBase* contourValues = 0;
00457
00458 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00459 }
00460
00461 void CAMmvaGraphics::contour(const CAMarrayBase& V, double increment)
00462 {
00463 int callType = 2;
00464 int nCntr = 0;
00465 double cIncr = increment;
00466 double lVal = 0.0;
00467 double hVal = 0.0;
00468 CAMarrayBase* contourValues = 0;
00469
00470 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00471 }
00472
00473 void CAMmvaGraphics::contour(const CAMarrayBase& V, double low_value,
00474 double high_value)
00475 {
00476 int callType = 3;
00477 int nCntr = 0;
00478 double cIncr = 0.0;
00479 double lVal = low_value;
00480 double hVal = high_value;
00481 CAMarrayBase* contourValues = 0;
00482
00483 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00484
00485
00486 }
00487 void CAMmvaGraphics::contour(const CAMarrayBase& V, int nContour,
00488 double low_value, double high_value)
00489 {
00490 int callType = 4;
00491 int nCntr = nContour;
00492 double cIncr = 0.0;
00493 double lVal = low_value;
00494 double hVal = high_value;
00495 CAMarrayBase* contourValues = 0;
00496
00497 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00498
00499 }
00500 void CAMmvaGraphics::contour(const CAMarrayBase& V, long nContour,
00501 double low_value, double high_value)
00502 {
00503
00504 int callType = 4;
00505 int nCntr = (int)nContour;
00506 double cIncr = 0.0;
00507 double lVal = low_value;
00508 double hVal = high_value;
00509 CAMarrayBase* contourValues = 0;
00510
00511 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00512 }
00513 void CAMmvaGraphics::contour(const CAMarrayBase& V, double increment,
00514 double low_value, double high_value)
00515 {
00516 int callType = 5;
00517 int nCntr = 0;
00518 double cIncr = increment;
00519 double lVal = low_value;
00520 double hVal = high_value;
00521 CAMarrayBase* contourValues = 0;
00522
00523 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00524 }
00525
00526 void CAMmvaGraphics::contour(const CAMarrayBase& V, const CAMarrayBase& cValues)
00527 {
00528 int callType = 6;
00529 int nCntr = 0;
00530 double cIncr = 0.0;
00531 double lVal = 0.0;
00532 double hVal = 0.0;
00533 const CAMarrayBase* contourValues = &cValues;
00534
00535 arrayBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00536 }
00537
00538
00539
00540
00541
00542
00543
00544 void CAMmvaGraphics::arrayBaseSurface(const CAMarrayBase& V, int callType,
00545 const CAMarrayBase* x, const CAMarrayBase* y)
00546 {
00547
00548
00549
00550
00551
00552
00553 long M; long N;
00554 CAMarrayBase A;
00555 double* AdataPtr;
00556
00557 long dimension;
00558
00559 if(V.Structure.isSubset() == 1)
00560 {
00561 A.initializeMinDuplicate(V);
00562 dimension = A.getDimension();
00563 AdataPtr = (double*)A.getDataPointer();
00564 if(dimension != 2) return;
00565 M = A[1].getIndexCount();
00566 N = A[2].getIndexCount();
00567 }
00568 else
00569 {
00570 dimension = V.getDimension();
00571 AdataPtr = (double*)(V.getDataPointer());
00572 if(dimension != 2) return;
00573 M = V[1].getIndexCount();
00574 N = V[2].getIndexCount();
00575 }
00576
00577
00578
00579 long Nx; long Ny;
00580 CAMarrayBase xB;
00581 CAMarrayBase yB;
00582 double* xBDataPtr;
00583 double* yBDataPtr;
00584
00585 if((x != 0)&&(y != 0))
00586 {
00587
00588 if((*x).Structure.isSubset() == 1)
00589 {
00590 xB.initializeMinDuplicate(*x);
00591 xBDataPtr = (double*)xB.getDataPointer();
00592 Nx = xB[1].getIndexCount();
00593 }
00594 else
00595 {
00596 xBDataPtr = (double*)((*x).getDataPointer());
00597 Nx = (*x)[1].getIndexCount();
00598 }
00599
00600 if((*y).Structure.isSubset() == 1)
00601 {
00602 yB.initializeMinDuplicate(*y);
00603 yBDataPtr = (double*)yB.getDataPointer();
00604 Ny = yB[1].getIndexCount();
00605 }
00606 else
00607 {
00608 yBDataPtr = (double*)((*y).getDataPointer());
00609 Ny = (*y)[1].getIndexCount();
00610 }
00611
00612 if(M != Nx)
00613 {CAMmvaGraphics::ordinateError(x->Structure);}
00614
00615 if(N != Ny)
00616 {CAMmvaGraphics::ordinateError(y->Structure);}
00617
00618
00619 }
00620
00621 double* Cdata = new double[M*N];
00622 long i; long j;
00623 for(i = 0; i < M; i++)
00624 {
00625 for(j = 0; j < N; j++)
00626 {
00627 *(Cdata + j + i*N) = *(AdataPtr + i + j*M);
00628 }}
00629
00630 CAMgraphicsProcess& G = *this;
00631 switch(callType)
00632 {
00633 case 0 : G.surface(Cdata,M,N); break;
00634 case 1 : G.surface(Cdata,M,N,xBDataPtr, yBDataPtr); break;
00635 }
00636 delete [] Cdata;
00637 }
00638
00639 void CAMmvaGraphics::surface(const CAMarrayBase& V)
00640 {
00641 int callType = 0;
00642 CAMarrayBase* xP = 0;
00643 CAMarrayBase* yP = 0;
00644 arrayBaseSurface(V, callType, xP, yP);
00645 }
00646 void CAMmvaGraphics::surface(const CAMarrayBase& V,const CAMarrayBase& x,
00647 const CAMarrayBase& y)
00648 {
00649 int callType = 1;
00650 const CAMarrayBase* xP = &x;
00651 const CAMarrayBase* yP = &y;
00652 arrayBaseSurface(V, callType, xP, yP);
00653 }
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675 void CAMmvaGraphics::plot(const CAMmatrixBase& V)
00676 {
00677 int p_arg = 0;
00678 int p_style = 0;
00679 int callType = 0;
00680 matrixBasePlot(V,callType, p_arg, p_style);
00681 }
00682
00683 void CAMmvaGraphics::plot(const CAMmatrixBase& V, int p_arg)
00684 {
00685 int p_style = 0;
00686 int callType = 1;
00687 matrixBasePlot(V,callType, p_arg, p_style);
00688 }
00689
00690 void CAMmvaGraphics::plot(const CAMmatrixBase& V, int p_arg, int p_style)
00691 {
00692 int callType = 2;
00693 matrixBasePlot(V,callType, p_arg, p_style);
00694 }
00695
00696 void CAMmvaGraphics::matrixBasePlot(const CAMmatrixBase& V, int callType,
00697 int p_arg, int p_style)
00698 {
00699
00700
00701
00702
00703
00704
00705 long M;
00706 CAMmatrixBase A;
00707 double* AdataPtr;
00708
00709 long dimension;
00710
00711 if(V.Structure.isSubset() == 1)
00712 {
00713 A.initializeMinDuplicate(V);
00714 dimension = A.getDimension();
00715 AdataPtr = (double*)A.getDataPointer();
00716 M = A[1].getIndexCount();
00717 }
00718 else
00719 {
00720 dimension = V.getDimension();
00721 AdataPtr = (double*)(V.getDataPointer());
00722 M = V[1].getIndexCount();
00723 }
00724
00725 if(dimension != 1) return;
00726
00727
00728
00729 CAMgraphicsProcess& G = *this;
00730
00731
00732
00733 switch(callType)
00734 {
00735 case 0 : G.plot(AdataPtr,M); break;
00736 case 1 : G.plot(AdataPtr,M,p_arg); break;
00737 case 2 : G.plot(AdataPtr,M,p_arg,p_style); break;
00738 }
00739 }
00740
00741 void CAMmvaGraphics::plot(const CAMmatrixBase& Vx, const CAMmatrixBase& Vy)
00742 {
00743 int p_arg = 0;
00744 int p_style = 0;
00745 int callType = 0;
00746 matrixBasePlot(Vx,Vy,callType, p_arg, p_style);
00747 }
00748
00749 void CAMmvaGraphics::plot(const CAMmatrixBase& Vx, const CAMmatrixBase& Vy,
00750 int p_arg)
00751 {
00752 int p_style = 0;
00753 int callType = 1;
00754 matrixBasePlot(Vx,Vy,callType, p_arg, p_style);
00755 }
00756
00757 void CAMmvaGraphics::plot(const CAMmatrixBase& Vx, const CAMmatrixBase& Vy,
00758 int p_arg, int p_style)
00759 {
00760 int callType = 2;
00761 matrixBasePlot(Vx,Vy,callType, p_arg, p_style);
00762 }
00763
00764 void CAMmvaGraphics::matrixBasePlot(const CAMmatrixBase& Vx, const CAMmatrixBase& Vy,
00765 int callType, int p_arg, int p_style)
00766 {
00767
00768
00769
00770 long dimensionX;
00771 long dimensionY;
00772
00773 long M;
00774
00775 CAMmatrixBase A;
00776 double* AdataPtr;
00777
00778 CAMmatrixBase O;
00779 double* OdataPtr;
00780 long Ocount;
00781
00782 if(Vx.Structure.isSubset() == 1)
00783 {
00784 A.initializeMinDuplicate(Vx);
00785 dimensionX = A.getDimension();
00786 AdataPtr = (double*)A.getDataPointer();
00787 M = A[1].getIndexCount();
00788 }
00789 else
00790 {
00791 dimensionX = Vx.getDimension();
00792 AdataPtr = (double*)Vx.getDataPointer();
00793 M = Vx[1].getIndexCount();
00794 }
00795
00796 if(Vy.Structure.isSubset() == 1)
00797 {
00798 O.initializeMinDuplicate(Vy);
00799 dimensionY = O.getDimension();
00800 OdataPtr = (double*)O.getDataPointer();
00801 Ocount = O[1].getIndexCount();
00802 }
00803 else
00804 {
00805 dimensionY = Vy.getDimension();
00806 OdataPtr = (double*)Vy.getDataPointer();
00807 Ocount = Vy[1].getIndexCount();
00808 }
00809
00810 if(M != Ocount)
00811 {CAMmvaGraphics::ordinateError(Vy.Structure);}
00812
00813
00814 if((dimensionX != 1)||(dimensionY != 1)) return;
00815
00816
00817
00818
00819 CAMgraphicsProcess& G = *this;
00820
00821
00822
00823 switch(callType)
00824 {
00825 case 0 : G.plot(AdataPtr,OdataPtr,M); break;
00826 case 1 : G.plot(AdataPtr,OdataPtr,M,p_arg); break;
00827 case 2 : G.plot(AdataPtr,OdataPtr,M,p_arg,p_style); break;
00828 }
00829
00830 }
00831
00832
00833
00834
00835
00836
00837
00838 void CAMmvaGraphics::matrixBaseContour(const CAMmatrixBase& V, int callType,
00839 int nCntr, double cIncr, double lVal, double hVal, const CAMmatrixBase* contourValues)
00840 {
00841
00842
00843
00844
00845
00846
00847 long M; long N;
00848 double* AdataPtr;
00849
00850 CAMdoubleMatrix B = V;
00851 CAMdoubleMatrix A = V;
00852
00853 M = A[1].getIndexCount();
00854 N = A[2].getIndexCount();
00855
00856 long i;
00857 for(i = 1; i <= M; i++)
00858 {A(i,_) = B(M - (i-1),_);}
00859
00860 AdataPtr = A.getDataPointer();
00861
00862
00863
00864
00865
00866
00867
00868
00869 long Ncntr;
00870 CAMmatrixBase cntrVal;
00871 double* cntrValDataPtr;
00872
00873 if(contourValues != 0)
00874 {
00875 if((*contourValues).Structure.isSubset() == 1)
00876 {
00877 cntrVal.initializeMinDuplicate(V);
00878 cntrValDataPtr = (double*)cntrVal.getDataPointer();
00879 Ncntr = cntrVal[1].getIndexCount();
00880 }
00881 else
00882 {
00883 cntrValDataPtr = (double*)((*contourValues).getDataPointer());
00884 Ncntr = (*contourValues)[1].getIndexCount();
00885 }
00886 }
00887
00888
00889
00890
00891
00892
00893 CAMgraphicsProcess& G = *this;
00894 switch(callType)
00895 {
00896 case 0 : G.contour(AdataPtr,N,M); break;
00897 case 1 : G.contour(AdataPtr,N,M,nCntr); break;
00898 case 2 : G.contour(AdataPtr,N,M,cIncr); break;
00899 case 3 : G.contour(AdataPtr,N,M,lVal,hVal); break;
00900 case 4 : G.contour(AdataPtr,N,M,nCntr,lVal,hVal); break;
00901 case 5 : G.contour(AdataPtr,N,M,cIncr,lVal,hVal); break;
00902 case 6 : G.contour(AdataPtr,N,M,cntrValDataPtr,Ncntr); break;
00903 }
00904
00905 }
00906
00907 void CAMmvaGraphics::contour(const CAMmatrixBase& V)
00908 {
00909 int callType = 0;
00910 int nCntr = 0;
00911 double cIncr = 0.0;
00912 double lVal = 0.0;
00913 double hVal = 0.0;
00914 CAMmatrixBase* contourValues = 0;
00915
00916 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00917
00918 }
00919 void CAMmvaGraphics::contour(const CAMmatrixBase& V, int nContour)
00920 {
00921 int callType = 1;
00922 int nCntr = nContour;
00923 double cIncr = 0.0;
00924 double lVal = 0.0;
00925 double hVal = 0.0;
00926 CAMmatrixBase* contourValues = 0;
00927
00928 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00929
00930 }
00931
00932 void CAMmvaGraphics::contour(const CAMmatrixBase& V, long nContour)
00933 {
00934 int callType = 1;
00935 int nCntr = (int)nContour;
00936 double cIncr = 0.0;
00937 double lVal = 0.0;
00938 double hVal = 0.0;
00939 CAMmatrixBase* contourValues = 0;
00940
00941 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00942 }
00943
00944 void CAMmvaGraphics::contour(const CAMmatrixBase& V, double increment)
00945 {
00946 int callType = 2;
00947 int nCntr = 0;
00948 double cIncr = increment;
00949 double lVal = 0.0;
00950 double hVal = 0.0;
00951 CAMmatrixBase* contourValues = 0;
00952
00953 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00954 }
00955
00956 void CAMmvaGraphics::contour(const CAMmatrixBase& V, double low_value,
00957 double high_value)
00958 {
00959 int callType = 3;
00960 int nCntr = 0;
00961 double cIncr = 0.0;
00962 double lVal = low_value;
00963 double hVal = high_value;
00964 CAMmatrixBase* contourValues = 0;
00965
00966 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00967
00968
00969 }
00970 void CAMmvaGraphics::contour(const CAMmatrixBase& V, int nContour,
00971 double low_value, double high_value)
00972 {
00973 int callType = 4;
00974 int nCntr = nContour;
00975 double cIncr = 0.0;
00976 double lVal = low_value;
00977 double hVal = high_value;
00978 CAMmatrixBase* contourValues = 0;
00979
00980 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00981
00982 }
00983 void CAMmvaGraphics::contour(const CAMmatrixBase& V, long nContour,
00984 double low_value, double high_value)
00985 {
00986
00987 int callType = 4;
00988 int nCntr = (int)nContour;
00989 double cIncr = 0.0;
00990 double lVal = low_value;
00991 double hVal = high_value;
00992 CAMmatrixBase* contourValues = 0;
00993
00994 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
00995 }
00996 void CAMmvaGraphics::contour(const CAMmatrixBase& V, double increment,
00997 double low_value, double high_value)
00998 {
00999 int callType = 5;
01000 int nCntr = 0;
01001 double cIncr = increment;
01002 double lVal = low_value;
01003 double hVal = high_value;
01004 CAMmatrixBase* contourValues = 0;
01005
01006 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
01007 }
01008
01009 void CAMmvaGraphics::contour(const CAMmatrixBase& V, const CAMmatrixBase& cValues)
01010 {
01011 int callType = 6;
01012 int nCntr = 0;
01013 double cIncr = 0.0;
01014 double lVal = 0.0;
01015 double hVal = 0.0;
01016 const CAMmatrixBase* contourValues = &cValues;
01017
01018 matrixBaseContour(V, callType, nCntr, cIncr, lVal, hVal, contourValues);
01019 }
01020
01021
01022
01023
01024
01025
01026
01027 void CAMmvaGraphics::matrixBaseSurface(const CAMmatrixBase& V, int callType,
01028 const CAMmatrixBase* x, const CAMmatrixBase* y)
01029 {
01030
01031
01032
01033
01034
01035
01036 long M; long N;
01037 CAMmatrixBase A;
01038 double* AdataPtr;
01039
01040 long dimension;
01041
01042 if(V.Structure.isSubset() == 1)
01043 {
01044 A.initializeMinDuplicate(V);
01045 dimension = A.getDimension();
01046 AdataPtr = (double*)A.getDataPointer();
01047 if(dimension != 2) return;
01048 M = A[1].getIndexCount();
01049 N = A[2].getIndexCount();
01050 }
01051 else
01052 {
01053 dimension = V.getDimension();
01054 AdataPtr = (double*)(V.getDataPointer());
01055 if(dimension != 2) return;
01056 M = V[1].getIndexCount();
01057 N = V[2].getIndexCount();
01058 }
01059
01060
01061
01062 long Nx; long Ny;
01063 CAMmatrixBase xB;
01064 CAMmatrixBase yB;
01065 double* xBDataPtr;
01066 double* yBDataPtr;
01067
01068 if((x != 0)&&(y != 0))
01069 {
01070
01071 if((*x).Structure.isSubset() == 1)
01072 {
01073 xB.initializeMinDuplicate(*x);
01074 xBDataPtr = (double*)xB.getDataPointer();
01075 Nx = xB[1].getIndexCount();
01076 }
01077 else
01078 {
01079 xBDataPtr = (double*)((*x).getDataPointer());
01080 Nx = (*x)[1].getIndexCount();
01081 }
01082
01083 if((*y).Structure.isSubset() == 1)
01084 {
01085 yB.initializeMinDuplicate(*y);
01086 yBDataPtr = (double*)yB.getDataPointer();
01087 Ny = yB[1].getIndexCount();
01088 }
01089 else
01090 {
01091 yBDataPtr = (double*)((*y).getDataPointer());
01092 Ny = (*y)[1].getIndexCount();
01093 }
01094
01095 if(M != Nx)
01096 {CAMmvaGraphics::ordinateError(x->Structure);}
01097
01098 if(N != Ny)
01099 {CAMmvaGraphics::ordinateError(y->Structure);}
01100
01101
01102 }
01103
01104
01105
01106
01107
01108
01109 CAMgraphicsProcess& G = *this;
01110 switch(callType)
01111 {
01112 case 0 : G.surface(AdataPtr,N,M); break;
01113 case 1 : G.surface(AdataPtr,N,M,xBDataPtr, yBDataPtr); break;
01114 }
01115 }
01116
01117 void CAMmvaGraphics::surface(const CAMmatrixBase& V)
01118 {
01119 int callType = 0;
01120 CAMmatrixBase* xP = 0;
01121 CAMmatrixBase* yP = 0;
01122 matrixBaseSurface(V, callType, xP, yP);
01123 }
01124 void CAMmvaGraphics::surface(const CAMmatrixBase& V,const CAMmatrixBase& x,
01125 const CAMmatrixBase& y)
01126 {
01127 int callType = 1;
01128 const CAMmatrixBase* xP = &x;
01129 const CAMmatrixBase* yP = &y;
01130 matrixBaseSurface(V, callType, xP, yP);
01131 }
01132
01133 void CAMmvaGraphics::ordinateError(const CAMstructureBase & A)
01134 {
01135 long i;
01136 cerr << endl;
01137 cerr << " Ordinates in Plot Command Incorrectly Specified " << endl << endl;
01138 cerr << " Error in Number of Ordinates or Ordinate Array Dimension " << endl;
01139 cerr << " Ordinates Size : ";
01140 cerr << A[1].getIndexCount();
01141 for(i = 2; i <= A.dataDimension; i++)
01142 cerr << " x " << A[i].getIndexCount() ;
01143 cerr << endl << endl;
01144 CAMmvaExit();
01145 }
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155