| 3293 | // |
| 3294 | |
| 3295 | int BackgroundMesh::record() { |
| 3296 | Domain* domain = OPS_GetDomain(); |
| 3297 | if (domain == 0) return 0; |
| 3298 | int ndm = OPS_GetNDM(); |
| 3299 | |
| 3300 | double timestamp = domain->getCurrentTime(); |
| 3301 | currentTime = timestamp; |
| 3302 | |
| 3303 | // record |
| 3304 | for (int i = 0; i < (int)recorders.size(); ++i) { |
| 3305 | if (recorders[i] != 0) { |
| 3306 | if (recorders[i]->record(domain->getCommitTag(), |
| 3307 | currentTime)) { |
| 3308 | opserr << "WARNING: failed to record -- " |
| 3309 | "BgMesh::gridEles\n"; |
| 3310 | return -1; |
| 3311 | } |
| 3312 | } |
| 3313 | } |
| 3314 | |
| 3315 | // record time |
| 3316 | if (theFile.good() == false) { |
| 3317 | return 0; |
| 3318 | } |
| 3319 | theFile << timestamp << " "; |
| 3320 | |
| 3321 | // record range |
| 3322 | int numRange = 1; |
| 3323 | double range = bsize; |
| 3324 | if (recordRange > 0) { |
| 3325 | numRange = (int)ceil(recordRange / bsize); |
| 3326 | range = recordRange; |
| 3327 | } |
| 3328 | |
| 3329 | // record wave height and velocity |
| 3330 | for (int i = 0; i < (int)locs.size(); i += ndm) { |
| 3331 | // particles in range |
| 3332 | VDouble crds(ndm); |
| 3333 | for (int j = 0; j < ndm; ++j) { |
| 3334 | crds[j] = locs[i + j]; |
| 3335 | } |
| 3336 | |
| 3337 | VInt index; |
| 3338 | lowerIndex(crds, index); |
| 3339 | |
| 3340 | VInt minind = index, maxind = index; |
| 3341 | minind -= numRange; |
| 3342 | maxind += numRange + 1; |
| 3343 | |
| 3344 | VParticle pts; |
| 3345 | gatherParticles(minind, maxind, pts); |
| 3346 | |
| 3347 | // velocity |
| 3348 | VDouble vel(ndm); |
| 3349 | double wt = 0.0; |
| 3350 | |
| 3351 | // get information |
| 3352 | for (int j = 0; j < (int)pts.size(); ++j) { |
nothing calls this directly
no test coverage detected