LCOV - code coverage report
Current view: top level - util - CubitFileSimModel.cpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 565 0.0 %
Date: 2020-06-30 00:58:45 Functions: 0 18 0.0 %
Branches: 0 572 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*******************************************************************************
       2                 :            :     COPYRIGHT 2002 CATERPILLAR INC.  ALL RIGHTS RESERVED
       3                 :            : 
       4                 :            :     This program is the property of Caterpillar Inc., includes Caterpillar's
       5                 :            :     confidential and trade secret information, and is maintained as an
       6                 :            :     unpublished copyrighted work.  It is not to be copied or used by others
       7                 :            :     except under license from Caterpillar.  This program is also protected as an
       8                 :            :     unpublished work in accordance with the copyright act of 1976.  In the event
       9                 :            :     of either inadvertent or deliberate publication, Caterpillar Inc. intends to
      10                 :            :     maintain copyright protection for this work under the relevant copyright
      11                 :            :     laws pertaining to published works.  The inclusion of a copyright notice
      12                 :            :     hereon is precautionary only, and does not imply publication or disclosure.
      13                 :            : 
      14                 :            :  
      15                 :            :  Filename      : CubitFileSimModel.cpp
      16                 :            : 
      17                 :            :  Purpose       : Implements the reading and writing functionality for a Simulation
      18                 :            :                  model section of a Cubit (*.cub) format file.
      19                 :            :            
      20                 :            :  Special Notes :
      21                 :            : 
      22                 :            :  Creator       : Andrew Rout
      23                 :            : 
      24                 :            :  Creation Date : 02/20/10
      25                 :            : 
      26                 :            :  Owner         : Andrew Rout
      27                 :            : 
      28                 :            : *******************************************************************************/
      29                 :            : 
      30                 :            : #include "CubitFileSimModel.hpp"
      31                 :            : #include "CubitFileIOWrapper.hpp"
      32                 :            : #include "CCubitFile.hpp"
      33                 :            : 
      34                 :            : using namespace NCubitFile;
      35                 :            : 
      36                 :            : ///////////////////////////////////////////////////////////////////////////////
      37                 :            : // CSimModel
      38                 :            : ///////////////////////////////////////////////////////////////////////////////
      39                 :            : 
      40                 :            : // The number of 32 bit words contained int each of the stored structures.
      41                 :            : const UnsignedInt32 CSimModel::mintSizeOfSimModelHeader =
      42                 :            :     sizeof(SCubitFileSimModelHeader) / sizeof(UnsignedInt32);
      43                 :            : const UnsignedInt32 CSimModel::mintSizeOfSimModelHeader2 =
      44                 :            :     sizeof(SCubitFileSimModelHeader2) / sizeof(UnsignedInt32);
      45                 :            : const UnsignedInt32 CSimModel::mintSizeOfBCEntry =
      46                 :            :     sizeof(SCubitFileBCEntry) / sizeof(UnsignedInt32);
      47                 :            : const UnsignedInt32 CSimModel::mintSizeOfICEntry =
      48                 :            :     sizeof(SCubitFileICEntry) / sizeof(UnsignedInt32);
      49                 :            : const UnsignedInt32 CSimModel::mintSizeOfBCSetEntry =
      50                 :            :     sizeof(SCubitFileBCSetEntry) / sizeof(UnsignedInt32);
      51                 :            : const UnsignedInt32 CSimModel::mintSizeOfMaterialEntry =
      52                 :            :     sizeof(SCubitFileMaterialEntry) / sizeof(UnsignedInt32);
      53                 :            : const UnsignedInt32 CSimModel::mintSizeOfAmplitudeEntry =
      54                 :            :     sizeof(SCubitFileAmplitudeEntry) / sizeof(UnsignedInt32);
      55                 :            : const UnsignedInt32 CSimModel::mintSizeOfConstraintEntry =
      56                 :            :     sizeof(SCubitFileConstraintEntry) / sizeof(UnsignedInt32);
      57                 :            : 
      58 [ #  # ][ #  # ]:          0 : CSimModel::CSimModel()
         [ #  # ][ #  # ]
                 [ #  # ]
      59                 :            : {
      60                 :          0 :     mpReadFile = mpWriteFile = NULL;
      61                 :          0 :     mpaBCs = NULL;
      62                 :          0 :     mpaICs = NULL;
      63                 :          0 :     mpaBCSets = NULL;
      64                 :          0 :     mpaMaterials = NULL;
      65                 :          0 :     mpaAmplitudes = NULL;
      66                 :          0 :     mpaConstraints = NULL;
      67                 :            : 
      68                 :          0 :     mintSimModelOffset = 0;
      69                 :            : 
      70                 :          0 :     memset(&mSimModel, 0, sizeof(SCubitFileSimModelHeader));
      71                 :          0 :     mSimModel.mintSimModelEndian = CCubitFile::mintNativeEndian;
      72                 :            : 
      73                 :          0 :     memset(&mSimModel2, 0, sizeof(SCubitFileSimModelHeader2));
      74                 :            : 
      75                 :          0 :     memset(&mBCSetBuff, 0, sizeof(SBCSetReturnBuffer));
      76                 :          0 :     memset(&mMaterialBuff, 0, sizeof(SMaterialReturnBuffer));
      77                 :          0 :     memset(&mConstraintBuff, 0, sizeof(SConstraintReturnBuffer));
      78                 :            : 
      79                 :          0 : }
      80                 :            : 
      81 [ #  # ][ #  # ]:          0 : CSimModel::~CSimModel()
         [ #  # ][ #  # ]
                 [ #  # ]
      82                 :            : {
      83         [ #  # ]:          0 :     if(mpaBCs)
      84         [ #  # ]:          0 :         delete [] mpaBCs;
      85         [ #  # ]:          0 :     if(mpaICs)
      86         [ #  # ]:          0 :         delete [] mpaICs;
      87         [ #  # ]:          0 :     if(mpaBCSets)
      88         [ #  # ]:          0 :         delete [] mpaBCSets;
      89         [ #  # ]:          0 :     if(mpaMaterials)
      90         [ #  # ]:          0 :         delete [] mpaMaterials;
      91         [ #  # ]:          0 :     if(mpaAmplitudes)
      92         [ #  # ]:          0 :         delete [] mpaAmplitudes;
      93         [ #  # ]:          0 :     if(mpaConstraints)
      94         [ #  # ]:          0 :         delete [] mpaConstraints;
      95                 :            : 
      96         [ #  # ]:          0 :     if(mBCSetBuff.mpaBCSetRestraintData)
      97         [ #  # ]:          0 :         delete [] mBCSetBuff.mpaBCSetRestraintData;
      98         [ #  # ]:          0 :     if(mBCSetBuff.mpaintRestraintMemberIDs)
      99         [ #  # ]:          0 :         delete [] mBCSetBuff.mpaintRestraintMemberIDs;
     100                 :            : 
     101         [ #  # ]:          0 :     if(mBCSetBuff.mpaBCSetLoadData)
     102         [ #  # ]:          0 :         delete [] mBCSetBuff.mpaBCSetLoadData;
     103         [ #  # ]:          0 :     if(mBCSetBuff.mpaintLoadMemberIDs)
     104         [ #  # ]:          0 :         delete [] mBCSetBuff.mpaintLoadMemberIDs;
     105                 :            : 
     106         [ #  # ]:          0 :     if(mBCSetBuff.mpaBCSetContactPairData)
     107         [ #  # ]:          0 :         delete [] mBCSetBuff.mpaBCSetContactPairData;
     108         [ #  # ]:          0 :     if(mBCSetBuff.mpaintContactPairMemberIDs)
     109         [ #  # ]:          0 :         delete [] mBCSetBuff.mpaintContactPairMemberIDs;
     110                 :            : 
     111         [ #  # ]:          0 :     if(mMaterialBuff.mpaMaterialData)
     112         [ #  # ]:          0 :         delete [] mMaterialBuff.mpaMaterialData;
     113         [ #  # ]:          0 :     if(mMaterialBuff.mpadblData)
     114         [ #  # ]:          0 :         delete [] mMaterialBuff.mpadblData;
     115                 :            :     
     116         [ #  # ]:          0 :     if(mConstraintBuff.mpaintIndependentIDs)
     117         [ #  # ]:          0 :         delete [] mConstraintBuff.mpaintIndependentIDs;
     118         [ #  # ]:          0 :     if(mConstraintBuff.mpaintDependentIDs)
     119         [ #  # ]:          0 :         delete [] mConstraintBuff.mpaintDependentIDs;
     120         [ #  # ]:          0 :     if(mConstraintBuff.mpaIndependentData)
     121         [ #  # ]:          0 :         delete [] mConstraintBuff.mpaIndependentData;
     122         [ #  # ]:          0 :     if(mConstraintBuff.mpaDependentData)
     123         [ #  # ]:          0 :         delete [] mConstraintBuff.mpaDependentData;
     124                 :            : 
     125         [ #  # ]:          0 : }
     126                 :            : 
     127                 :            : 
     128                 :            : ///////////////////////////////////////////////////////////////////////////////
     129                 :            : // Write Functions
     130                 :            : ///////////////////////////////////////////////////////////////////////////////
     131                 :            : 
     132                 :          0 : UnsignedInt32 CSimModel::InitWrite(FILE* xpFile,
     133                 :            :                                    UnsignedInt32 xintBCCount,
     134                 :            :                                    UnsignedInt32 xintICCount,
     135                 :            :                                    UnsignedInt32 xintBCSetCount,
     136                 :            :                                    UnsignedInt32 xintMaterialCount,
     137                 :            :                                    UnsignedInt32 xintAmplitudeCount,
     138                 :            :                                    UnsignedInt32 xintConstraintCount)
     139                 :            : {
     140         [ #  # ]:          0 :     if(mpWriteFile)  throw CCubitFile::eFileWriteError;
     141                 :            : 
     142                 :          0 :     mpWriteFile = xpFile;
     143         [ #  # ]:          0 :     CIOWrapper lIO(mpWriteFile);
     144                 :            : 
     145                 :            :     // Write out the Sim model header to reserve its position and size in the
     146                 :            :     // file.
     147         [ #  # ]:          0 :     mintSimModelOffset = lIO.BeginWriteBlock();
     148         [ #  # ]:          0 :     lIO.Write((UnsignedInt32*)&mSimModel, mintSizeOfSimModelHeader);
     149         [ #  # ]:          0 :     mSimModel.mintSimModelLength = lIO.EndWriteBlock();
     150                 :            : 
     151         [ #  # ]:          0 :     mSimModel.mintFutureTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     152         [ #  # ]:          0 :     lIO.Write((UnsignedInt32*)&mSimModel2, mintSizeOfSimModelHeader2);
     153         [ #  # ]:          0 :     mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     154                 :            : 
     155                 :          0 :     mSimModel.mintBCCount = xintBCCount;
     156         [ #  # ]:          0 :     if(xintBCCount) {
     157                 :            :         // Create a geometry entity array for storing ownership statistics and
     158                 :            :         // initially blank it.
     159 [ #  # ][ #  # ]:          0 :         mpaBCs = new SCubitFileBCEntry[xintBCCount];
     160                 :          0 :         memset(mpaBCs, 0, sizeof(SCubitFileBCEntry) * xintBCCount);
     161                 :            : 
     162                 :            :         // Write the blank geometry table to the file to reserve its position
     163                 :            :         // and size in the file.
     164         [ #  # ]:          0 :         mSimModel.mintBCTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     165                 :            :         lIO.Write((UnsignedInt32*)mpaBCs,
     166         [ #  # ]:          0 :             xintBCCount * mintSizeOfBCEntry);
     167         [ #  # ]:          0 :         mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     168                 :            :     }
     169                 :            : 
     170                 :          0 :     mSimModel.mintICCount = xintICCount;
     171         [ #  # ]:          0 :     if(xintICCount) {
     172                 :            :         // Create a group array for storing ownership statistics and
     173                 :            :         // initially blank it.
     174 [ #  # ][ #  # ]:          0 :         mpaICs = new SCubitFileICEntry[xintICCount];
     175                 :          0 :         memset(mpaICs, 0, sizeof(SCubitFileICEntry) * xintICCount);
     176                 :            : 
     177                 :            :         // Write the blank group table to the file to reserve its position
     178                 :            :         // and size in the file.
     179         [ #  # ]:          0 :         mSimModel.mintICTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     180                 :            :         lIO.Write((UnsignedInt32*)mpaICs,
     181         [ #  # ]:          0 :             xintICCount * mintSizeOfICEntry);
     182         [ #  # ]:          0 :         mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     183                 :            :     }
     184                 :            : 
     185                 :          0 :     mSimModel.mintBCSetCount = xintBCSetCount;
     186         [ #  # ]:          0 :     if(xintBCSetCount) {
     187                 :            :         // Create a block array for storing ownership statistics and
     188                 :            :         // initially blank it.
     189 [ #  # ][ #  # ]:          0 :         mpaBCSets = new SCubitFileBCSetEntry[xintBCSetCount];
     190                 :          0 :         memset(mpaBCSets, 0, sizeof(SCubitFileBCSetEntry) * xintBCSetCount);
     191                 :            : 
     192                 :            :         // Write the blank block table to the file to reserve its position
     193                 :            :         // and size in the file.
     194         [ #  # ]:          0 :         mSimModel.mintBCSetTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     195                 :            :         lIO.Write((UnsignedInt32*)mpaBCSets,
     196         [ #  # ]:          0 :             xintBCSetCount * mintSizeOfBCSetEntry);
     197         [ #  # ]:          0 :         mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     198                 :            :     }
     199                 :            : 
     200                 :          0 :     mSimModel.mintMaterialCount = xintMaterialCount;
     201         [ #  # ]:          0 :     if(xintMaterialCount) {
     202                 :            :         // Create a node set array for storing ownership statistics and
     203                 :            :         // initially blank it.
     204 [ #  # ][ #  # ]:          0 :         mpaMaterials = new SCubitFileMaterialEntry[xintMaterialCount];
     205                 :          0 :         memset(mpaMaterials, 0, sizeof(SCubitFileMaterialEntry) * xintMaterialCount);
     206                 :            : 
     207                 :            :         // Write the blank geometry table to the file to reserve its position
     208                 :            :         // and size in the file.
     209         [ #  # ]:          0 :         mSimModel.mintMaterialTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     210                 :            :         lIO.Write((UnsignedInt32*)mpaMaterials,
     211         [ #  # ]:          0 :             xintMaterialCount * mintSizeOfMaterialEntry);
     212         [ #  # ]:          0 :         mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     213                 :            :     }
     214                 :            : 
     215                 :          0 :     mSimModel.mintAmplitudeCount = xintAmplitudeCount;
     216         [ #  # ]:          0 :     if(xintAmplitudeCount) {
     217                 :            :         // Create a SideSet array for storing ownership statistics and
     218                 :            :         // initially blank it.
     219 [ #  # ][ #  # ]:          0 :         mpaAmplitudes = new SCubitFileAmplitudeEntry[xintAmplitudeCount];
     220                 :          0 :         memset(mpaAmplitudes, 0, sizeof(SCubitFileAmplitudeEntry) * xintAmplitudeCount);
     221                 :            : 
     222                 :            :         // Write the blank geometry table to the file to reserve its position
     223                 :            :         // and size in the file.
     224         [ #  # ]:          0 :         mSimModel.mintAmplitudeTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     225                 :            :         lIO.Write((UnsignedInt32*)mpaAmplitudes,
     226         [ #  # ]:          0 :             xintAmplitudeCount * mintSizeOfAmplitudeEntry);
     227         [ #  # ]:          0 :         mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     228                 :            :     }
     229                 :            : 
     230                 :          0 :     mSimModel2.mintConstraintCount = xintConstraintCount;
     231         [ #  # ]:          0 :     if(xintConstraintCount) {
     232                 :            :         // Create a SideSet array for storing ownership statistics and
     233                 :            :         // initially blank it.
     234 [ #  # ][ #  # ]:          0 :         mpaConstraints = new SCubitFileConstraintEntry[xintConstraintCount];
     235                 :          0 :         memset(mpaConstraints, 0, sizeof(SCubitFileConstraintEntry) * xintConstraintCount);
     236                 :            : 
     237                 :            :         // Write the blank geometry table to the file to reserve its position
     238                 :            :         // and size in the file.
     239         [ #  # ]:          0 :         mSimModel2.mintConstraintTableOffset = lIO.BeginWriteBlock(mintSimModelOffset);
     240                 :            :         lIO.Write((UnsignedInt32*)mpaConstraints,
     241         [ #  # ]:          0 :             xintConstraintCount * mintSizeOfConstraintEntry);
     242         [ #  # ]:          0 :         mSimModel.mintSimModelLength += lIO.EndWriteBlock();
     243                 :            :     }
     244                 :            : 
     245         [ #  # ]:          0 :     return mintSimModelOffset;
     246                 :            : }
     247                 :            : 
     248                 :          0 : void CSimModel::WriteBCSet(UnsignedInt32 xintIndex,
     249                 :            :                           UnsignedInt32 xintBCSetID,
     250                 :            :                           UnsignedInt32 xintBCSetUniqueID,
     251                 :            :                           UnsignedInt32 xintBCSetAnalysisType,
     252                 :            :                           UnsignedInt32 xintRestraintTypesCount,
     253                 :            :                           UnsignedInt32 xintLoadTypesCount,
     254                 :            :                           UnsignedInt32 xintContactPairTypesCount,
     255                 :            :                           SBCSetData* xpaBCSetRestraintData,
     256                 :            :                           SBCSetData* xpaBCSetLoadData,
     257                 :            :                           SBCSetData* xpaBCSetContactPairData)
     258                 :            : {
     259         [ #  # ]:          0 :     if(!mpWriteFile)
     260                 :          0 :         throw CCubitFile::eFileWriteError;
     261         [ #  # ]:          0 :     if(xintIndex >= mSimModel.mintBCSetCount)
     262                 :          0 :         throw CCubitFile::eNotFound;
     263         [ #  # ]:          0 :     if(!mpaBCSets)
     264                 :          0 :         throw CCubitFile::eOrderError;
     265         [ #  # ]:          0 :     if(mpaBCSets[xintIndex].mintBCSetLength) // something that won't be zero
     266                 :          0 :         throw CCubitFile::eDuplicateWrite;
     267                 :            : 
     268         [ #  # ]:          0 :     if(xintRestraintTypesCount)
     269                 :            :     {  
     270                 :            :         // An empty bcset is valid, but an incompletely defined one is not.
     271         [ #  # ]:          0 :         if(!xpaBCSetRestraintData)
     272                 :          0 :             throw CCubitFile::ePassedNullPointer;
     273         [ #  # ]:          0 :         for(UnsignedInt32 lintRestraints = 0; lintRestraints < xintRestraintTypesCount; lintRestraints++) {
     274 [ #  # ][ #  # ]:          0 :             if(xpaBCSetRestraintData[lintRestraints].mintMemberCount &&
     275                 :          0 :                 !xpaBCSetRestraintData[lintRestraints].mpaMemberIDs)
     276                 :          0 :                 throw CCubitFile::ePassedNullPointer;
     277                 :            :         }
     278                 :            :     }
     279         [ #  # ]:          0 :     if(xintLoadTypesCount)
     280                 :            :     {  
     281                 :            :         // An empty bcset is valid, but an incompletely defined one is not.
     282         [ #  # ]:          0 :         if(!xpaBCSetRestraintData)
     283                 :          0 :             throw CCubitFile::ePassedNullPointer;
     284         [ #  # ]:          0 :         for(UnsignedInt32 lintLoads = 0; lintLoads < xintLoadTypesCount; lintLoads++) {
     285 [ #  # ][ #  # ]:          0 :             if(xpaBCSetLoadData[lintLoads].mintMemberCount &&
     286                 :          0 :                 !xpaBCSetLoadData[lintLoads].mpaMemberIDs)
     287                 :          0 :                 throw CCubitFile::ePassedNullPointer;
     288                 :            :         }
     289                 :            :     }
     290         [ #  # ]:          0 :     if(xintContactPairTypesCount)
     291                 :            :     {  
     292                 :            :         // An empty bcset is valid, but an incompletely defined one is not.
     293         [ #  # ]:          0 :         if(!xpaBCSetContactPairData)
     294                 :          0 :             throw CCubitFile::ePassedNullPointer;
     295         [ #  # ]:          0 :         for(UnsignedInt32 lintContactPairs = 0; lintContactPairs < xintContactPairTypesCount; lintContactPairs++) {
     296 [ #  # ][ #  # ]:          0 :             if(xpaBCSetContactPairData[lintContactPairs].mintMemberCount &&
     297                 :          0 :                 !xpaBCSetContactPairData[lintContactPairs].mpaMemberIDs)
     298                 :          0 :                 throw CCubitFile::ePassedNullPointer;
     299                 :            :         }
     300                 :            :     }
     301                 :            : 
     302                 :            :     // BCSet header written out elsewhere.  Here, just populate the header struct
     303                 :          0 :     mpaBCSets[xintIndex].mintBCSetID = xintBCSetID;
     304                 :          0 :     mpaBCSets[xintIndex].mintBCSetUniqueID = xintBCSetUniqueID;
     305                 :          0 :     mpaBCSets[xintIndex].mintBCSetAnalysisType = xintBCSetAnalysisType;
     306                 :          0 :     mpaBCSets[xintIndex].mintRestraintTypesCount = xintRestraintTypesCount;
     307                 :          0 :     mpaBCSets[xintIndex].mintLoadTypesCount = xintLoadTypesCount;
     308                 :          0 :     mpaBCSets[xintIndex].mintContactPairTypesCount = xintContactPairTypesCount;
     309                 :            :     
     310         [ #  # ]:          0 :     CIOWrapper* lpIO = new CIOWrapper(mpWriteFile);
     311                 :            : 
     312                 :            :     // write restraints
     313         [ #  # ]:          0 :     if(xintRestraintTypesCount)
     314                 :            :     {        
     315                 :          0 :         mpaBCSets[xintIndex].mintRestraintsOffset =
     316                 :          0 :             lpIO->BeginWriteBlock(mintSimModelOffset);
     317                 :            : 
     318         [ #  # ]:          0 :         for(UnsignedInt32 lintBCSet = 0; lintBCSet < xintRestraintTypesCount; lintBCSet++)
     319                 :            :         {
     320         [ #  # ]:          0 :             if(!xpaBCSetRestraintData[lintBCSet].mintMemberCount)
     321                 :            :             {
     322                 :          0 :                 mpaBCSets[xintIndex].mintRestraintTypesCount--;
     323                 :          0 :                 continue;
     324                 :            :             }
     325                 :            :             mpaBCSets[xintIndex].mintRestraintMembersCount +=
     326                 :          0 :                 xpaBCSetRestraintData[lintBCSet].mintMemberCount;
     327                 :            :             
     328                 :          0 :             lpIO->Write(&xpaBCSetRestraintData[lintBCSet].mintMemberType, 1);
     329                 :          0 :             lpIO->Write(&xpaBCSetRestraintData[lintBCSet].mintMemberCount, 1);
     330                 :          0 :             lpIO->Write(xpaBCSetRestraintData[lintBCSet].mpaMemberIDs,
     331                 :          0 :                 xpaBCSetRestraintData[lintBCSet].mintMemberCount);
     332                 :            :         }
     333                 :            : 
     334                 :          0 :         mpaBCSets[xintIndex].mintBCSetLength += lpIO->EndWriteBlock();
     335                 :            :     }
     336                 :            :     else
     337                 :            :     {
     338                 :            :         // BCSet has no restraints in the file.
     339                 :          0 :         mpaBCSets[xintIndex].mintRestraintsOffset = 0;
     340                 :            :     }
     341                 :            : 
     342                 :            :     //write loads
     343         [ #  # ]:          0 :     if(xintLoadTypesCount)
     344                 :            :     {        
     345                 :          0 :         mpaBCSets[xintIndex].mintLoadsOffset =
     346                 :          0 :             lpIO->BeginWriteBlock(mintSimModelOffset);
     347                 :            : 
     348         [ #  # ]:          0 :         for(UnsignedInt32 lintBCSet = 0; lintBCSet < xintLoadTypesCount; lintBCSet++)
     349                 :            :         {
     350         [ #  # ]:          0 :             if(!xpaBCSetLoadData[lintBCSet].mintMemberCount)
     351                 :            :             {
     352                 :          0 :                 mpaBCSets[xintIndex].mintLoadTypesCount--;
     353                 :          0 :                 continue;
     354                 :            :             }
     355                 :            :             mpaBCSets[xintIndex].mintLoadMembersCount +=
     356                 :          0 :                 xpaBCSetLoadData[lintBCSet].mintMemberCount;
     357                 :            :             
     358                 :          0 :             lpIO->Write(&xpaBCSetLoadData[lintBCSet].mintMemberType, 1);
     359                 :          0 :             lpIO->Write(&xpaBCSetLoadData[lintBCSet].mintMemberCount, 1);
     360                 :          0 :             lpIO->Write(xpaBCSetLoadData[lintBCSet].mpaMemberIDs,
     361                 :          0 :                 xpaBCSetLoadData[lintBCSet].mintMemberCount);
     362                 :            :         }
     363                 :            : 
     364                 :          0 :         mpaBCSets[xintIndex].mintBCSetLength += lpIO->EndWriteBlock();
     365                 :            :     }
     366                 :            :     else
     367                 :            :     {
     368                 :            :         // BCSet has no Loads in the file.
     369                 :          0 :         mpaBCSets[xintIndex].mintLoadsOffset = 0;
     370                 :            :     }
     371                 :            : 
     372                 :            :     // write contact pairs
     373         [ #  # ]:          0 :     if(xintContactPairTypesCount)
     374                 :            :     {        
     375                 :          0 :         mpaBCSets[xintIndex].mintContactPairsOffset =
     376                 :          0 :             lpIO->BeginWriteBlock(mintSimModelOffset);
     377                 :            : 
     378         [ #  # ]:          0 :         for(UnsignedInt32 lintBCSet = 0; lintBCSet < xintContactPairTypesCount; lintBCSet++)
     379                 :            :         {
     380         [ #  # ]:          0 :             if(!xpaBCSetContactPairData[lintBCSet].mintMemberCount)
     381                 :            :             {
     382                 :          0 :                 mpaBCSets[xintIndex].mintContactPairTypesCount--;
     383                 :          0 :                 continue;
     384                 :            :             }
     385                 :            :             mpaBCSets[xintIndex].mintContactPairMembersCount +=
     386                 :          0 :                 xpaBCSetContactPairData[lintBCSet].mintMemberCount;
     387                 :            :             
     388                 :          0 :             lpIO->Write(&xpaBCSetContactPairData[lintBCSet].mintMemberType, 1);
     389                 :          0 :             lpIO->Write(&xpaBCSetContactPairData[lintBCSet].mintMemberCount, 1);
     390                 :          0 :             lpIO->Write(xpaBCSetContactPairData[lintBCSet].mpaMemberIDs,
     391                 :          0 :                 xpaBCSetContactPairData[lintBCSet].mintMemberCount);
     392                 :            :         }
     393                 :            : 
     394                 :          0 :         mpaBCSets[xintIndex].mintBCSetLength += lpIO->EndWriteBlock();
     395                 :            :         
     396                 :            :     }
     397                 :            :     else
     398                 :            :     {
     399                 :            :         // BCSet has no ContactPairs in the file.
     400                 :          0 :         mpaBCSets[xintIndex].mintContactPairsOffset = 0;
     401                 :            :     }
     402                 :            :     
     403                 :          0 :     mSimModel.mintSimModelLength += mpaBCSets[xintIndex].mintBCSetLength;
     404         [ #  # ]:          0 :     delete lpIO;
     405                 :          0 : }
     406                 :            : 
     407                 :          0 : void CSimModel::WriteMaterial(UnsignedInt32 xintIndex,
     408                 :            :                               UnsignedInt32 xintMaterialID,
     409                 :            :                               UnsignedInt32 xintMaterialUniqueID,
     410                 :            :                               UnsignedInt32 xintPropertiesCount,
     411                 :            :                               SMaterialData* xpaMaterialData)
     412                 :            : {
     413         [ #  # ]:          0 :     if(!mpWriteFile)
     414                 :          0 :         throw CCubitFile::eFileWriteError;
     415         [ #  # ]:          0 :     if(xintIndex >= mSimModel.mintMaterialCount)
     416                 :          0 :         throw CCubitFile::eNotFound;
     417         [ #  # ]:          0 :     if(!mpaBCSets)
     418                 :          0 :         throw CCubitFile::eOrderError;
     419         [ #  # ]:          0 :     if(mpaMaterials[xintIndex].mintMaterialLength) // something that won't be zero
     420                 :          0 :         throw CCubitFile::eDuplicateWrite;
     421                 :            : 
     422         [ #  # ]:          0 :     if(xintPropertiesCount)
     423                 :            :     {  
     424                 :            :         // An empty material is valid, but an incompletely defined one is not.
     425         [ #  # ]:          0 :         if(!xpaMaterialData)
     426                 :          0 :             throw CCubitFile::ePassedNullPointer;
     427         [ #  # ]:          0 :         for(UnsignedInt32 lintMaterialData = 0; lintMaterialData < xintPropertiesCount; lintMaterialData++) {
     428 [ #  # ][ #  # ]:          0 :             if(xpaMaterialData[lintMaterialData].mintMemberRows &&
     429                 :          0 :                 !xpaMaterialData[lintMaterialData].mpadblMemberData)
     430                 :          0 :                 throw CCubitFile::ePassedNullPointer;
     431                 :            :         }
     432                 :            :     }
     433                 :            : 
     434                 :            :     // Material header written out elsewhere.  Here, just populate the header struct
     435                 :          0 :     mpaMaterials[xintIndex].mintMaterialID = xintMaterialID;
     436                 :          0 :     mpaMaterials[xintIndex].mintMaterialUniqueID = xintMaterialUniqueID;
     437                 :          0 :     mpaMaterials[xintIndex].mintMaterialPropertiesCount = xintPropertiesCount;
     438                 :            :     
     439         [ #  # ]:          0 :     CIOWrapper* lpIO = new CIOWrapper(mpWriteFile);
     440                 :            : 
     441                 :            :     // write material data
     442         [ #  # ]:          0 :     if(xintPropertiesCount)
     443                 :            :     {        
     444                 :          0 :         mpaMaterials[xintIndex].mintMaterialPropertiesOffset =
     445                 :          0 :             lpIO->BeginWriteBlock(mintSimModelOffset);
     446                 :            : 
     447         [ #  # ]:          0 :         for(UnsignedInt32 lintMaterial = 0; lintMaterial < xintPropertiesCount; lintMaterial++)
     448                 :            :         {
     449         [ #  # ]:          0 :             if(!xpaMaterialData[lintMaterial].mintMemberRows)
     450                 :            :             {
     451                 :          0 :                 mpaMaterials[xintIndex].mintMaterialPropertiesCount--;
     452                 :          0 :                 continue;
     453                 :            :             }
     454                 :            :              mpaMaterials[xintIndex].mintPropertyDataCount +=
     455                 :          0 :                 (xpaMaterialData[lintMaterial].mintMemberRows *
     456                 :          0 :                  xpaMaterialData[lintMaterial].mintMemberColumns);
     457                 :            :             
     458                 :          0 :             lpIO->Write(&xpaMaterialData[lintMaterial].mintMemberType, 1);
     459                 :          0 :             lpIO->Write(&xpaMaterialData[lintMaterial].mintMemberRows, 1);
     460                 :          0 :             lpIO->Write(&xpaMaterialData[lintMaterial].mintMemberColumns, 1);
     461                 :          0 :             lpIO->Write(xpaMaterialData[lintMaterial].mpadblMemberData,
     462                 :          0 :                         xpaMaterialData[lintMaterial].mintMemberRows *
     463                 :          0 :                             xpaMaterialData[lintMaterial].mintMemberColumns);
     464                 :            :             
     465                 :            :         }
     466                 :            : 
     467                 :          0 :         mpaMaterials[xintIndex].mintMaterialLength += lpIO->EndWriteBlock();
     468                 :            :     }
     469                 :            :     else
     470                 :            :     {
     471                 :            :         // Material has no data in the file.
     472                 :          0 :         mpaMaterials[xintIndex].mintMaterialPropertiesOffset = 0;
     473                 :            :     }
     474                 :            :     
     475                 :          0 :     mSimModel.mintSimModelLength += mpaMaterials[xintIndex].mintMaterialLength;
     476         [ #  # ]:          0 :     delete lpIO;
     477                 :          0 : }
     478                 :            : 
     479                 :          0 : void CSimModel::WriteConstraint(UnsignedInt32 xintIndex,
     480                 :            :         UnsignedInt32 xintConstraintID, UnsignedInt32 xintConstraintUniqueID,
     481                 :            :         UnsignedInt32 xintConstraintType,
     482                 :            :         UnsignedInt32 xintIndependentTypeCount, SConstraintData* xpaIndependentData,
     483                 :            :         UnsignedInt32 xintDependentTypeCount, SConstraintData* xpaDependentData)
     484                 :            : {
     485         [ #  # ]:          0 :     if(!mpWriteFile)
     486                 :          0 :         throw CCubitFile::eFileWriteError;
     487         [ #  # ]:          0 :     if(xintIndex >= mSimModel2.mintConstraintCount)
     488                 :          0 :         throw CCubitFile::eNotFound;
     489         [ #  # ]:          0 :     if(!mpaBCSets)
     490                 :          0 :         throw CCubitFile::eOrderError;
     491         [ #  # ]:          0 :     if(mpaConstraints[xintIndex].mintConstraintLength) // something that won't be zero
     492                 :          0 :         throw CCubitFile::eDuplicateWrite;
     493                 :            : 
     494         [ #  # ]:          0 :     if(xintDependentTypeCount)
     495                 :            :     {  
     496                 :            :         // An empty Constraint is valid, but an incompletely defined one is not.
     497         [ #  # ]:          0 :         if(!xpaDependentData)
     498                 :          0 :             throw CCubitFile::ePassedNullPointer;
     499         [ #  # ]:          0 :         for(int lintConstraintData = 0; lintConstraintData < (int)xintDependentTypeCount; lintConstraintData++) {
     500 [ #  # ][ #  # ]:          0 :             if(xpaDependentData[lintConstraintData].mintMemberCount &&
     501                 :          0 :                 !xpaDependentData[lintConstraintData].mpaMemberIDs)
     502                 :          0 :                 throw CCubitFile::ePassedNullPointer;
     503                 :            :         }
     504                 :            :     }
     505         [ #  # ]:          0 :     if(xintIndependentTypeCount)
     506                 :            :     {  
     507                 :            :         // An empty Constraint is valid, but an incompletely defined one is not.
     508         [ #  # ]:          0 :         if(!xpaIndependentData)
     509                 :          0 :             throw CCubitFile::ePassedNullPointer;
     510         [ #  # ]:          0 :         for(int lintConstraintData = 0; lintConstraintData < (int)xintIndependentTypeCount; lintConstraintData++) {
     511 [ #  # ][ #  # ]:          0 :             if(xpaIndependentData[lintConstraintData].mintMemberCount &&
     512                 :          0 :                 !xpaIndependentData[lintConstraintData].mpaMemberIDs)
     513                 :          0 :                 throw CCubitFile::ePassedNullPointer;
     514                 :            :         }
     515                 :            :     }
     516                 :            : 
     517                 :            :     // Constraint header written out elsewhere.  Here, just populate the header struct
     518                 :          0 :     mpaConstraints[xintIndex].mintConstraintID = xintConstraintID;
     519                 :          0 :     mpaConstraints[xintIndex].mintConstraintUniqueID = xintConstraintUniqueID;
     520                 :          0 :     mpaConstraints[xintIndex].mintConstraintType = xintConstraintType;
     521                 :          0 :     mpaConstraints[xintIndex].mintIndependentTypeCount = xintIndependentTypeCount;
     522                 :          0 :     mpaConstraints[xintIndex].mintDependentTypeCount = xintDependentTypeCount;
     523                 :            :     
     524         [ #  # ]:          0 :     CIOWrapper* lpIO = new CIOWrapper(mpWriteFile);
     525                 :            : 
     526                 :            :     // write Independent Constraint data
     527         [ #  # ]:          0 :     if(xintIndependentTypeCount)
     528                 :            :     {        
     529                 :          0 :         mpaConstraints[xintIndex].mintIndependentDataOffset =
     530                 :          0 :             lpIO->BeginWriteBlock(mintSimModelOffset);
     531                 :            : 
     532         [ #  # ]:          0 :         for(int lintConstraint = 0; lintConstraint < (int)xintIndependentTypeCount; lintConstraint++)
     533                 :            :         {
     534         [ #  # ]:          0 :             if(!xpaIndependentData[lintConstraint].mintMemberCount)
     535                 :            :             {
     536                 :          0 :                 mpaConstraints[xintIndex].mintIndependentTypeCount--;
     537                 :          0 :                 continue;
     538                 :            :             }
     539                 :            : 
     540                 :          0 :             lpIO->Write(&xpaIndependentData[lintConstraint].mintMemberType, 1);
     541                 :          0 :             lpIO->Write(&xpaIndependentData[lintConstraint].mintMemberCount, 1);
     542                 :          0 :             lpIO->Write(xpaIndependentData[lintConstraint].mpaMemberIDs,
     543                 :          0 :                         xpaIndependentData[lintConstraint].mintMemberCount);
     544                 :            :         }
     545                 :            : 
     546                 :          0 :         mpaConstraints[xintIndex].mintConstraintLength += lpIO->EndWriteBlock();
     547                 :            :     }
     548                 :            :     else
     549                 :            :     {
     550                 :            :         // Constraint has no data in the file.
     551                 :          0 :         mpaConstraints[xintIndex].mintIndependentDataOffset = 0;
     552                 :            :     }
     553                 :            :     
     554                 :            :     // write Dependent Constraint data
     555         [ #  # ]:          0 :     if(xintDependentTypeCount)
     556                 :            :     {        
     557                 :          0 :         mpaConstraints[xintIndex].mintDependentDataOffset =
     558                 :          0 :             lpIO->BeginWriteBlock(mintSimModelOffset);
     559                 :            : 
     560         [ #  # ]:          0 :         for(int lintConstraint = 0; lintConstraint < (int)xintDependentTypeCount; lintConstraint++)
     561                 :            :         {
     562         [ #  # ]:          0 :             if(!xpaDependentData[lintConstraint].mintMemberCount)
     563                 :            :             {
     564                 :          0 :                 mpaConstraints[xintIndex].mintIndependentTypeCount--;
     565                 :          0 :                 continue;
     566                 :            :             }
     567                 :            : 
     568                 :          0 :             lpIO->Write(&xpaDependentData[lintConstraint].mintMemberType, 1);
     569                 :          0 :             lpIO->Write(&xpaDependentData[lintConstraint].mintMemberCount, 1);
     570                 :          0 :             lpIO->Write(xpaDependentData[lintConstraint].mpaMemberIDs,
     571                 :          0 :                         xpaDependentData[lintConstraint].mintMemberCount);
     572                 :            :         }
     573                 :            : 
     574                 :          0 :         mpaConstraints[xintIndex].mintConstraintLength += lpIO->EndWriteBlock();
     575                 :            :     }
     576                 :            :     else
     577                 :            :     {
     578                 :            :         // Constraint has no data in the file.
     579                 :          0 :         mpaConstraints[xintIndex].mintDependentDataOffset = 0;
     580                 :            :     }
     581                 :            :     
     582                 :          0 :     mSimModel.mintSimModelLength += mpaConstraints[xintIndex].mintConstraintLength;
     583                 :            : 
     584         [ #  # ]:          0 :     delete lpIO;
     585                 :          0 : }
     586                 :            : 
     587                 :          0 : UnsignedInt32 CSimModel::EndWrite()
     588                 :            : {
     589         [ #  # ]:          0 :     CIOWrapper lIO(mpWriteFile);
     590                 :            : 
     591         [ #  # ]:          0 :     if(mSimModel.mintBCCount) {
     592         [ #  # ]:          0 :         lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel.mintBCTableOffset);
     593                 :            :         lIO.Write((UnsignedInt32*)mpaBCs,
     594         [ #  # ]:          0 :             mSimModel.mintBCCount * mintSizeOfBCEntry);
     595         [ #  # ]:          0 :         lIO.EndWriteBlock();
     596                 :            :     }
     597                 :            : 
     598         [ #  # ]:          0 :     if(mSimModel.mintICCount) {
     599         [ #  # ]:          0 :         lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel.mintICTableOffset);
     600                 :            :         lIO.Write((UnsignedInt32*)mpaICs,
     601         [ #  # ]:          0 :             mSimModel.mintICCount * mintSizeOfICEntry);
     602         [ #  # ]:          0 :         lIO.EndWriteBlock();
     603                 :            :     }
     604                 :            : 
     605         [ #  # ]:          0 :     if(mSimModel.mintBCSetCount) {
     606         [ #  # ]:          0 :         lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel.mintBCSetTableOffset);
     607                 :            :         lIO.Write((UnsignedInt32*)mpaBCSets,
     608         [ #  # ]:          0 :             mSimModel.mintBCSetCount * mintSizeOfBCSetEntry);
     609         [ #  # ]:          0 :         lIO.EndWriteBlock();
     610                 :            :     }
     611                 :            : 
     612         [ #  # ]:          0 :     if(mSimModel.mintMaterialCount) {
     613         [ #  # ]:          0 :         lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel.mintMaterialTableOffset);
     614                 :            :         lIO.Write((UnsignedInt32*)mpaMaterials,
     615         [ #  # ]:          0 :             mSimModel.mintMaterialCount * mintSizeOfMaterialEntry);
     616         [ #  # ]:          0 :         lIO.EndWriteBlock();
     617                 :            :     }
     618                 :            : 
     619         [ #  # ]:          0 :     if(mSimModel.mintAmplitudeCount) {
     620         [ #  # ]:          0 :         lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel.mintAmplitudeTableOffset);
     621                 :            :         lIO.Write((UnsignedInt32*)mpaAmplitudes,
     622         [ #  # ]:          0 :             mSimModel.mintAmplitudeCount * mintSizeOfAmplitudeEntry);
     623         [ #  # ]:          0 :         lIO.EndWriteBlock();
     624                 :            :     }
     625                 :            : 
     626         [ #  # ]:          0 :     if(mSimModel2.mintConstraintCount) {
     627         [ #  # ]:          0 :         lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel2.mintConstraintTableOffset);
     628                 :            :         lIO.Write((UnsignedInt32*)mpaConstraints,
     629         [ #  # ]:          0 :             mSimModel2.mintConstraintCount * mintSizeOfConstraintEntry);
     630         [ #  # ]:          0 :         lIO.EndWriteBlock();
     631                 :            :     }
     632                 :            : 
     633                 :            :     UnsignedInt32 lintMetaDataLength;
     634                 :            :     mBCMetaData.WriteMetaData(mpWriteFile, mSimModel.mintBCMetaDataOffset,
     635         [ #  # ]:          0 :         lintMetaDataLength, mintSimModelOffset);
     636                 :          0 :     mSimModel.mintSimModelLength += lintMetaDataLength;
     637                 :            :     mICMetaData.WriteMetaData(mpWriteFile, mSimModel.mintICMetaDataOffset,
     638         [ #  # ]:          0 :         lintMetaDataLength, mintSimModelOffset);
     639                 :          0 :     mSimModel.mintSimModelLength += lintMetaDataLength;
     640                 :            :     mBCSetMetaData.WriteMetaData(mpWriteFile, mSimModel.mintBCSetMetaDataOffset,
     641         [ #  # ]:          0 :         lintMetaDataLength, mintSimModelOffset);
     642                 :          0 :     mSimModel.mintSimModelLength += lintMetaDataLength;
     643                 :            :     mMaterialMetaData.WriteMetaData(mpWriteFile, mSimModel.mintMaterialMetaDataOffset,
     644         [ #  # ]:          0 :         lintMetaDataLength, mintSimModelOffset);
     645                 :          0 :     mSimModel.mintSimModelLength += lintMetaDataLength;
     646                 :            :     mAmplitudeMetaData.WriteMetaData(mpWriteFile, mSimModel.mintAmplitudeMetaDataOffset,
     647         [ #  # ]:          0 :         lintMetaDataLength, mintSimModelOffset);
     648                 :          0 :     mSimModel.mintSimModelLength += lintMetaDataLength;
     649                 :            :     mConstraintMetaData.WriteMetaData(mpWriteFile, mSimModel2.mintConstraintMetaDataOffset,
     650         [ #  # ]:          0 :         lintMetaDataLength, mintSimModelOffset);
     651                 :          0 :     mSimModel.mintSimModelLength += lintMetaDataLength;
     652                 :            : 
     653         [ #  # ]:          0 :     lIO.BeginRewriteBlock(mintSimModelOffset, 0);
     654         [ #  # ]:          0 :     lIO.Write((UnsignedInt32*)&mSimModel, mintSizeOfSimModelHeader);
     655         [ #  # ]:          0 :     lIO.EndWriteBlock();
     656                 :            : 
     657         [ #  # ]:          0 :     lIO.BeginRewriteBlock(mintSimModelOffset, mSimModel.mintFutureTableOffset);
     658         [ #  # ]:          0 :     lIO.Write((UnsignedInt32*)&mSimModel2, mintSizeOfSimModelHeader2);
     659         [ #  # ]:          0 :     lIO.EndWriteBlock();
     660                 :            : 
     661                 :          0 :     mpWriteFile = NULL;
     662         [ #  # ]:          0 :     return mSimModel.mintSimModelLength;
     663                 :            : }
     664                 :            : 
     665                 :            : 
     666                 :            : ///////////////////////////////////////////////////////////////////////////////
     667                 :            : // Read Functions
     668                 :            : ///////////////////////////////////////////////////////////////////////////////
     669                 :            : 
     670                 :          0 : void CSimModel::InitRead(FILE* xpFile,
     671                 :            :                          UnsignedInt32& xintAbsoluteOffset,
     672                 :            :                          UnsignedInt32& xintBCCount,
     673                 :            :                          UnsignedInt32& xintICCount,
     674                 :            :                          UnsignedInt32& xintBCSetCount,
     675                 :            :                          UnsignedInt32& xintMaterialCount,
     676                 :            :                          UnsignedInt32& xintAmplitudeCount,
     677                 :            :                          UnsignedInt32& xintConstraintCount)
     678                 :            : {
     679         [ #  # ]:          0 :     if(mpReadFile)
     680                 :          0 :         throw CCubitFile::eOrderError;
     681                 :            : 
     682                 :          0 :     mpReadFile = xpFile;
     683                 :          0 :     mintSimModelOffset = xintAbsoluteOffset;
     684         [ #  # ]:          0 :     CIOWrapper lIO(mpReadFile, xintAbsoluteOffset, 0);
     685                 :            : 
     686         [ #  # ]:          0 :     lIO.BeginReadBlock(mintSimModelOffset, 0);
     687         [ #  # ]:          0 :     lIO.Read((UnsignedInt32*)&mSimModel, mintSizeOfSimModelHeader);
     688         [ #  # ]:          0 :     lIO.EndReadBlock();
     689                 :            : 
     690         [ #  # ]:          0 :     lIO.BeginReadBlock(mintSimModelOffset, mSimModel.mintFutureTableOffset);
     691         [ #  # ]:          0 :     lIO.Read((UnsignedInt32*)&mSimModel2, mintSizeOfSimModelHeader2);
     692         [ #  # ]:          0 :     lIO.EndReadBlock();
     693                 :            : 
     694                 :          0 :     xintBCCount = mSimModel.mintBCCount;
     695                 :          0 :     xintICCount = mSimModel.mintICCount;
     696                 :          0 :     xintBCSetCount = mSimModel.mintBCSetCount;
     697                 :          0 :     xintMaterialCount = mSimModel.mintMaterialCount;
     698                 :          0 :     xintAmplitudeCount = mSimModel.mintAmplitudeCount;
     699                 :          0 :     xintConstraintCount = mSimModel2.mintConstraintCount;
     700                 :            : 
     701                 :            :     // Restore the Boundary Condition definition header table if there is one.
     702         [ #  # ]:          0 :     if(mSimModel.mintBCCount) {
     703 [ #  # ][ #  # ]:          0 :         mpaBCs = new SCubitFileBCEntry[mSimModel.mintBCCount];
     704                 :            : 
     705         [ #  # ]:          0 :         lIO.BeginReadBlock(mintSimModelOffset, mSimModel.mintBCTableOffset);
     706                 :            :         lIO.Read((UnsignedInt32*)mpaBCs,
     707         [ #  # ]:          0 :             mSimModel.mintBCCount * mintSizeOfBCEntry);
     708         [ #  # ]:          0 :         lIO.EndReadBlock();
     709                 :            :     }
     710                 :            : 
     711                 :            :     // Restore the Initial Condition definition header table if there is one.
     712         [ #  # ]:          0 :     if(mSimModel.mintICCount) {
     713 [ #  # ][ #  # ]:          0 :         mpaICs = new SCubitFileICEntry[mSimModel.mintICCount];
     714                 :            : 
     715         [ #  # ]:          0 :         lIO.BeginReadBlock(mintSimModelOffset, mSimModel.mintICTableOffset);
     716                 :            :         lIO.Read((UnsignedInt32*)mpaICs,
     717         [ #  # ]:          0 :             mSimModel.mintICCount * mintSizeOfICEntry);
     718         [ #  # ]:          0 :         lIO.EndReadBlock();
     719                 :            :     }
     720                 :            : 
     721                 :            :     // Restore the BCSet definition header table if there is one.
     722         [ #  # ]:          0 :     if(mSimModel.mintBCSetCount) {
     723 [ #  # ][ #  # ]:          0 :         mpaBCSets = new SCubitFileBCSetEntry[mSimModel.mintBCSetCount];
     724                 :            : 
     725         [ #  # ]:          0 :         lIO.BeginReadBlock(mintSimModelOffset, mSimModel.mintBCSetTableOffset);
     726                 :            :         lIO.Read((UnsignedInt32*)mpaBCSets,
     727         [ #  # ]:          0 :             mSimModel.mintBCSetCount * mintSizeOfBCSetEntry);
     728         [ #  # ]:          0 :         lIO.EndReadBlock();
     729                 :            :     }
     730                 :            : 
     731                 :            :     // Restore the Material definition header table if there is one.
     732         [ #  # ]:          0 :     if(mSimModel.mintMaterialCount) {
     733 [ #  # ][ #  # ]:          0 :         mpaMaterials = new SCubitFileMaterialEntry[mSimModel.mintMaterialCount];
     734                 :            : 
     735         [ #  # ]:          0 :         lIO.BeginReadBlock(mintSimModelOffset, mSimModel.mintMaterialTableOffset);
     736                 :            :         lIO.Read((UnsignedInt32*)mpaMaterials,
     737         [ #  # ]:          0 :             mSimModel.mintMaterialCount * mintSizeOfMaterialEntry);
     738         [ #  # ]:          0 :         lIO.EndReadBlock();
     739                 :            :     }
     740                 :            : 
     741                 :            :     // Restore the Amplitude definition header table if there is one.
     742         [ #  # ]:          0 :     if(mSimModel.mintAmplitudeCount) {
     743 [ #  # ][ #  # ]:          0 :         mpaAmplitudes = new SCubitFileAmplitudeEntry[mSimModel.mintAmplitudeCount];
     744                 :            : 
     745         [ #  # ]:          0 :         lIO.BeginReadBlock(mintSimModelOffset, mSimModel.mintAmplitudeTableOffset);
     746                 :            :         lIO.Read((UnsignedInt32*)mpaAmplitudes,
     747         [ #  # ]:          0 :             mSimModel.mintAmplitudeCount * mintSizeOfAmplitudeEntry);
     748         [ #  # ]:          0 :         lIO.EndReadBlock();
     749                 :            :     }
     750                 :            : 
     751                 :            :     // Restore the Amplitude definition header table if there is one.
     752         [ #  # ]:          0 :     if(mSimModel2.mintConstraintCount) {
     753 [ #  # ][ #  # ]:          0 :         mpaConstraints = new SCubitFileConstraintEntry[mSimModel2.mintConstraintCount];
     754                 :            : 
     755         [ #  # ]:          0 :         lIO.BeginReadBlock(mintSimModelOffset, mSimModel2.mintConstraintTableOffset);
     756                 :            :         lIO.Read((UnsignedInt32*)mpaConstraints,
     757         [ #  # ]:          0 :             mSimModel2.mintConstraintCount * mintSizeOfConstraintEntry);
     758         [ #  # ]:          0 :         lIO.EndReadBlock();
     759                 :            :     }
     760                 :            : 
     761                 :            :     mBCMetaData.ReadMetaData(mpReadFile, mintSimModelOffset,
     762         [ #  # ]:          0 :         mSimModel.mintBCMetaDataOffset, mSimModel.mintSimModelEndian);
     763                 :            :     mICMetaData.ReadMetaData(mpReadFile, mintSimModelOffset,
     764         [ #  # ]:          0 :         mSimModel.mintICMetaDataOffset, mSimModel.mintSimModelEndian);
     765                 :            :     mBCSetMetaData.ReadMetaData(mpReadFile, mintSimModelOffset,
     766         [ #  # ]:          0 :         mSimModel.mintBCSetMetaDataOffset, mSimModel.mintSimModelEndian);
     767                 :            :     mMaterialMetaData.ReadMetaData(mpReadFile, mintSimModelOffset,
     768         [ #  # ]:          0 :         mSimModel.mintMaterialMetaDataOffset, mSimModel.mintSimModelEndian);
     769                 :            :     mAmplitudeMetaData.ReadMetaData(mpReadFile, mintSimModelOffset,
     770         [ #  # ]:          0 :         mSimModel.mintAmplitudeMetaDataOffset, mSimModel.mintSimModelEndian);
     771                 :            :     mConstraintMetaData.ReadMetaData(mpReadFile, mintSimModelOffset,
     772 [ #  # ][ #  # ]:          0 :         mSimModel2.mintConstraintMetaDataOffset, mSimModel.mintSimModelEndian);
     773                 :          0 : }
     774                 :            : 
     775                 :          0 : void CSimModel::ReadBCSet(UnsignedInt32 xintIndex,
     776                 :            :                           UnsignedInt32& xintBCSetID,
     777                 :            :                           UnsignedInt32& xintBCSetUniqueID,
     778                 :            :                           UnsignedInt32& xintBCSetAnalysisType,
     779                 :            :                           UnsignedInt32& xintRestraintTypesCount,
     780                 :            :                           UnsignedInt32& xintLoadTypesCount,
     781                 :            :                           UnsignedInt32& xintContactPairTypesCount,
     782                 :            :                           SBCSetData*& xpaBCSetRestraintData,
     783                 :            :                           SBCSetData*& xpaBCSetLoadData,
     784                 :            :                           SBCSetData*& xpaBCSetContactPairData)
     785                 :            : {
     786         [ #  # ]:          0 :     if(!mpReadFile)
     787                 :          0 :         throw CCubitFile::eFileReadError;
     788         [ #  # ]:          0 :     if(xintIndex >= mSimModel.mintBCSetCount)
     789                 :          0 :         throw CCubitFile::eNotFound;
     790         [ #  # ]:          0 :     if(!mpaBCSets)
     791                 :          0 :         throw CCubitFile::eOrderError;
     792                 :            : 
     793                 :          0 :     xintBCSetID = mpaBCSets[xintIndex].mintBCSetID;
     794                 :          0 :     xintBCSetUniqueID = mpaBCSets[xintIndex].mintBCSetUniqueID;
     795                 :          0 :     xintBCSetAnalysisType = mpaBCSets[xintIndex].mintBCSetAnalysisType;
     796                 :          0 :     xintRestraintTypesCount = mpaBCSets[xintIndex].mintRestraintTypesCount;
     797                 :          0 :     xintLoadTypesCount = mpaBCSets[xintIndex].mintLoadTypesCount;
     798                 :          0 :     xintContactPairTypesCount = mpaBCSets[xintIndex].mintContactPairTypesCount;
     799                 :            : 
     800                 :            :     // read Restraints
     801         [ #  # ]:          0 :     if(xintRestraintTypesCount) 
     802                 :            :     {
     803                 :            :         // Resize the node set return buffer if necessary and then set the return
     804                 :            :         // pointers to the buffer.
     805                 :            :         xpaBCSetRestraintData = AdjustBuffer(xintRestraintTypesCount,
     806                 :          0 :             mBCSetBuff.mintNumRestraintTypes, mBCSetBuff.mpaBCSetRestraintData);
     807                 :            :         UnsignedInt32* lpIDs =
     808                 :          0 :             AdjustBuffer(mpaBCSets[xintIndex].mintRestraintMembersCount,
     809                 :          0 :             mBCSetBuff.mintNumRestraintMembers, mBCSetBuff.mpaintRestraintMemberIDs);
     810                 :            : 
     811                 :            :         // Read the node set from the file.
     812                 :          0 :         UnsignedInt32 lintNumMembers, lintTotalMembers = 0;
     813         [ #  # ]:          0 :         CIOWrapper* lpIO = new CIOWrapper(mpReadFile, mSimModel.mintSimModelEndian);
     814                 :            :         lpIO->BeginReadBlock(mintSimModelOffset,
     815                 :          0 :             mpaBCSets[xintIndex].mintRestraintsOffset);
     816                 :            :         //long start_location = lpIO->GetLocation();
     817         [ #  # ]:          0 :         for(UnsignedInt32 lintType = 0; lintType < xintRestraintTypesCount; lintType++) {
     818                 :          0 :             lpIO->Read(&xpaBCSetRestraintData[lintType].mintMemberType, 1);
     819                 :          0 :             lpIO->Read(&xpaBCSetRestraintData[lintType].mintMemberCount, 1);
     820                 :            : 
     821                 :          0 :             xpaBCSetRestraintData[lintType].mpaMemberIDs = lpIDs;
     822                 :          0 :             lintNumMembers = xpaBCSetRestraintData[lintType].mintMemberCount;
     823                 :            :             // Make sure the total number of node set members does not exceed
     824                 :            :             // what was specified in the node set table entry.
     825                 :          0 :             lintTotalMembers += lintNumMembers;
     826         [ #  # ]:          0 :             if(lintTotalMembers > mpaBCSets[xintIndex].mintRestraintMembersCount)
     827                 :          0 :                 throw CCubitFile::eFileReadError;
     828                 :            : 
     829                 :          0 :             lpIO->Read(xpaBCSetRestraintData[lintType].mpaMemberIDs, lintNumMembers);
     830                 :            : 
     831                 :          0 :             lpIDs = &lpIDs[lintNumMembers];
     832                 :            :         }
     833                 :            : 
     834                 :          0 :         lpIO->EndReadBlock();
     835         [ #  # ]:          0 :         delete lpIO;
     836                 :            :     }
     837                 :            :     else
     838                 :          0 :         xpaBCSetRestraintData = NULL;
     839                 :            : 
     840                 :            :     // read Loads
     841         [ #  # ]:          0 :     if(xintLoadTypesCount) 
     842                 :            :     {
     843                 :            :         // Resize the node set return buffer if necessary and then set the return
     844                 :            :         // pointers to the buffer.
     845                 :            :         xpaBCSetLoadData = AdjustBuffer(xintLoadTypesCount,
     846                 :          0 :             mBCSetBuff.mintNumLoadTypes, mBCSetBuff.mpaBCSetLoadData);
     847                 :            :         UnsignedInt32* lpIDs =
     848                 :          0 :             AdjustBuffer(mpaBCSets[xintIndex].mintLoadMembersCount,
     849                 :          0 :             mBCSetBuff.mintNumLoadMembers, mBCSetBuff.mpaintLoadMemberIDs);
     850                 :            : 
     851                 :            :         // Read the node set from the file.
     852                 :          0 :         UnsignedInt32 lintNumMembers, lintTotalMembers = 0;
     853         [ #  # ]:          0 :         CIOWrapper* lpIO = new CIOWrapper(mpReadFile, mSimModel.mintSimModelEndian);
     854                 :            :         lpIO->BeginReadBlock(mintSimModelOffset,
     855                 :          0 :             mpaBCSets[xintIndex].mintLoadsOffset);
     856                 :            :         //long start_location = lpIO->GetLocation();
     857         [ #  # ]:          0 :         for(UnsignedInt32 lintType = 0; lintType < xintLoadTypesCount; lintType++) {
     858                 :          0 :             lpIO->Read(&xpaBCSetLoadData[lintType].mintMemberType, 1);
     859                 :          0 :             lpIO->Read(&xpaBCSetLoadData[lintType].mintMemberCount, 1);
     860                 :            : 
     861                 :          0 :             xpaBCSetLoadData[lintType].mpaMemberIDs = lpIDs;
     862                 :          0 :             lintNumMembers = xpaBCSetLoadData[lintType].mintMemberCount;
     863                 :            :             // Make sure the total number of node set members does not exceed
     864                 :            :             // what was specified in the node set table entry.
     865                 :          0 :             lintTotalMembers += lintNumMembers;
     866         [ #  # ]:          0 :             if(lintTotalMembers > mpaBCSets[xintIndex].mintLoadMembersCount)
     867                 :          0 :                 throw CCubitFile::eFileReadError;
     868                 :            : 
     869                 :          0 :             lpIO->Read(xpaBCSetLoadData[lintType].mpaMemberIDs, lintNumMembers);
     870                 :            : 
     871                 :          0 :             lpIDs = &lpIDs[lintNumMembers];
     872                 :            :         }
     873                 :            : 
     874                 :          0 :         lpIO->EndReadBlock();
     875         [ #  # ]:          0 :         delete lpIO;
     876                 :            :     }
     877                 :            :     else
     878                 :          0 :         xpaBCSetLoadData = NULL;
     879                 :            :     
     880                 :            :     // read ContactPairs
     881         [ #  # ]:          0 :     if(xintContactPairTypesCount) 
     882                 :            :     {
     883                 :            :         // Resize the node set return buffer if necessary and then set the return
     884                 :            :         // pointers to the buffer.
     885                 :            :         xpaBCSetContactPairData = AdjustBuffer(xintContactPairTypesCount,
     886                 :          0 :             mBCSetBuff.mintNumContactPairTypes, mBCSetBuff.mpaBCSetContactPairData);
     887                 :            :         UnsignedInt32* lpIDs =
     888                 :          0 :             AdjustBuffer(mpaBCSets[xintIndex].mintContactPairMembersCount,
     889                 :          0 :             mBCSetBuff.mintNumContactPairMembers, mBCSetBuff.mpaintContactPairMemberIDs);
     890                 :            : 
     891                 :            :         // Read the node set from the file.
     892                 :          0 :         UnsignedInt32 lintNumMembers, lintTotalMembers = 0;
     893         [ #  # ]:          0 :         CIOWrapper* lpIO = new CIOWrapper(mpReadFile, mSimModel.mintSimModelEndian);
     894                 :            :         lpIO->BeginReadBlock(mintSimModelOffset,
     895                 :          0 :             mpaBCSets[xintIndex].mintContactPairsOffset);
     896                 :            :         //long start_location = lpIO->GetLocation();
     897         [ #  # ]:          0 :         for(UnsignedInt32 lintType = 0; lintType < xintContactPairTypesCount; lintType++) {
     898                 :          0 :             lpIO->Read(&xpaBCSetContactPairData[lintType].mintMemberType, 1);
     899                 :          0 :             lpIO->Read(&xpaBCSetContactPairData[lintType].mintMemberCount, 1);
     900                 :            : 
     901                 :          0 :             xpaBCSetContactPairData[lintType].mpaMemberIDs = lpIDs;
     902                 :          0 :             lintNumMembers = xpaBCSetContactPairData[lintType].mintMemberCount;
     903                 :            :             // Make sure the total number of node set members does not exceed
     904                 :            :             // what was specified in the node set table entry.
     905                 :          0 :             lintTotalMembers += lintNumMembers;
     906         [ #  # ]:          0 :             if(lintTotalMembers > mpaBCSets[xintIndex].mintContactPairMembersCount)
     907                 :          0 :                 throw CCubitFile::eFileReadError;
     908                 :            : 
     909                 :          0 :             lpIO->Read(xpaBCSetContactPairData[lintType].mpaMemberIDs, lintNumMembers);
     910                 :            : 
     911                 :          0 :             lpIDs = &lpIDs[lintNumMembers];
     912                 :            :         }
     913                 :            : 
     914                 :          0 :         lpIO->EndReadBlock();
     915         [ #  # ]:          0 :         delete lpIO;
     916                 :            :     }
     917                 :            :     else
     918                 :          0 :         xpaBCSetContactPairData = NULL;
     919                 :            : 
     920                 :          0 : }
     921                 :            : 
     922                 :          0 : void CSimModel::ReadMaterial(UnsignedInt32 xintIndex,
     923                 :            :                              UnsignedInt32& xintMaterialID,
     924                 :            :                              UnsignedInt32& xintMaterialUniqueID,
     925                 :            :                              UnsignedInt32& xintPropertiesCount,
     926                 :            :                              SMaterialData*& xpaMaterialData)
     927                 :            : {
     928         [ #  # ]:          0 :     if(!mpReadFile)
     929                 :          0 :         throw CCubitFile::eFileReadError;
     930         [ #  # ]:          0 :     if(xintIndex >= mSimModel.mintMaterialCount)
     931                 :          0 :         throw CCubitFile::eNotFound;
     932         [ #  # ]:          0 :     if(!mpaMaterials)
     933                 :          0 :         throw CCubitFile::eOrderError;
     934                 :            : 
     935                 :          0 :     xintMaterialID = mpaMaterials[xintIndex].mintMaterialID;
     936                 :          0 :     xintMaterialUniqueID = mpaMaterials[xintIndex].mintMaterialUniqueID;
     937                 :          0 :     xintPropertiesCount = mpaMaterials[xintIndex].mintMaterialPropertiesCount;
     938                 :            : 
     939                 :            :     // read material data
     940         [ #  # ]:          0 :     if(xintPropertiesCount) 
     941                 :            :     {
     942                 :            :         // Resize the material return buffer if necessary and then set the return
     943                 :            :         // pointers to the buffer.
     944                 :            :         xpaMaterialData = AdjustBuffer(xintPropertiesCount,
     945                 :          0 :             mMaterialBuff.mintNumDataTypes, mMaterialBuff.mpaMaterialData);
     946                 :            :         
     947                 :            :         double* lpData =
     948                 :          0 :             AdjustBuffer(mpaMaterials[xintIndex].mintPropertyDataCount,
     949                 :          0 :                 mMaterialBuff.mintNumDataMembers, mMaterialBuff.mpadblData);
     950                 :            : 
     951                 :            : 
     952                 :            :         // Read the material property data from the file.
     953                 :          0 :         UnsignedInt32 lintNumMembers, lintTotalMembers = 0;
     954         [ #  # ]:          0 :         CIOWrapper* lpIO = new CIOWrapper(mpReadFile, mSimModel.mintSimModelEndian);
     955                 :            :         lpIO->BeginReadBlock(mintSimModelOffset,
     956                 :          0 :             mpaMaterials[xintIndex].mintMaterialPropertiesOffset);
     957                 :            : 
     958                 :            :         //long start_location = lpIO->GetLocation();
     959         [ #  # ]:          0 :         for(UnsignedInt32 lintType = 0; lintType < xintPropertiesCount; lintType++) {
     960                 :          0 :             lpIO->Read(&xpaMaterialData[lintType].mintMemberType, 1);
     961                 :          0 :             lpIO->Read(&xpaMaterialData[lintType].mintMemberRows, 1);
     962                 :          0 :             lpIO->Read(&xpaMaterialData[lintType].mintMemberColumns, 1);
     963                 :            : 
     964                 :          0 :             xpaMaterialData[lintType].mpadblMemberData = lpData;
     965                 :            : 
     966                 :          0 :             lintNumMembers = xpaMaterialData[lintType].mintMemberRows *
     967                 :          0 :                 xpaMaterialData[lintType].mintMemberColumns;
     968                 :            : 
     969                 :            :             // Make sure the total number of material members does not exceed
     970                 :            :             // what was specified in the material table entry.
     971                 :          0 :             lintTotalMembers += lintNumMembers;
     972         [ #  # ]:          0 :             if(lintTotalMembers > mpaMaterials[xintIndex].mintPropertyDataCount)
     973                 :          0 :                 throw CCubitFile::eFileReadError;
     974                 :            :             
     975                 :          0 :             lpIO->Read(xpaMaterialData[lintType].mpadblMemberData,
     976                 :          0 :                        xpaMaterialData[lintType].mintMemberRows *
     977                 :          0 :                         xpaMaterialData[lintType].mintMemberColumns);
     978                 :            : 
     979                 :          0 :             lpData = &lpData[lintNumMembers];
     980                 :            :         }
     981                 :            : 
     982                 :          0 :         lpIO->EndReadBlock();
     983         [ #  # ]:          0 :         delete lpIO;
     984                 :            :     }
     985                 :            :     else
     986                 :          0 :         xpaMaterialData = NULL;
     987                 :          0 : }
     988                 :            : 
     989                 :          0 : void CSimModel::ReadConstraint(UnsignedInt32 xintIndex,
     990                 :            :                                UnsignedInt32& xintConstraintID, UnsignedInt32& xintConstraintUniqueID,
     991                 :            :                                UnsignedInt32& xintConstraintType,
     992                 :            :                                UnsignedInt32& xintIndependentTypeCount, SConstraintData*& xpaIndependentData,
     993                 :            :                                UnsignedInt32& xintDependentTypeCount, SConstraintData*& xpaDependentData)
     994                 :            : {
     995         [ #  # ]:          0 :     if(!mpReadFile)
     996                 :          0 :         throw CCubitFile::eFileReadError;
     997         [ #  # ]:          0 :     if(xintIndex >= mSimModel2.mintConstraintCount)
     998                 :          0 :         throw CCubitFile::eNotFound;
     999         [ #  # ]:          0 :     if(!mpaConstraints)
    1000                 :          0 :         throw CCubitFile::eOrderError;
    1001                 :            : 
    1002                 :          0 :     xintConstraintID = mpaConstraints[xintIndex].mintConstraintID;
    1003                 :          0 :     xintConstraintUniqueID = mpaConstraints[xintIndex].mintConstraintUniqueID;
    1004                 :          0 :     xintConstraintType = mpaConstraints[xintIndex].mintConstraintType;
    1005                 :          0 :     xintIndependentTypeCount = mpaConstraints[xintIndex].mintIndependentTypeCount;
    1006                 :          0 :     xintDependentTypeCount = mpaConstraints[xintIndex].mintDependentTypeCount;
    1007                 :            : 
    1008                 :            :     // read Dependent Constraint data
    1009         [ #  # ]:          0 :     if(xintDependentTypeCount) 
    1010                 :            :     {
    1011                 :            :         // Resize the Constraint return buffer if necessary and then set the return
    1012                 :            :         // pointers to the buffer.
    1013                 :            :         xpaDependentData = AdjustBuffer(xintDependentTypeCount,
    1014                 :          0 :             mConstraintBuff.mintNumDependentTypes, mConstraintBuff.mpaDependentData);
    1015                 :            :         UnsignedInt32* lpIDs =
    1016                 :          0 :             AdjustBuffer(mpaConstraints[xintIndex].mintDependentTypeCount,
    1017                 :          0 :             mConstraintBuff.mintNumDependentMembers, mConstraintBuff.mpaintDependentIDs);
    1018                 :            : 
    1019                 :            :         // Read the Constraint property data from the file.
    1020                 :          0 :         UnsignedInt32 lintNumMembers, lintTotalMembers = 0;
    1021         [ #  # ]:          0 :         CIOWrapper* lpIO = new CIOWrapper(mpReadFile, mSimModel.mintSimModelEndian);
    1022                 :            :         lpIO->BeginReadBlock(mintSimModelOffset,
    1023                 :          0 :             mpaConstraints[xintIndex].mintDependentDataOffset);
    1024                 :            : 
    1025                 :            :         //long start_location = lpIO->GetLocation();
    1026         [ #  # ]:          0 :         for(UnsignedInt32 lintType = 0; lintType < xintDependentTypeCount; lintType++)
    1027                 :            :         {
    1028                 :          0 :             lpIO->Read(&xpaDependentData[lintType].mintMemberType, 1);
    1029                 :          0 :             lpIO->Read(&xpaDependentData[lintType].mintMemberCount, 1);
    1030                 :            : 
    1031                 :          0 :             xpaDependentData[lintType].mpaMemberIDs = lpIDs;
    1032                 :          0 :             lintNumMembers = xpaDependentData[lintType].mintMemberCount;
    1033                 :            :             // Make sure the total number of node set members does not exceed
    1034                 :            :             // what was specified in the node set table entry.
    1035                 :          0 :             lintTotalMembers += lintNumMembers;
    1036         [ #  # ]:          0 :             if(lintTotalMembers > mpaConstraints[xintIndex].mintDependentTypeCount)
    1037                 :          0 :                 throw CCubitFile::eFileReadError;
    1038                 :            : 
    1039                 :          0 :             lpIO->Read(xpaDependentData[lintType].mpaMemberIDs, lintNumMembers);
    1040                 :            : 
    1041                 :          0 :             lpIDs = &lpIDs[lintNumMembers];
    1042                 :            :         }
    1043                 :            : 
    1044                 :          0 :         lpIO->EndReadBlock();
    1045         [ #  # ]:          0 :         delete lpIO;
    1046                 :            :     }
    1047                 :            :     else
    1048                 :          0 :         xpaDependentData = NULL;
    1049                 :            : 
    1050                 :            :     // read Independent Constraint data
    1051         [ #  # ]:          0 :     if(xintIndependentTypeCount) 
    1052                 :            :     {
    1053                 :            :         // Resize the Constraint return buffer if necessary and then set the return
    1054                 :            :         // pointers to the buffer.
    1055                 :            :         xpaIndependentData = AdjustBuffer(xintIndependentTypeCount,
    1056                 :          0 :             mConstraintBuff.mintNumIndependentTypes, mConstraintBuff.mpaIndependentData);
    1057                 :            :         UnsignedInt32* lpIDs =
    1058                 :          0 :             AdjustBuffer(mpaConstraints[xintIndex].mintIndependentTypeCount,
    1059                 :          0 :             mConstraintBuff.mintNumIndependentMembers, mConstraintBuff.mpaintIndependentIDs);
    1060                 :            : 
    1061                 :            :         // Read the Constraint property data from the file.
    1062                 :          0 :         UnsignedInt32 lintNumMembers, lintTotalMembers = 0;
    1063         [ #  # ]:          0 :         CIOWrapper* lpIO = new CIOWrapper(mpReadFile, mSimModel.mintSimModelEndian);
    1064                 :            :         lpIO->BeginReadBlock(mintSimModelOffset,
    1065                 :          0 :             mpaConstraints[xintIndex].mintIndependentDataOffset);
    1066                 :            : 
    1067                 :            :         //long start_location = lpIO->GetLocation();
    1068         [ #  # ]:          0 :         for(UnsignedInt32 lintType = 0; lintType < xintIndependentTypeCount; lintType++)
    1069                 :            :         {
    1070                 :          0 :             lpIO->Read(&xpaIndependentData[lintType].mintMemberType, 1);
    1071                 :          0 :             lpIO->Read(&xpaIndependentData[lintType].mintMemberCount, 1);
    1072                 :            : 
    1073                 :          0 :             xpaIndependentData[lintType].mpaMemberIDs = lpIDs;
    1074                 :          0 :             lintNumMembers = xpaIndependentData[lintType].mintMemberCount;
    1075                 :            :             // Make sure the total number of node set members does not exceed
    1076                 :            :             // what was specified in the node set table entry.
    1077                 :          0 :             lintTotalMembers += lintNumMembers;
    1078         [ #  # ]:          0 :             if(lintTotalMembers > mpaConstraints[xintIndex].mintIndependentTypeCount)
    1079                 :          0 :                 throw CCubitFile::eFileReadError;
    1080                 :            : 
    1081                 :          0 :             lpIO->Read(xpaIndependentData[lintType].mpaMemberIDs, lintNumMembers);
    1082                 :            : 
    1083                 :          0 :             lpIDs = &lpIDs[lintNumMembers];
    1084                 :            :         }
    1085                 :            : 
    1086                 :          0 :         lpIO->EndReadBlock();
    1087         [ #  # ]:          0 :         delete lpIO;
    1088                 :            :     }
    1089                 :            :     else
    1090                 :          0 :         xpaIndependentData = NULL;
    1091                 :            : 
    1092                 :          0 : }
    1093                 :            : 
    1094                 :          0 : void CSimModel::EndRead()
    1095                 :            : {
    1096                 :          0 :     mpReadFile = NULL;
    1097                 :          0 : }
    1098                 :            : 
    1099                 :            : ///////////////////////////////////////////////////////////////////////////////
    1100                 :            : // Meta-Data Functions
    1101                 :            : ///////////////////////////////////////////////////////////////////////////////
    1102                 :            : 
    1103                 :          0 : CMetaData& CSimModel::GetBCMetaData()
    1104                 :            : {
    1105                 :          0 :     return mBCMetaData;
    1106                 :            : }
    1107                 :            : 
    1108                 :          0 : CMetaData& CSimModel::GetICMetaData()
    1109                 :            : {
    1110                 :          0 :     return mICMetaData;
    1111                 :            : }
    1112                 :            : 
    1113                 :          0 : CMetaData& CSimModel::GetBCSetMetaData()
    1114                 :            : {
    1115                 :          0 :     return mBCSetMetaData;
    1116                 :            : }
    1117                 :            : 
    1118                 :          0 : CMetaData& CSimModel::GetMaterialMetaData()
    1119                 :            : {
    1120                 :          0 :     return mMaterialMetaData;
    1121                 :            : }
    1122                 :            : 
    1123                 :          0 : CMetaData& CSimModel::GetAmplitudeMetaData()
    1124                 :            : {
    1125                 :          0 :     return mAmplitudeMetaData;
    1126                 :            : }
    1127                 :            : 
    1128                 :          0 : CMetaData& CSimModel::GetConstraintMetaData()
    1129                 :            : {
    1130                 :          0 :     return mConstraintMetaData;
    1131                 :            : }
    1132                 :            : 

Generated by: LCOV version 1.11