| 121 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 122 | |
| 123 | bool triSurface::readAC(const fileName& ACfileName) |
| 124 | { |
| 125 | IFstream ACfile(ACfileName); |
| 126 | |
| 127 | if (!ACfile.good()) |
| 128 | { |
| 129 | FatalErrorInFunction |
| 130 | << "Cannot read file " << ACfileName |
| 131 | << exit(FatalError); |
| 132 | } |
| 133 | |
| 134 | string line; |
| 135 | ACfile.getLine(line); |
| 136 | |
| 137 | string version = line.substr(4); |
| 138 | |
| 139 | if (version != "b") |
| 140 | { |
| 141 | WarningInFunction |
| 142 | << "When reading AC3D file " << ACfileName |
| 143 | << " read header " << line << " with version " << version |
| 144 | << endl << "Only tested reading with version 'b'." |
| 145 | << " This might give problems" << endl; |
| 146 | } |
| 147 | |
| 148 | string cmd; |
| 149 | |
| 150 | string args; |
| 151 | |
| 152 | if (!readUpto("OBJECT", ACfile, args) || (args != "world")) |
| 153 | { |
| 154 | FatalErrorInFunction |
| 155 | << "Cannot find \"OBJECT world\" in file " << ACfileName |
| 156 | << exit(FatalError); |
| 157 | } |
| 158 | |
| 159 | // Number of kids = patches |
| 160 | |
| 161 | readUpto("kids", ACfile, args, ""); |
| 162 | |
| 163 | label nPatches = parseInt(args); |
| 164 | |
| 165 | // Storage for patches and unmerged points and faces |
| 166 | |
| 167 | DynamicList<point> points; |
| 168 | DynamicList<labelledTri> faces; |
| 169 | geometricSurfacePatchList patches(nPatches); |
| 170 | |
| 171 | |
| 172 | // Start of vertices for object/patch |
| 173 | label patchStartVert = 0; |
| 174 | |
| 175 | for (label patchi = 0; patchi < nPatches; patchi++) |
| 176 | { |
| 177 | readUpto |
| 178 | ( |
| 179 | "OBJECT", |
| 180 | ACfile, |
no test coverage detected