Read command and execute. Return true if ok, false otherwise.
| 413 | |
| 414 | // Read command and execute. Return true if ok, false otherwise. |
| 415 | bool doCommand |
| 416 | ( |
| 417 | const polyMesh& mesh, |
| 418 | const word& setType, |
| 419 | const word& setName, |
| 420 | const word& actionName, |
| 421 | const bool writeVTKFile, |
| 422 | const bool writeCurrentTime, |
| 423 | const bool noSync, |
| 424 | Istream& is |
| 425 | ) |
| 426 | { |
| 427 | // Get some size estimate for set. |
| 428 | const globalMeshData& parData = mesh.globalData(); |
| 429 | |
| 430 | label typSize = |
| 431 | max |
| 432 | ( |
| 433 | parData.nTotalCells(), |
| 434 | max |
| 435 | ( |
| 436 | parData.nTotalFaces(), |
| 437 | parData.nTotalPoints() |
| 438 | ) |
| 439 | ) |
| 440 | / (10*Pstream::nProcs()); |
| 441 | |
| 442 | |
| 443 | bool ok = true; |
| 444 | |
| 445 | // Set to work on |
| 446 | autoPtr<topoSet> currentSetPtr; |
| 447 | |
| 448 | word sourceType; |
| 449 | |
| 450 | try |
| 451 | { |
| 452 | topoSetSource::setAction action = |
| 453 | topoSetSource::toAction(actionName); |
| 454 | |
| 455 | |
| 456 | IOobject::readOption r; |
| 457 | |
| 458 | if (action == topoSetSource::REMOVE) |
| 459 | { |
| 460 | removeSet(mesh, setType, setName); |
| 461 | } |
| 462 | else if |
| 463 | ( |
| 464 | (action == topoSetSource::NEW) |
| 465 | || (action == topoSetSource::CLEAR) |
| 466 | ) |
| 467 | { |
| 468 | r = IOobject::NO_READ; |
| 469 | currentSetPtr = topoSet::New(setType, mesh, setName, typSize); |
| 470 | } |
| 471 | else |
| 472 | { |
no test coverage detected