arraybse.cpp

Go to the documentation of this file.
00001 #include "arraybse.h"
00002 #include "vecbse.h"
00003 #include "matbse.h"
00004 #include "bnengine.h"
00005 
00006 //
00007 //***************************************************************
00008 //                    ARRAYBSE.CPP
00009 //***************************************************************
00010 //
00011 //
00012 //*****************************************************************
00013 //
00014 //            Chris Anderson
00015 //
00016 //            Mon Sep 11 12:49:20 1995
00017 //
00018 //*****************************************************************
00019 //
00020 //
00021 //*****************************************************************
00022 //                    CONSTRUCTORS
00023 //*****************************************************************
00024 //
00025 //
00026 //*****************************************************************
00027 //               
00028 //*****************************************************************
00029 //
00030 CAMarrayBase::CAMarrayBase()
00031 : Structure()
00032 {
00033     DataP                   = 0;
00034     typeValue               = 0;
00035     referenceFlag           = 0;
00036     arrayBaseReferenceCount = 0;
00037 }
00038 
00039 CAMarrayBase::CAMarrayBase(int d_type)
00040 : Structure()
00041 {
00042     DataP                   = 0;
00043     typeValue               = d_type;
00044     referenceFlag           = 0;
00045     arrayBaseReferenceCount = 0;
00046 }
00047 
00048 CAMarrayBase::CAMarrayBase(const CAMarrayBase& A)
00049 :Structure(A.Structure)
00050 {
00051     if(A.DataP == 0)
00052     {DataP = 0;}
00053     else
00054     {
00055      if(A.referenceFlag == 1)
00056      {DataP = A.DataP; }
00057      else if(A.DataP->getTemporaryFlag() == 1)
00058      {
00059       DataP = new CAMdataHandler(*(A.DataP));
00060       DataP ->setReferenceCount(1);
00061      }
00062      else
00063      {
00064       A.Structure.initializeMinStructure(Structure);
00065       DataP = new CAMdataHandler(Structure.getFullDataCount(),A.DataP->getDataType());
00066       DataP->setReferenceCount(1);
00067       //
00068       //  copy based on type
00069       //
00070       CAMbinaryEngine::doubleAequalToB(Structure, *DataP, A.Structure, *A.DataP);
00071       //
00072       //
00073       //
00074      }
00075     }
00076     typeValue               = A.typeValue;
00077     referenceFlag           = 0;
00078     arrayBaseReferenceCount = 0;
00079 }
00080 
00081 CAMarrayBase::CAMarrayBase(int d_type, const CAMrange& R1, const CAMrange& R2 ,
00082                         const CAMrange& R3 , const CAMrange&R4 , 
00083                         const CAMrange& R5 , const CAMrange&R6 ,
00084                         const CAMrange& R7)
00085 :Structure(R1,R2,R3,R4,R5,R6,R7)
00086 {
00087      DataP = new CAMdataHandler(Structure.getFullDataCount(),d_type);
00088      DataP->setReferenceCount(1);
00089      typeValue               = d_type;
00090      referenceFlag           = 0;
00091      arrayBaseReferenceCount = 0;
00092 }
00093 
00094 //
00095 //*****************************************************************
00096 //                    DESTRUCTOR
00097 //*****************************************************************
00098 //
00099 CAMarrayBase::~CAMarrayBase()
00100 {
00101     if(DataP != 0)
00102     {
00103     DataP->decrementReferenceCount();
00104     if(DataP->getReferenceCount() < 0)
00105     {
00106     cerr << " Error : Reference Count < 0" << endl;
00107     }
00108     if(DataP->getReferenceCount() == 0) delete DataP;
00109     }
00110 }
00111 //
00112 //*****************************************************************
00113 //                    ASSIGNMENT
00114 //*****************************************************************
00115 //
00116 void CAMarrayBase::operator =(double value)
00117 {
00118 //
00119 //  NEED CONVERSION CHECK
00120 //
00121     if(DataP == 0)
00122     {
00123     Structure.initialize(_(1,1));
00124     DataP = new CAMdataHandler(1,CAMType::typeDouble);
00125     DataP->setReferenceCount(1);
00126     referenceFlag  = 0;
00127     arrayBaseReferenceCount = 0;
00128     }
00129     else
00130     {
00131     CAMstructureBase AStructure(_(1,1));
00132     if(Structure.isConformingTo(AStructure) != 1)
00133     {CAMarrayBase::nonConformingMessage(Structure,AStructure);}
00134     }
00135 
00136     CAMbinaryEngine::doubleAequalToAlpha(Structure, *DataP, value);
00137 }
00138 void  CAMarrayBase::operator =( const CAMarrayBase& A)
00139 {
00140 //
00141 //  NEED CONVERSION CHECK
00142 //
00143     if(DataP == 0)
00144     {
00145     A.Structure.initializeMinStructure(Structure);
00146     DataP = new CAMdataHandler(Structure.getFullDataCount(),typeValue);
00147     DataP->setReferenceCount(1);
00148     typeValue               = CAMType::typeDouble;
00149     referenceFlag           = 0;
00150     arrayBaseReferenceCount = 0;
00151     }
00152     else
00153     {
00154     if(Structure.isConformingTo(A.Structure) != 1)
00155     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00156     }
00157 
00158     CAMbinaryEngine::doubleAequalToB(Structure, *DataP, A.Structure, *A.DataP);
00159 }
00160 ostream& operator <<(ostream& out_stream, const CAMarrayBase& A)
00161 {
00162     const long* beginPtr  = A.Structure.indexBegin.getDataPointer();
00163     const long* endPtr    = A.Structure.indexEnd.getDataPointer();
00164     const long* stridePtr = A.Structure.indexStride.getDataPointer();
00165     long i1, i2, i3, i4, i5, i6, i7;
00166     long i;
00167 
00168     int  saveWidth=out_stream.width();
00169     double OutValue;
00170 //
00171 //  NEED CONVERSION CHECK
00172 //
00173     switch(A.Structure.dataDimension)
00174     {
00175     case 1 :
00176     for(i1 = *beginPtr; i1 <= *endPtr; i1+= *stridePtr)
00177     {
00178      out_stream.width(saveWidth);
00179      OutValue =*((double*)A.getDataPointer(i1));
00180      if(OutValue < 0 )
00181      out_stream << OutValue <<" ";
00182      else
00183      out_stream << " " << OutValue <<" ";
00184 
00185 //    out_stream << *((double*)A.getDataPointer(i1)) << " ";
00186     }
00187     break;
00188 
00189     case 2 :
00190 //
00191 //  Use orientation of first quadrant of a cartesian grid.
00192 //
00193     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00194         i >= 1; i--)
00195     {
00196     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00197 
00198     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00199     {
00200      out_stream.width(saveWidth);
00201      OutValue =*((double*)A.getDataPointer(i1,i2));
00202      if(OutValue < 0 )
00203      out_stream << OutValue <<" ";
00204      else
00205      out_stream << " " << OutValue <<" ";
00206 
00207 //   out_stream << *((double*)A.getDataPointer(i1,i2)) << " ";
00208     }
00209     out_stream << endl;
00210     }
00211 
00212     break;
00213 
00214     case 3 :
00215     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00216     {
00217     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00218         i >= 1; i--)
00219     {
00220     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00221 
00222     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00223     {
00224 
00225      out_stream.width(saveWidth);
00226      OutValue =*((double*)A.getDataPointer(i1,i2,i3));
00227      if(OutValue < 0 )
00228      out_stream << OutValue <<" ";
00229      else
00230      out_stream << " " << OutValue <<" ";
00231 
00232 //    out_stream << *((double*)A.getDataPointer(i1,i2,i3)) << " ";
00233     }
00234     out_stream << endl;
00235     }
00236     out_stream << endl << endl;
00237     }
00238 
00239     break;
00240 
00241     case 4 :
00242 
00243     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00244     {
00245     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00246     {
00247     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00248         i >= 1; i--)
00249     {
00250     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00251 
00252     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00253     {
00254      out_stream.width(saveWidth);
00255      OutValue =*((double*)A.getDataPointer(i1,i2,i3,i4));
00256      if(OutValue < 0 )
00257      out_stream << OutValue <<" ";
00258      else
00259      out_stream << " " << OutValue <<" ";
00260 
00261 //    out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4)) << " ";
00262     }
00263     out_stream << endl;
00264     }
00265     out_stream << endl << endl;
00266     }
00267     out_stream << endl << endl;
00268     }
00269 
00270     break;
00271 
00272     case 5 :
00273 
00274     for(i5 = *(beginPtr + 4); i5 <= *(endPtr + 4); i5+= *(stridePtr + 4))
00275     {
00276     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00277     {
00278     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00279     {
00280     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00281         i >= 1; i--)
00282     {
00283     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00284 
00285     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00286     {
00287 
00288      out_stream.width(saveWidth);
00289      OutValue =*((double*)A.getDataPointer(i1,i2,i3,i4,i5));
00290      if(OutValue < 0 )
00291      out_stream << OutValue <<" ";
00292      else
00293      out_stream << " " << OutValue <<" ";
00294 
00295 //    out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4,i5)) << " ";
00296     }
00297     out_stream << endl;
00298     }
00299     out_stream << endl << endl;
00300     }
00301     out_stream << endl << endl;
00302     }
00303     out_stream << endl << endl;
00304     }
00305 
00306     case 6 :
00307 
00308     for(i6 = *(beginPtr + 5); i6 <= *(endPtr + 5); i6+= *(stridePtr + 5))
00309     {
00310     for(i5 = *(beginPtr + 4); i5 <= *(endPtr + 4); i5+= *(stridePtr + 4))
00311     {
00312     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00313     {
00314     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00315     {
00316     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00317         i >= 1; i--)
00318     {
00319     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00320 
00321     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00322     {
00323      out_stream.width(saveWidth);
00324      OutValue =*((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6));
00325      if(OutValue < 0 )
00326      out_stream << OutValue <<" ";
00327      else
00328      out_stream << " " << OutValue <<" ";
00329 
00330 //   out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6)) << " ";
00331     }
00332     out_stream << endl;
00333     }
00334     out_stream << endl << endl;
00335     }
00336     out_stream << endl << endl;
00337     }
00338     out_stream << endl << endl;
00339     }
00340     out_stream << endl << endl;
00341     }
00342     break;
00343 
00344 
00345     case 7 :
00346 
00347     for(i7 = *(beginPtr + 6); i7 <= *(endPtr + 6); i7+= *(stridePtr + 6))
00348     {
00349     for(i6 = *(beginPtr + 5); i6 <= *(endPtr + 5); i6+= *(stridePtr + 5))
00350     {
00351     for(i5 = *(beginPtr + 4); i5 <= *(endPtr + 4); i5+= *(stridePtr + 4))
00352     {
00353     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00354     {
00355     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00356     {
00357     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00358         i >= 1; i--)
00359     {
00360     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00361 
00362     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00363     {
00364 
00365      out_stream.width(saveWidth);
00366      OutValue =*((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6,i7));
00367      if(OutValue < 0 )
00368      out_stream << OutValue <<" ";
00369      else
00370      out_stream << " " << OutValue <<" ";
00371 
00372 //     out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6,i7)) << " ";
00373     }
00374     out_stream << endl;
00375     }
00376     out_stream << endl << endl;
00377     }
00378     out_stream << endl << endl;
00379     }
00380     out_stream << endl << endl;
00381     }
00382     out_stream << endl << endl;
00383     }
00384     out_stream << endl << endl;
00385     }
00386     break;
00387     }
00388     return(out_stream);
00389 
00390 }
00391 istream& operator >>(istream& in_stream, CAMarrayBase& A)
00392 {
00393     const long* beginPtr  = A.Structure.indexBegin.getDataPointer();
00394     const long* endPtr    = A.Structure.indexEnd.getDataPointer();
00395     const long* stridePtr = A.Structure.indexStride.getDataPointer();
00396     long i1, i2, i3, i4, i5, i6, i7;
00397     long i;
00398 
00399     if( A.Structure.getFullDataCount() == 0)
00400     {CAMarrayBase::nullOperandError(">>");}
00401 //
00402 //  NEED CONVERSION CHECK
00403 //
00404     switch(A.Structure.dataDimension)
00405     {
00406     case 1 :
00407     for(i1 = *beginPtr; i1 <= *endPtr; i1+= *stridePtr)
00408     {
00409      if( !( in_stream >> *((double*)A.getDataPointer(i1))))
00410      CAMarrayBase::inputSizeError();
00411 
00412 //    out_stream << *((double*)A.getDataPointer(i1)) << " ";
00413     }
00414     break;
00415 
00416     case 2 :
00417 //
00418 //  Use orientation of first quadrant of a cartesian grid.
00419 //
00420     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00421         i >= 1; i--)
00422     {
00423     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00424 
00425     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00426     {
00427      if( !( in_stream >> *((double*)A.getDataPointer(i1,i2))))
00428      CAMarrayBase::inputSizeError();
00429 
00430 //   out_stream << *((double*)A.getDataPointer(i1,i2)) << " ";
00431     }}
00432 
00433     break;
00434 
00435     case 3 :
00436     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00437     {
00438     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00439         i >= 1; i--)
00440     {
00441     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00442 
00443     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00444     {
00445 
00446      if( !( in_stream >> *((double*)A.getDataPointer(i1,i2,i3))))
00447      CAMarrayBase::inputSizeError();
00448 
00449 //    out_stream << *((double*)A.getDataPointer(i1,i2,i3)) << " ";
00450     }}}
00451 
00452     break;
00453 
00454     case 4 :
00455 
00456     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00457     {
00458     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00459     {
00460     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00461         i >= 1; i--)
00462     {
00463     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00464 
00465     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00466     {
00467      if( !( in_stream >> *((double*)A.getDataPointer(i1,i2,i3,i4))))
00468      CAMarrayBase::inputSizeError();
00469 
00470 //    out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4)) << " ";
00471     }}}}
00472 
00473     break;
00474 
00475     case 5 :
00476 
00477     for(i5 = *(beginPtr + 4); i5 <= *(endPtr + 4); i5+= *(stridePtr + 4))
00478     {
00479     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00480     {
00481     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00482     {
00483     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00484         i >= 1; i--)
00485     {
00486     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00487 
00488     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00489     {
00490 
00491      if( !( in_stream >> *((double*)A.getDataPointer(i1,i2,i3,i4,i5))))
00492      CAMarrayBase::inputSizeError();
00493 
00494 //    out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4,i5)) << " ";
00495     }}}}}
00496 
00497     case 6 :
00498 
00499     for(i6 = *(beginPtr + 5); i6 <= *(endPtr + 5); i6+= *(stridePtr + 5))
00500     {
00501     for(i5 = *(beginPtr + 4); i5 <= *(endPtr + 4); i5+= *(stridePtr + 4))
00502     {
00503     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00504     {
00505     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00506     {
00507     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00508         i >= 1; i--)
00509     {
00510     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00511 
00512     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00513     {
00514 
00515      if( !( in_stream >> *((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6))))
00516      CAMarrayBase::inputSizeError();
00517 
00518 //   out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6)) << " ";
00519     }}}}}}
00520     break;
00521 
00522 
00523     case 7 :
00524 
00525     for(i7 = *(beginPtr + 6); i7 <= *(endPtr + 6); i7+= *(stridePtr + 6))
00526     {
00527     for(i6 = *(beginPtr + 5); i6 <= *(endPtr + 5); i6+= *(stridePtr + 5))
00528     {
00529     for(i5 = *(beginPtr + 4); i5 <= *(endPtr + 4); i5+= *(stridePtr + 4))
00530     {
00531     for(i4 = *(beginPtr + 3); i4 <= *(endPtr + 3); i4+= *(stridePtr + 3))
00532     {
00533     for(i3 = *(beginPtr + 2); i3 <= *(endPtr + 2); i3+= *(stridePtr + 2))
00534     {
00535     for(i = ((*(endPtr +1) - *(beginPtr +1))/(*(stridePtr + 1))) + 1;
00536         i >= 1; i--)
00537     {
00538     i2 = *(beginPtr +1) + (i-1)*(*(stridePtr + 1));
00539 
00540     for(i1 = *beginPtr; i1 <= *endPtr; i1 += *stridePtr)
00541     {
00542 
00543      if( !( in_stream >> *((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6,i7))))
00544      CAMarrayBase::inputSizeError();
00545 
00546 //     out_stream << *((double*)A.getDataPointer(i1,i2,i3,i4,i5,i6,i7)) << " ";
00547     }}}}}}}
00548     break;
00549     }
00550     return(in_stream);
00551 
00552 }
00553 
00554 //
00555 //*****************************************************************
00556 //             INITIALIZATION MEMBER_FUNCTIONS
00557 //*****************************************************************
00558 //
00559 
00560 void  CAMarrayBase::initialize()
00561 {
00562     Structure.initialize();
00563     if(DataP != 0)
00564      {
00565       DataP->decrementReferenceCount();
00566       if(DataP->getReferenceCount() == 0) delete DataP;
00567      }
00568     DataP = 0;
00569     typeValue      = 0;
00570     referenceFlag  = 0;
00571     arrayBaseReferenceCount = 0;
00572 }
00573 
00574 void  CAMarrayBase::initialize(int d_type)
00575 {
00576     Structure.initialize();
00577     if(DataP != 0)
00578      {
00579       DataP->decrementReferenceCount();
00580       if(DataP->getReferenceCount() == 0) delete DataP;
00581      }
00582     DataP = 0;
00583     typeValue      = d_type;
00584     referenceFlag  = 0;
00585     arrayBaseReferenceCount = 0;
00586 }
00587 
00588 void  CAMarrayBase::initialize(const CAMarrayBase& A)
00589 {
00590 //
00591 //  NEED CONVERSION CHECK
00592 //
00593     if(DataP != 0)
00594     {
00595     DataP->decrementReferenceCount();
00596     if(DataP->getReferenceCount() == 0) delete DataP;
00597     }
00598 
00599     if(A.DataP != 0)
00600     {
00601     A.Structure.initializeMinStructure(Structure);
00602 
00603     DataP = new CAMdataHandler(Structure.getFullDataCount(),A.DataP->getDataType());
00604     DataP->setReferenceCount(1);
00605     CAMbinaryEngine::doubleAequalToB(Structure, *DataP, A.Structure, *A.DataP);
00606     }
00607     else
00608     {
00609     DataP = 0;
00610     Structure.initialize();
00611     }
00612 
00613     typeValue      = A.typeValue;
00614     referenceFlag  = 0;
00615     arrayBaseReferenceCount = 0;
00616 }
00617 
00618 void  CAMarrayBase::initialize(int d_type, const CAMrange& R1, const CAMrange& R2 ,
00619                         const CAMrange& R3 , const CAMrange&R4 ,
00620                         const CAMrange& R5 , const CAMrange&R6 ,
00621                         const CAMrange& R7 )
00622 {
00623      Structure.initialize(R1,R2,R3,R4,R5,R6,R7);
00624 
00625      if(DataP != 0)
00626      {
00627      DataP->decrementReferenceCount();
00628      if(DataP->getReferenceCount() == 0) delete DataP;
00629      }
00630 
00631      DataP = new CAMdataHandler(Structure.getFullDataCount(),d_type);
00632      DataP->setReferenceCount(1);
00633      typeValue               = d_type;
00634      referenceFlag           = 0;
00635      arrayBaseReferenceCount = 0;
00636 }
00637 
00638 //
00639 //***************************************************************
00640 //                    ARRAYOPS.CPP
00641 //***************************************************************
00642 //
00643 //
00644 //*****************************************************************
00645 //
00646 void  CAMarrayBase::initializeReturnArgument(const CAMarrayBase& A)
00647 {
00648     A.Structure.initializeMinStructure(Structure);
00649     DataP = new CAMdataHandler(Structure.getFullDataCount(),A.DataP->getDataType());
00650     DataP->setReferenceCount(1);
00651 }
00652 void  CAMarrayBase::initializeReturnArgument(const CAMstructureBase& S, int dataT)
00653 {
00654     S.initializeMinStructure(Structure);
00655     DataP = new CAMdataHandler(Structure.getFullDataCount(), dataT);
00656     DataP->setReferenceCount(1);
00657 }
00658 void  CAMarrayBase::initializeMinDuplicate(const CAMarrayBase& A)
00659 {
00660 
00661     if(A.DataP == 0) return;
00662 
00663     long i;
00664     long icount    = 0;
00665     long dimension = 0;
00666 
00667     for(i = 1; i <= A.Structure.getDimension(); i++)
00668     if(A.Structure[i].getIndexCount() != 1) dimension++;
00669 
00670 
00671     if(dimension == 0) dimension = 1;
00672     Structure.initialize(dimension);
00673 
00674 
00675     for(i = 1; i <= A.Structure.getDimension(); i++)
00676     {
00677       if(A.Structure[i].getIndexCount() != 1)
00678       {
00679       Structure.indexBegin[icount]     = 1;
00680       Structure.indexBeginBase[icount] = 1;
00681       Structure.indexEndBase[icount]   = A.Structure[i].getIndexCount();
00682       Structure.indexEnd[icount]       = A.Structure[i].getIndexCount();
00683       Structure.indexStride[icount]    = 1;
00684       icount++;
00685       }
00686     }
00687 
00688     if(icount == 0)
00689     {
00690     Structure.indexBegin[icount]     = 1;
00691     Structure.indexBeginBase[icount] = 1;
00692     Structure.indexEndBase[icount]   = 1;
00693     Structure.indexEnd[icount]       = 1;
00694     Structure.indexStride[icount]    = 1;
00695     }
00696     DataP = new CAMdataHandler(Structure.getFullDataCount(), A.typeValue);
00697     DataP->setReferenceCount(1);
00698 //
00699 //  copy over data
00700 //
00701     *this = A;
00702 }
00703 //
00704 //*****************************************************************
00705 //                    Operators
00706 //*****************************************************************
00707 //
00708 CAMarrayBase CAMarrayBase::operator-() const
00709 {
00710 //
00711 //  NEED CONVERSION CHECK
00712 //
00713     CAMarrayBase S;
00714     S.initializeReturnArgument(*this);
00715 
00716     CAMbinaryEngine::doubleAequalToMinusB(S.Structure, *S.DataP, Structure, *DataP);
00717     S.setTemporaryFlag();
00718     return S;
00719 }
00720 
00721 CAMarrayBase CAMarrayBase::operator+(const CAMarrayBase& A) const
00722 {
00723     if(Structure.isConformingTo(A.Structure) != 1)
00724     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00725 //
00726 //  NEED CONVERSION CHECK
00727 //
00728     CAMarrayBase S;
00729     S.initializeReturnArgument(A.Structure,A.DataP->getDataType());
00730 
00731     CAMbinaryEngine::doubleCequalAplusB(Structure, *DataP, A.Structure, *A.DataP,
00732     S.Structure, *S.DataP);
00733 
00734     S.setTemporaryFlag();
00735     return S;
00736 }
00737 CAMarrayBase CAMarrayBase::operator-(const CAMarrayBase& A) const
00738 {
00739     if(Structure.isConformingTo(A.Structure) != 1)
00740     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00741 //
00742 //  NEED CONVERSION CHECK
00743 //
00744     CAMarrayBase S;
00745     S.initializeReturnArgument(A.Structure,A.DataP->getDataType());
00746 
00747     CAMbinaryEngine::doubleCequalAminusB(Structure, *DataP, A.Structure, *A.DataP,
00748     S.Structure, *S.DataP);
00749 
00750     S.setTemporaryFlag();
00751     return S;
00752 }
00753 CAMarrayBase CAMarrayBase::operator*(const CAMarrayBase& A) const
00754 {
00755     if(Structure.isConformingTo(A.Structure) != 1)
00756     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00757 //
00758 //  NEED CONVERSION CHECK
00759 //
00760     CAMarrayBase S;
00761     S.initializeReturnArgument(A);
00762 
00763     CAMbinaryEngine::doubleCequalAtimesB(Structure, *DataP, A.Structure, *A.DataP,
00764     S.Structure, *S.DataP);
00765 
00766     S.setTemporaryFlag();
00767     return S;
00768 }
00769 CAMarrayBase CAMarrayBase::operator/(const CAMarrayBase& A) const
00770 {
00771     if(Structure.isConformingTo(A.Structure) != 1)
00772     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00773 //
00774 //  NEED CONVERSION CHECK
00775 //
00776     CAMarrayBase S;
00777     S.initializeReturnArgument(A);
00778 
00779     CAMbinaryEngine::doubleCequalAdivideB(Structure, *DataP, A.Structure, *A.DataP,
00780     S.Structure, *S.DataP);
00781 
00782     S.setTemporaryFlag();
00783     return S;
00784 }
00785 //
00786 //*****************************************************************
00787 //                    op = Operators
00788 //*****************************************************************
00789 //
00790 
00791 void CAMarrayBase::operator+=(const CAMarrayBase& A)
00792 {
00793     if(Structure.isConformingTo(A.Structure) != 1)
00794     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00795 //
00796 //  NEED CONVERSION CHECK
00797 //
00798 
00799     CAMbinaryEngine::doubleAplusEqualB(Structure, *DataP, A.Structure, *A.DataP);
00800 }
00801 void CAMarrayBase::operator-=(const CAMarrayBase& A)
00802 {
00803     if(Structure.isConformingTo(A.Structure) != 1)
00804     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00805 //
00806 //  NEED CONVERSION CHECK
00807 //
00808 
00809     CAMbinaryEngine::doubleAminusEqualB(Structure, *DataP, A.Structure, *A.DataP);
00810 }
00811 void CAMarrayBase::operator*=(const CAMarrayBase& A)
00812 {
00813     if(Structure.isConformingTo(A.Structure) != 1)
00814     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00815 //
00816 //  NEED CONVERSION CHECK
00817 //
00818 
00819     CAMbinaryEngine::doubleAtimesEqualB(Structure, *DataP, A.Structure, *A.DataP);
00820 }
00821 
00822 void CAMarrayBase::operator/=(const CAMarrayBase& A)
00823 {
00824     if(Structure.isConformingTo(A.Structure) != 1)
00825     {CAMarrayBase::nonConformingMessage(Structure,A.Structure);}
00826 //
00827 //  NEED CONVERSION CHECK
00828 //
00829 
00830     CAMbinaryEngine::doubleAdivideEqualB(Structure, *DataP, A.Structure, *A.DataP);
00831 }
00832 //
00833 //*****************************************************************
00834 //                    Operations with Scalers
00835 //*****************************************************************
00836 //
00837 CAMarrayBase  CAMarrayBase::operator +(const double value) const
00838 {
00839 //
00840 //  NEED CONVERSION CHECK
00841 //
00842     CAMstructureBase AStructure(_(1,1));
00843     if(Structure.isConformingTo(AStructure) != 1)
00844     {CAMarrayBase::nonConformingMessage(Structure,AStructure);}
00845 
00846     CAMarrayBase S(*this);
00847     CAMbinaryEngine::doubleAplusEqualAlpha(S.Structure, *(S.DataP), value);
00848 
00849     S.setTemporaryFlag();
00850     return S;
00851 }
00852 CAMarrayBase  operator +(const double value, const CAMarrayBase& A)
00853 {
00854 //
00855 //  NEED CONVERSION CHECK
00856 //
00857     CAMstructureBase  BStructure(_(1,1));
00858     if(A.Structure.isConformingTo(BStructure) != 1)
00859     {CAMarrayBase::nonConformingMessage(A.Structure,BStructure);}
00860 
00861     CAMarrayBase S(A);
00862     CAMbinaryEngine::doubleAplusEqualAlpha(S.Structure, *(S.DataP), value);
00863 
00864     S.setTemporaryFlag();
00865     return S;
00866 }
00867 
00868 CAMarrayBase  CAMarrayBase::operator -(const double value) const
00869 {
00870 //
00871 //  NEED CONVERSION CHECK
00872 //
00873     CAMstructureBase AStructure(_(1,1));
00874     if(Structure.isConformingTo(AStructure) != 1)
00875     {CAMarrayBase::nonConformingMessage(Structure,AStructure);}
00876 
00877     CAMarrayBase S(*this);
00878     CAMbinaryEngine::doubleAminusEqualAlpha(S.Structure, *(S.DataP), value);
00879 
00880     S.setTemporaryFlag();
00881     return S;
00882 }
00883 
00884 CAMarrayBase  operator -(const double value, const CAMarrayBase& A)
00885 {
00886 //
00887 //  NEED CONVERSION CHECK
00888 //
00889     CAMstructureBase  BStructure(_(1,1));
00890     if(A.Structure.isConformingTo(BStructure) != 1)
00891     {CAMarrayBase::nonConformingMessage(A.Structure,BStructure);}
00892 
00893     CAMarrayBase S(A);
00894     CAMbinaryEngine::doubleAminusEqualAlpha(S.Structure, *(S.DataP), value);
00895 
00896     S.setTemporaryFlag();
00897     return S;
00898 }
00899 
00900 void  CAMarrayBase::operator +=(const double value)
00901 {
00902 //
00903 //  NEED CONVERSION CHECK
00904 //
00905     CAMstructureBase AStructure(_(1,1));
00906     if(Structure.isConformingTo(AStructure) != 1)
00907     {CAMarrayBase::nonConformingMessage(Structure,AStructure);}
00908 
00909     CAMbinaryEngine::doubleAplusEqualAlpha(Structure, *(DataP), value);
00910 }
00911 
00912 void  CAMarrayBase::operator -=(const double value)
00913 {
00914 //
00915 //  NEED CONVERSION CHECK
00916 //
00917     CAMstructureBase AStructure(_(1,1));
00918     if(Structure.isConformingTo(AStructure) != 1)
00919     {CAMarrayBase::nonConformingMessage(Structure,AStructure);}
00920 
00921     CAMbinaryEngine::doubleAminusEqualAlpha(Structure, *(DataP), value);
00922 }
00923 
00924 CAMarrayBase  CAMarrayBase::operator*(double value) const
00925 {
00926 //
00927 //  NEED CONVERSION CHECK
00928 //
00929     CAMarrayBase S(*this);
00930     CAMbinaryEngine::doubleAtimesEqualAlpha(S.Structure, *S.DataP, value);
00931     S.setTemporaryFlag();
00932     return S;
00933 }
00934 
00935 CAMarrayBase  operator *(double value, const CAMarrayBase& A)
00936 {
00937 //
00938 //  NEED CONVERSION CHECK
00939 //
00940     CAMarrayBase S(A);
00941     CAMbinaryEngine::doubleAtimesEqualAlpha(S.Structure, *S.DataP, value);
00942     S.setTemporaryFlag();
00943     return S;
00944 }
00945 
00946 CAMarrayBase  CAMarrayBase::operator /(double value) const
00947 {
00948 //
00949 //  NEED CONVERSION CHECK
00950 //
00951     CAMarrayBase S(*this);
00952     CAMbinaryEngine::doubleAdivideEqualAlpha(S.Structure, *S.DataP, value);
00953     S.setTemporaryFlag();
00954     return S;
00955 }
00956 
00957 CAMarrayBase  operator /(double value, const CAMarrayBase& A)
00958 {
00959 //
00960 //  NEED CONVERSION CHECK
00961 //
00962     CAMarrayBase S(A);
00963     CAMbinaryEngine::doubleAdivideEqualAlpha(S.Structure, *S.DataP, value);
00964     S.setTemporaryFlag();
00965     return S;
00966 }
00967 
00968 void  CAMarrayBase::operator *=(double value)
00969 {
00970 //
00971 //  NEED CONVERSION CHECK
00972 //
00973     CAMbinaryEngine::doubleAtimesEqualAlpha(Structure, *DataP, value);
00974 }
00975 
00976 void  CAMarrayBase::operator /=(double value)
00977 {
00978     CAMbinaryEngine::doubleAdivideEqualAlpha(Structure, *DataP, value);
00979 }
00980 
00981 
00982 
00983 void  CAMarrayBase::setToValue(double value)
00984 {
00985 //
00986 //  NEED CONVERSION CHECK
00987 //
00988     CAMbinaryEngine::doubleAequalToAlpha(Structure, *DataP, value);
00989 }
00990 
00991 CAMarrayBase  CAMarrayBase::plusValue(double value)
00992 {
00993 //
00994 //  NEED CONVERSION CHECK
00995 //
00996     CAMarrayBase S(*this);
00997     CAMbinaryEngine::doubleAplusEqualAlpha(S.Structure, *S.DataP, value);
00998      S.setTemporaryFlag();
00999     return S;
01000 }
01001 
01002 CAMarrayBase  CAMarrayBase::minusValue(double value)
01003 {
01004 //
01005 //  NEED CONVERSION CHECK
01006 //
01007     CAMarrayBase S(*this);
01008     CAMbinaryEngine::doubleAminusEqualAlpha(S.Structure, *S.DataP, value);
01009     S.setTemporaryFlag();
01010     return S;
01011 }
01012 
01013 //
01014 //*****************************************************************
01015 //            Temporary and Reference Utilities
01016 //*****************************************************************
01017 //
01018 void  CAMarrayBase::exchangeContentsWith(CAMarrayBase& B)
01019 {
01020 //
01021 //  This routine exchanges the contents of *this with B.
01022 //  The routine is typically used with *this input as
01023 //  a null object and B a temporary object (i.e. the result
01024 //  of an operator or function which returns B with the
01025 //  temporary flag set). In such a case, the contents of
01026 //  B are captured by *this --- resulting in a transfer of the
01027 //  results without invoking a data copy.
01028 //
01029 //
01030     CAMstructureBase S_temp(Structure);
01031     CAMdataHandler*  DataP_temp        = DataP;
01032     int  typeValue_temp                = typeValue;
01033     int  referenceFlag_temp            = referenceFlag;
01034     long  arrayBaseReferenceCount_temp = arrayBaseReferenceCount;
01035 
01036     Structure.initialize(B.Structure);
01037     DataP                   = B.DataP;
01038     typeValue               = B.typeValue;
01039     referenceFlag           = B.referenceFlag;
01040     arrayBaseReferenceCount = B.arrayBaseReferenceCount;
01041 //
01042     B.Structure.initialize(S_temp);
01043     B.DataP                   = DataP_temp;
01044     B.typeValue               = typeValue_temp;
01045     B.referenceFlag           = referenceFlag_temp;
01046     B.arrayBaseReferenceCount = arrayBaseReferenceCount_temp;
01047 }
01048 
01049 void  CAMarrayBase::initializeReferenceDuplicate(const CAMarrayBase& B)
01050 {
01051 //
01052 //  This routine initializes *this with the contents of B and
01053 //  and sets the *this reference flag.  This results in a
01054 //  class instance whose data is that associated with B.
01055 //
01056 //  Typically this routine is used in a container class which
01057 //  contains arrays --- and one wants to have sub-array access
01058 //  for the contained class which is based upon the sub-array
01059 //  access of the array class. 
01060 //
01061     if(DataP != 0)
01062     {
01063     DataP->decrementReferenceCount();
01064      if(DataP->getReferenceCount() == 0) delete DataP;
01065     }
01066 
01067     Structure.initialize(B.Structure);
01068     DataP                   = B.DataP;
01069     DataP->incrementReferenceCount();  //One Reference for local copy
01070     DataP->incrementReferenceCount();  //One Reference for compiler copy
01071     typeValue               = B.typeValue;
01072     referenceFlag           = 1;
01073     arrayBaseReferenceCount = 0;
01074 }
01075 //
01076 //*****************************************************************
01077 //                    CONVERSIONS
01078 //*****************************************************************
01079 //
01080 CAMmatrixBase  CAMarrayBase::asMatrix() const
01081 {
01082     CAMmatrixBase S;
01083     if(DataP == 0) return S;
01084 
01085     CAMrange R1; CAMrange R2;
01086     long i;
01087     long dimension = 0;
01088 
01089     for(i = 1; i <= getDimension(); i++)
01090     {
01091     if(Structure[i].getIndexCount() != 1)
01092     {
01093     dimension++;
01094     if(dimension == 1)
01095     R1.initialize(Structure[i].getIndexBase(),Structure[i].getIndexBound());
01096     if(dimension == 2)
01097     R2.initialize(Structure[i].getIndexBase(),Structure[i].getIndexBound());
01098     }
01099     }
01100     switch (dimension)
01101     {
01102     case 0 :
01103     R1.initialize(Structure[1].getIndexBase(),Structure[1].getIndexBound());
01104     R2.initialize(Structure[1].getIndexBaseBase(),Structure[1].getIndexBaseBase());
01105     break;
01106 
01107     case 1 :
01108     R2.initialize(Structure[1].getIndexBaseBase(),Structure[1].getIndexBaseBase());
01109     break;
01110 
01111     case 2 :
01112     break;
01113     default :
01114     CAMarrayBase::objectConversionError(Structure);
01115     }
01116 //
01117 //
01118     S.initialize(CAMType::typeDouble, R1,R2);
01119     CAMbinaryEngine::doubleAequalToB(S.Structure, *(S.DataP), Structure, *DataP);
01120 //
01121 //
01122     S.setTemporaryFlag();
01123     return S;
01124 }
01125 CAMvectorBase  CAMarrayBase::asVector() const
01126 {
01127     CAMvectorBase S;
01128     if(DataP == 0) return S;
01129 
01130     CAMrange R1;
01131     long i;
01132     long dimension = 0;
01133 
01134     for(i = 1; i <= getDimension(); i++)
01135     {
01136     if(Structure[i].getIndexCount() != 1)
01137     {
01138     dimension++;
01139     if(dimension == 1)
01140     R1.initialize(Structure[i].getIndexBase(),Structure[i].getIndexBound());
01141     }
01142     }
01143     switch (dimension)
01144     {
01145     case 0 :
01146     R1.initialize(Structure[1].getIndexBase(),Structure[1].getIndexBound());
01147     break;
01148 
01149     case 1 :
01150     break;
01151     default :
01152     CAMarrayBase::objectConversionError(Structure);
01153 
01154     }
01155 //
01156 //
01157     S.initialize(CAMType::typeDouble, R1);
01158     CAMbinaryEngine::doubleAequalToB(S.Structure, *(S.DataP), Structure, *DataP);
01159 //
01160 //
01161     S.setTemporaryFlag();
01162     return S;
01163 }
01164 //
01165 //*****************************************************************
01166 //                    DIMENSION SELECTION
01167 //*****************************************************************
01168 //
01169 CAMstructureBase&  CAMarrayBase::operator[](long i)
01170 {
01171     if((i < 0)||(i > Structure.dataDimension))
01172     {CAMstructureBase::illegalDimension(i, Structure.dataDimension);}
01173 
01174     Structure.exchangeReferenceIndex(i);
01175 
01176     return  Structure;
01177 }
01178 
01179 const CAMstructureBase&  CAMarrayBase::operator[](long i) const
01180 {
01181     if((i < 0)||(i > Structure.dataDimension))
01182     {CAMstructureBase::illegalDimension(i, Structure.dataDimension);}
01183 
01184     Structure.exchangeReferenceIndex(i);
01185 
01186     return  Structure;
01187 }
01188 //
01189 //********************************************************************************
01190 //                    Array Helper Functions
01191 //********************************************************************************
01192 //
01193 void*  CAMarrayBase::getDataPointer(long i1, long i2, long i3, long i4,
01194 long i5, long i6, long i7) const
01195 {
01196     const long* beginPtr  = Structure.indexBeginBase.getDataPointer();
01197     const long* endPtr    = Structure.indexEndBase.getDataPointer();
01198     long  i[7];
01199 
01200     i[0] = i1; i[1] = i2; i[2] = i3; i[3] = i4;
01201     i[4] = i5; i[5] = i6; i[6] = i7;
01202 //
01203 //  NEED CONVERSION CHECK
01204 //
01205     double* dataPtr =  (double*)(DataP->dataPointer);
01206 
01207     long offset;
01208     offset  = (i[Structure.dataDimension - 1]
01209             - *(beginPtr + (Structure.dataDimension - 1)));
01210     for(long j = Structure.dataDimension - 2; j >= 0; j--)
01211     {
01212     offset = (i[j] - *(beginPtr + j)) +
01213     offset*((*(endPtr + j) - *(beginPtr + j)) + 1);
01214     }
01215 
01216     return (void*)(dataPtr + offset);
01217 }
01218 //
01219 //********************************************************************************
01220 //                    Reference Counting Functions
01221 //********************************************************************************
01222 //
01223 
01224 void  CAMarrayBase::incrementReferenceCount()
01225 {
01226     if(arrayBaseReferenceCount == 0) CAMarrayBase::referenceCountError();
01227     arrayBaseReferenceCount++;
01228 }
01229 
01230 void  CAMarrayBase::referenceCountError()
01231 {
01232 cerr << " Cannot Use Reference Counting on Objects New\'d by the Compiler " << endl;
01233 CAMmvaExit();
01234 }
01235 //
01236 //*****************************************************************
01237 //                    MEMBER_FUNCTIONS
01238 //*****************************************************************
01239 //
01240 
01241 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1)
01242 {
01243     if(S.dataDimension != 1)
01244     {
01245      cerr << " Error : Incorrect Array Index Dimension " << endl;
01246      cerr << " Object Dimension = " << S.dataDimension
01247           << " --- Dimension Used = "<< 1 << endl;
01248      CAMmvaExit();
01249      }
01250      const long* indexBeginP = S.indexBegin.getDataPointer();
01251      const long* indexEndP = S.indexEnd.getDataPointer();
01252      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01253      {
01254      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01255      }
01256 }
01257 
01258 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1, long i2)
01259 {
01260     if(S.dataDimension != 2)
01261     {
01262      cerr << " Error : Incorrect Array Index Dimension " << endl;
01263      cerr << " Object Dimension = " << S.dataDimension
01264           << "--- Dimension Used = "<< 2 << endl;
01265      CAMmvaExit();
01266      }
01267      const long* indexBeginP = S.indexBegin.getDataPointer();
01268      const long* indexEndP = S.indexEnd.getDataPointer();
01269      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01270      {
01271      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01272      }
01273      if((i2 < *(indexBeginP +1))||(i2 > *(indexEndP+1)))
01274      {
01275      CAMarrayBase::indexErrorMessage(2, *(indexBeginP+1), *(indexEndP+1), i2);
01276      }
01277 }
01278 
01279 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1, long i2, long i3)
01280 {
01281     if(S.dataDimension != 3)
01282     {
01283      cerr << " Error : Incorrect Array Index Dimension " << endl;
01284      cerr << " Object Dimension = " << S.dataDimension
01285           << "--- Dimension Used = "<< 3 << endl;
01286      CAMmvaExit();
01287      }
01288      const long* indexBeginP = S.indexBegin.getDataPointer();
01289      const long* indexEndP = S.indexEnd.getDataPointer();
01290      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01291      {
01292      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01293      }
01294      if((i2 < *(indexBeginP +1))||(i2 > *(indexEndP+1)))
01295      {
01296      CAMarrayBase::indexErrorMessage(2, *(indexBeginP+1), *(indexEndP+1), i2);
01297      }
01298      if((i3 < *(indexBeginP +2))||(i3 > *(indexEndP+2)))
01299      {
01300      CAMarrayBase::indexErrorMessage(3, *(indexBeginP+2), *(indexEndP+2), i3);
01301      }
01302 }
01303 
01304 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1, long i2, long i3, long i4)
01305 {
01306     if(S.dataDimension != 4)
01307     {
01308      cerr << " Error : Incorrect Array Index Dimension " << endl;
01309      cerr << " Object Dimension = " << S.dataDimension
01310           << "--- Dimension Used = "<< 4 << endl;
01311      CAMmvaExit();
01312      }
01313      const long* indexBeginP = S.indexBegin.getDataPointer();
01314      const long* indexEndP = S.indexEnd.getDataPointer();
01315      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01316      {
01317      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01318      }
01319      if((i2 < *(indexBeginP +1))||(i2 > *(indexEndP+1)))
01320      {
01321      CAMarrayBase::indexErrorMessage(2, *(indexBeginP+1), *(indexEndP+1), i2);
01322      }
01323      if((i3 < *(indexBeginP +2))||(i3 > *(indexEndP+2)))
01324      {
01325      CAMarrayBase::indexErrorMessage(3, *(indexBeginP+2), *(indexEndP+2), i3);
01326      }
01327      if((i4 < *(indexBeginP +3))||(i4 > *(indexEndP+3)))
01328      {
01329      CAMarrayBase::indexErrorMessage(4, *(indexBeginP+3), *(indexEndP+3), i4);
01330      }
01331 
01332 }
01333 
01334 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1, long i2, long i3, long i4, long i5)
01335 {
01336     if(S.dataDimension != 5)
01337     {
01338      cerr << " Error : Incorrect Array Index Dimension " << endl;
01339      cerr << " Object Dimension = " << S.dataDimension
01340           << "--- Dimension Used = "<< 5 << endl;
01341      CAMmvaExit();
01342      }
01343      const long* indexBeginP = S.indexBegin.getDataPointer();
01344      const long* indexEndP = S.indexEnd.getDataPointer();
01345      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01346      {
01347      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01348      }
01349      if((i2 < *(indexBeginP +1))||(i2 > *(indexEndP+1)))
01350      {
01351      CAMarrayBase::indexErrorMessage(2, *(indexBeginP+1), *(indexEndP+1), i2);
01352      }
01353      if((i3 < *(indexBeginP +2))||(i3 > *(indexEndP+2)))
01354      {
01355      CAMarrayBase::indexErrorMessage(3, *(indexBeginP+2), *(indexEndP+2), i3);
01356      }
01357      if((i4 < *(indexBeginP +3))||(i4 > *(indexEndP+3)))
01358      {
01359      CAMarrayBase::indexErrorMessage(4, *(indexBeginP+3), *(indexEndP+3), i4);
01360      }
01361      if((i5 < *(indexBeginP +4))||(i5 > *(indexEndP+4)))
01362      {
01363      CAMarrayBase::indexErrorMessage(5, *(indexBeginP+4), *(indexEndP+4), i5);
01364      }
01365 }
01366 
01367 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1, long i2, long i3, long i4, long i5, long i6)
01368 {
01369     if(S.dataDimension != 6)
01370     {
01371      cerr << " Error : Incorrect Array Index Dimension " << endl;
01372      cerr << " Object Dimension = " << S.dataDimension
01373           << "--- Dimension Used = "<< 6 << endl;
01374      CAMmvaExit();
01375      }
01376      const long* indexBeginP = S.indexBegin.getDataPointer();
01377      const long* indexEndP = S.indexEnd.getDataPointer();
01378      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01379      {
01380      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01381      }
01382      if((i2 < *(indexBeginP +1))||(i2 > *(indexEndP+1)))
01383      {
01384      CAMarrayBase::indexErrorMessage(2, *(indexBeginP+1), *(indexEndP+1), i2);
01385      }
01386      if((i3 < *(indexBeginP +2))||(i3 > *(indexEndP+2)))
01387      {
01388      CAMarrayBase::indexErrorMessage(3, *(indexBeginP+2), *(indexEndP+2), i3);
01389      }
01390      if((i4 < *(indexBeginP +3))||(i4 > *(indexEndP+3)))
01391      {
01392      CAMarrayBase::indexErrorMessage(4, *(indexBeginP+3), *(indexEndP+3), i4);
01393      }
01394      if((i5 < *(indexBeginP +4))||(i5 > *(indexEndP+4)))
01395      {
01396      CAMarrayBase::indexErrorMessage(5, *(indexBeginP+4), *(indexEndP+4), i5);
01397      }
01398      if((i6 < *(indexBeginP +5))||(i6 > *(indexEndP+5)))
01399      {
01400      CAMarrayBase::indexErrorMessage(6, *(indexBeginP+5), *(indexEndP+5), i6);
01401      }
01402 }
01403 
01404 void  CAMarrayBase::indexCheck(const CAMstructureBase &S, long i1, long i2, long i3, long i4, long i5, long i6, long i7)
01405 {
01406     if(S.dataDimension != 7)
01407     {
01408      cerr << " Error : Incorrect Array Index Dimension " << endl;
01409      cerr << " Object Dimension = " << S.dataDimension
01410           << "--- Dimension Used = "<< 7 << endl;
01411      CAMmvaExit();
01412      }
01413      const long* indexBeginP = S.indexBegin.getDataPointer();
01414      const long* indexEndP = S.indexEnd.getDataPointer();
01415      if((i1 < *indexBeginP)||(i1 > *indexEndP))
01416      {
01417      CAMarrayBase::indexErrorMessage(1, *(indexBeginP), *(indexEndP), i1);
01418      }
01419      if((i2 < *(indexBeginP +1))||(i2 > *(indexEndP+1)))
01420      {
01421      CAMarrayBase::indexErrorMessage(2, *(indexBeginP+1), *(indexEndP+1), i2);
01422      }
01423      if((i3 < *(indexBeginP +2))||(i3 > *(indexEndP+2)))
01424      {
01425      CAMarrayBase::indexErrorMessage(3, *(indexBeginP+2), *(indexEndP+2), i3);
01426      }
01427      if((i4 < *(indexBeginP +3))||(i4 > *(indexEndP+3)))
01428      {
01429      CAMarrayBase::indexErrorMessage(4, *(indexBeginP+3), *(indexEndP+3), i4);
01430      }
01431      if((i5 < *(indexBeginP +4))||(i5 > *(indexEndP+4)))
01432      {
01433      CAMarrayBase::indexErrorMessage(5, *(indexBeginP+4), *(indexEndP+4), i5);
01434      }
01435      if((i6 < *(indexBeginP +5))||(i6 > *(indexEndP+5)))
01436      {
01437      CAMarrayBase::indexErrorMessage(6, *(indexBeginP+5), *(indexEndP+5), i6);
01438      }
01439      if((i7 < *(indexBeginP +6))||(i7 > *(indexEndP+6)))
01440      {
01441      CAMarrayBase::indexErrorMessage(7, *(indexBeginP+6), *(indexEndP+6), i7);
01442      }
01443 }
01444 void  CAMarrayBase::indexErrorMessage(long indexDimension, long base, long bound, long index)
01445 {
01446      cerr << " Error :  Index " << indexDimension << " Out of Range " << endl;
01447 
01448      cerr << " Current Index Range  :(" << base << ", " << bound << ")"  << endl;
01449      cerr << " Index Used          : " << index << endl;
01450      CAMmvaExit();
01451 }
01452 void CAMarrayBase::nonConformingMessage(const CAMstructureBase& A,  const CAMstructureBase& B)
01453 {
01454     long i;
01455     cerr << endl;
01456     cerr << "Error :  Object Dimensions not Compatable with Operation " << endl << endl;
01457     cerr << "Left  Operand Dimensions :   ";
01458     cerr << A[1].getIndexCount();
01459     for(i = 2; i <= A.dataDimension; i++)
01460     cerr <<  " x " << A[i].getIndexCount() ;
01461     cerr << endl << endl;
01462     cerr << "Right Operand Dimensions :   ";
01463     cerr << B[1].getIndexCount();
01464     for(i = 2; i <= B.dataDimension; i++)
01465     cerr <<  " x " << B[i].getIndexCount();
01466     cerr << endl << endl;
01467     CAMmvaExit();
01468 }
01469 void CAMarrayBase::doubleConversionError(const CAMstructureBase& A)
01470 {
01471     long i;
01472     cerr << endl;
01473     cerr << "Dimensions not Compatable with Conversion to Double " << endl << endl;
01474     cerr << "Operand Dimensions :   ";
01475     cerr << A[1].getIndexCount();
01476     for(i = 2; i <= A.dataDimension; i++)
01477     cerr <<  " x " << A[i].getIndexCount() ;
01478     cerr << endl << endl;
01479     CAMmvaExit();
01480 }
01481 
01482 void CAMarrayBase::objectConversionError(const CAMstructureBase& A)
01483 {
01484     long i;
01485     cerr << endl;
01486     cerr << " Dimensions not Compatable with Conversion Operator " << endl << endl;
01487     cerr << "Operand Dimensions :   ";
01488     cerr << A[1].getIndexCount();
01489     for(i = 2; i <= A.dataDimension; i++)
01490     cerr <<  " x " << A[i].getIndexCount() ;
01491     cerr << endl << endl;
01492     CAMmvaExit();
01493 }
01494 void CAMarrayBase::nullOperandError()
01495 {
01496     cerr << endl;
01497     cerr << " Error : Null Object Used As Operand  " << endl;
01498     CAMmvaExit();
01499 }
01500 void CAMarrayBase::nullOperandError(char* Operation)
01501 {
01502     cerr << endl;
01503     cerr << " Error : Null Object Used As Operand With "<< Operation << endl;
01504     CAMmvaExit();
01505 }
01506 void CAMarrayBase::inputSizeError()
01507 {
01508     cerr << endl;
01509     cerr << " Input error : Insufficient # of data elements in input stream " << endl;
01510     CAMmvaExit();
01511 }
01512 //
01513 //*****************************************************************
01514 //                     CPP File End
01515 //*****************************************************************
01516 //
01517 
01518 
01519 
01520 
01521 
01522 
01523 
01524 
01525 
01526 
01527 
01528 
01529   

Generated on Wed Aug 6 12:58:41 2003 for Open-Sessame Framework by doxygen1.3