From 382f1da19323a6219439c53dd91e7e002ac58d20 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 2 Aug 2019 17:20:18 +0200
Subject: [PATCH] ENH: rationalize cloud method inheritance

- a top-level cloud::nParcels() virtual, which is overloaded by the
  first level of Cloud inheritance. This permits quick determination of
  cloud sizes, even when retrieved from registry with the base level.
  Eg,
      cloud* cldPtr = mesh.cfindObject<cloud>("myCloud");
      label nParcels = (cldPtr ? cldPtr->nParcels() : 0);

- make writeLagrangianPositions on by default unless explicitly
  disabled in the InfoSwitches.

  Flag output errors (where neither coordinates nor positions are
  written) with Fatal.

- additional IOField helper functions in cloud

STYLE: simplify iterator inheritance
---
 src/runTimePostProcessing/geometryCloud.C       | 2 +-
 src/runTimePostProcessing/geometryCloudGather.C | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/runTimePostProcessing/geometryCloud.C b/src/runTimePostProcessing/geometryCloud.C
index c60ac2f..7a0e37f 100644
--- a/src/runTimePostProcessing/geometryCloud.C
+++ b/src/runTimePostProcessing/geometryCloud.C
@@ -159,7 +159,7 @@ addGeometry
 
     objPtr->writeObjects(obrTmp);
 
-    const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
+    const auto* pointsPtr = cloud::findIOPosition(obrTmp);
 
     if (!pointsPtr)
     {
diff --git a/src/runTimePostProcessing/geometryCloudGather.C b/src/runTimePostProcessing/geometryCloudGather.C
index c8eb4e0..9abb710 100644
--- a/src/runTimePostProcessing/geometryCloudGather.C
+++ b/src/runTimePostProcessing/geometryCloudGather.C
@@ -46,7 +46,7 @@ Foam::functionObjects::runTimePostPro::geometryCloud::gatherCloud
     auto multiPiece = vtkSmartPointer<vtkMultiPieceDataSet>::New();
     multiPiece->SetNumberOfPieces(Pstream::nProcs());
 
-    const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
+    const auto* pointsPtr = cloud::findIOPosition(obrTmp);
 
     if (!needsCollective())
     {
-- 
GitLab