void CAMmatrixBase::surface() const { // // Need Conversion Check // CAMmatrixBase A; double* AdataPtr; long dimension; long M,N; int Fflag; if(Structure.isSubset() == 1) { A.initializeMinDuplicate(*this); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); if(dimension >= 1) M = A[1].getIndexCount(); if(dimension == 2) N = A[2].getIndexCount(); } else { dimension = getDimension(); AdataPtr = (double*)getDataPointer(); if(dimension >= 1) M = Structure[1].getIndexCount(); if(dimension == 2) N = Structure[2].getIndexCount(); } if(dimension == 2) { Fflag = CAMgraphics::getFortranArrayFlag(); CAMgraphics::fortranArrayFlagOn(); CAMgraphics::surface(AdataPtr,M,N); if(Fflag == 0) CAMgraphics::fortranArrayFlagOff(); } else {CAMmatrixBase::plotDimensionError(A.Structure);} }
void CAMmvaGraphics::matrixBasePlot(const CAMmatrixBase& V, int callType, int p_arg, int p_style) { // // Need Conversion Check // // // extract data from vector // long M; CAMmatrixBase A; double* AdataPtr; long dimension; if(V.Structure.isSubset() == 1) { A.initializeMinDuplicate(V); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); M = A[1].getIndexCount(); } else { dimension = V.getDimension(); AdataPtr = (double*)(V.getDataPointer()); M = V[1].getIndexCount(); } if(dimension != 1) return; // // get reference to the graphics base class // CAMgraphicsProcess& G = *this; // // plot // switch(callType) { case 0 : G.plot(AdataPtr,M); break; case 1 : G.plot(AdataPtr,M,p_arg); break; case 2 : G.plot(AdataPtr,M,p_arg,p_style); break; } }
void CAMmatrixBase::surface(const CAMmatrixBase& x, const CAMmatrixBase& y) const { // // Need Conversion Check // CAMmatrixBase A; double* AdataPtr; long dimension; long M,N; int Fflag; CAMmatrixBase XC; double* XCdataPtr; long XCdimension; long XCcount; CAMmatrixBase YC; double* YCdataPtr; long YCdimension; long YCcount; if(Structure.isSubset() == 1) { A.initializeMinDuplicate(*this); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); if(dimension >= 1) M = A[1].getIndexCount(); if(dimension == 2) N = A[2].getIndexCount(); } else { dimension = getDimension(); AdataPtr = (double*)getDataPointer(); if(dimension >= 1) M = Structure[1].getIndexCount(); if(dimension == 2) N = Structure[2].getIndexCount(); } if(x.Structure.isSubset() == 1) { XC.initializeMinDuplicate(x); XCdimension = x.getDimension(); XCdataPtr = (double*)x.getDataPointer(); XCcount = x[1].getIndexCount(); } else { XCdimension = x.getDimension(); XCdataPtr = (double*)x.getDataPointer(); XCcount = x[1].getIndexCount(); } if(y.Structure.isSubset() == 1) { YC.initializeMinDuplicate(y); YCdimension = y.getDimension(); YCdataPtr = (double*)y.getDataPointer(); YCcount = y[1].getIndexCount(); } else { YCdimension = y.getDimension(); YCdataPtr = (double*)y.getDataPointer(); YCcount = y[1].getIndexCount(); } if(XCdimension != 1) {CAMmatrixBase::ordinateError(x.Structure);} if(YCdimension != 1) {CAMmatrixBase::ordinateError(y.Structure);} if(M != XCcount) {CAMmatrixBase::ordinateError(x.Structure);} if(N != YCcount) {CAMmatrixBase::ordinateError(y.Structure);} if(dimension == 2) { Fflag = CAMgraphics::getFortranArrayFlag(); CAMgraphics::fortranArrayFlagOn(); CAMgraphics::surface(AdataPtr,M, N, XCdataPtr, YCdataPtr); if(Fflag == 0) CAMgraphics::fortranArrayFlagOff(); } else {CAMmatrixBase::plotDimensionError(A.Structure);} }
void CAMmatrixBase::contour(const CAMmatrixBase& contourValues) const { // // Need Conversion Check // CAMmatrixBase A; double* AdataPtr; long dimension; long M,N; int Fflag; CAMmatrixBase CV; double* CVdataPtr; long CVdimension; long CVcount; if(Structure.isSubset() == 1) { A.initializeMinDuplicate(*this); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); if(dimension >= 1) M = A[1].getIndexCount(); if(dimension == 2) N = A[2].getIndexCount(); } else { dimension = getDimension(); AdataPtr = (double*)getDataPointer(); if(dimension >= 1) M = Structure[1].getIndexCount(); if(dimension == 2) N = Structure[2].getIndexCount(); } if(contourValues.Structure.isSubset() == 1) { CV.initializeMinDuplicate(contourValues); CVdimension = CV.getDimension(); CVdataPtr = (double*)CV.getDataPointer(); CVcount = CV[1].getIndexCount(); } else { CVdimension = contourValues.getDimension(); CVdataPtr = (double*)contourValues.getDataPointer(); CVcount = contourValues[1].getIndexCount(); } if(CVdimension != 1) {CAMmatrixBase::ordinateError(contourValues.Structure);} if(dimension == 2) { Fflag = CAMgraphics::getFortranArrayFlag(); CAMgraphics::fortranArrayFlagOn(); CAMgraphics::contour(AdataPtr,M,N,CVdataPtr,CVcount); if(Fflag == 0) CAMgraphics::fortranArrayFlagOff(); } else {CAMmatrixBase::plotDimensionError(A.Structure);} }
void CAMmatrixBase::plot() const { // // Need Conversion Check // long dimension; long M,N; const CAMmatrixBase* InputPtr; CAMmatrixBase A; double* AdataPtr; double* BdataPtr; long j; int autoFlag; double x_min, x_max, y_min, y_max; if(Structure.isSubset() == 1) { A.initializeMinDuplicate(*this); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); if(dimension >= 1) M = A[1].getIndexCount(); if(dimension == 2) N = A[2].getIndexCount(); InputPtr = &A; } else { dimension = getDimension(); AdataPtr = (double*)getDataPointer(); if(dimension >= 1) M = Structure[1].getIndexCount(); if(dimension == 2) N = Structure[2].getIndexCount(); InputPtr = this; } switch (dimension) { case 1 : CAMgraphics::plot(AdataPtr,M); break; case 2 : autoFlag = CAMgraphics::getAutoScaleFlag(); x_min = 1; x_max = M; y_min = InputPtr->min(); y_max = InputPtr->max(); CAMgraphics::axis(x_min,x_max,y_min,y_max); for(j = 1; j <= N; j++) { BdataPtr = AdataPtr + (j-1)*M; CAMgraphics::plot(BdataPtr,M); } CAMgraphics::axis(autoFlag); break; default : CAMmatrixBase::plotDimensionError(A.Structure); } }
void CAMmatrixBase::plot(const CAMmatrixBase& Ordinates) const { // // Need Conversion Check // long dimension; long M,N; CAMmatrixBase A; const CAMmatrixBase* InputPtr; double* AdataPtr; double* BdataPtr; long j; int autoFlag; double x_min, x_max, y_min, y_max; CAMmatrixBase O; double* OdataPtr; long Odimension; long Ocount; // if(Structure.isSubset() == 1) { A.initializeMinDuplicate(*this); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); if(dimension >= 1) M = A[1].getIndexCount(); if(dimension == 2) N = A[2].getIndexCount(); InputPtr = &A; } else { dimension = getDimension(); AdataPtr = (double*)getDataPointer(); if(dimension >= 1) M = Structure[1].getIndexCount(); if(dimension == 2) N = Structure[2].getIndexCount(); InputPtr = this; } if(Ordinates.Structure.isSubset() == 1) { O.initializeMinDuplicate(Ordinates); Odimension = O.getDimension(); OdataPtr = (double*)O.getDataPointer(); Ocount = O[1].getIndexCount(); } else { Odimension = Ordinates.getDimension(); OdataPtr = (double*)Ordinates.getDataPointer(); Ocount = Ordinates[1].getIndexCount(); } if(Odimension != 1) {CAMmatrixBase::ordinateError(Ordinates.Structure);} if(M != Ocount) {CAMmatrixBase::ordinateError(Ordinates.Structure);} switch (dimension) { case 1 : CAMgraphics::plot(OdataPtr,AdataPtr,M); break; case 2 : autoFlag = CAMgraphics::getAutoScaleFlag(); x_min = *OdataPtr; x_max = *(OdataPtr +(M-1)); y_min = InputPtr->min(); y_max = InputPtr->max(); CAMgraphics::axis(x_min,x_max,y_min,y_max); for(j = 1; j <= N; j++) { BdataPtr = AdataPtr + (j-1)*M; CAMgraphics::plot(OdataPtr, BdataPtr,M); } CAMgraphics::axis(autoFlag); break; default : CAMmatrixBase::plotDimensionError(A.Structure); } }
// //****************************************************************************** //****************************************************************************** // CONTOUR //****************************************************************************** //****************************************************************************** // void CAMmvaGraphics::matrixBaseContour(const CAMmatrixBase& V, int callType, int nCntr, double cIncr, double lVal, double hVal, const CAMmatrixBase* contourValues) { // // Need Conversion Check // // // Unpack data (transfrom to doubleArray so I can use _ notation) // long M; long N; double* AdataPtr; CAMdoubleMatrix B = V; CAMdoubleMatrix A = V; M = A[1].getIndexCount(); N = A[2].getIndexCount(); long i; for(i = 1; i <= M; i++) {A(i,_) = B(M - (i-1),_);} AdataPtr = A.getDataPointer(); // // Repack the data so that the (1,1) element is the upper left; not the // lower left // // // Unpack contour values if required // long Ncntr; CAMmatrixBase cntrVal; double* cntrValDataPtr; if(contourValues != 0) { if((*contourValues).Structure.isSubset() == 1) { cntrVal.initializeMinDuplicate(V); cntrValDataPtr = (double*)cntrVal.getDataPointer(); Ncntr = cntrVal[1].getIndexCount(); } else { cntrValDataPtr = (double*)((*contourValues).getDataPointer()); Ncntr = (*contourValues)[1].getIndexCount(); } } // // get reference to the graphics base class // // // Contour Plot // CAMgraphicsProcess& G = *this; switch(callType) { case 0 : G.contour(AdataPtr,N,M); break; case 1 : G.contour(AdataPtr,N,M,nCntr); break; case 2 : G.contour(AdataPtr,N,M,cIncr); break; case 3 : G.contour(AdataPtr,N,M,lVal,hVal); break; case 4 : G.contour(AdataPtr,N,M,nCntr,lVal,hVal); break; case 5 : G.contour(AdataPtr,N,M,cIncr,lVal,hVal); break; case 6 : G.contour(AdataPtr,N,M,cntrValDataPtr,Ncntr); break; } }
void CAMmvaGraphics::matrixBasePlot(const CAMmatrixBase& Vx, const CAMmatrixBase& Vy, int callType, int p_arg, int p_style) { // // Need Conversion Check // long dimensionX; long dimensionY; long M; CAMmatrixBase A; double* AdataPtr; CAMmatrixBase O; double* OdataPtr; long Ocount; if(Vx.Structure.isSubset() == 1) { A.initializeMinDuplicate(Vx); dimensionX = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); M = A[1].getIndexCount(); } else { dimensionX = Vx.getDimension(); AdataPtr = (double*)Vx.getDataPointer(); M = Vx[1].getIndexCount(); } if(Vy.Structure.isSubset() == 1) { O.initializeMinDuplicate(Vy); dimensionY = O.getDimension(); OdataPtr = (double*)O.getDataPointer(); Ocount = O[1].getIndexCount(); } else { dimensionY = Vy.getDimension(); OdataPtr = (double*)Vy.getDataPointer(); Ocount = Vy[1].getIndexCount(); } if(M != Ocount) {CAMmvaGraphics::ordinateError(Vy.Structure);} if((dimensionX != 1)||(dimensionY != 1)) return; // // get reference to the graphics base class // CAMgraphicsProcess& G = *this; // // plot // switch(callType) { case 0 : G.plot(AdataPtr,OdataPtr,M); break; case 1 : G.plot(AdataPtr,OdataPtr,M,p_arg); break; case 2 : G.plot(AdataPtr,OdataPtr,M,p_arg,p_style); break; } }
// //****************************************************************************** //****************************************************************************** // SURFACE //****************************************************************************** //****************************************************************************** // void CAMmvaGraphics::matrixBaseSurface(const CAMmatrixBase& V, int callType, const CAMmatrixBase* x, const CAMmatrixBase* y) { // // Need Conversion Check // // // Unpack data // long M; long N; CAMmatrixBase A; double* AdataPtr; long dimension; if(V.Structure.isSubset() == 1) { A.initializeMinDuplicate(V); dimension = A.getDimension(); AdataPtr = (double*)A.getDataPointer(); if(dimension != 2) return; M = A[1].getIndexCount(); N = A[2].getIndexCount(); } else { dimension = V.getDimension(); AdataPtr = (double*)(V.getDataPointer()); if(dimension != 2) return; M = V[1].getIndexCount(); N = V[2].getIndexCount(); } // // Unpack axis values if required // long Nx; long Ny; CAMmatrixBase xB; CAMmatrixBase yB; double* xBDataPtr; double* yBDataPtr; if((x != 0)&&(y != 0)) { if((*x).Structure.isSubset() == 1) { xB.initializeMinDuplicate(*x); xBDataPtr = (double*)xB.getDataPointer(); Nx = xB[1].getIndexCount(); } else { xBDataPtr = (double*)((*x).getDataPointer()); Nx = (*x)[1].getIndexCount(); } if((*y).Structure.isSubset() == 1) { yB.initializeMinDuplicate(*y); yBDataPtr = (double*)yB.getDataPointer(); Ny = yB[1].getIndexCount(); } else { yBDataPtr = (double*)((*y).getDataPointer()); Ny = (*y)[1].getIndexCount(); } if(M != Nx) {CAMmvaGraphics::ordinateError(x->Structure);} if(N != Ny) {CAMmvaGraphics::ordinateError(y->Structure);} } // // get reference to the graphics base class // // // Contour Plot // CAMgraphicsProcess& G = *this; switch(callType) { case 0 : G.surface(AdataPtr,N,M); break; case 1 : G.surface(AdataPtr,N,M,xBDataPtr, yBDataPtr); break; } }