diff --git a/Code/redblood/CellArmy.h b/Code/redblood/CellArmy.h index aae4ac4cb..4b74b3011 100644 --- a/Code/redblood/CellArmy.h +++ b/Code/redblood/CellArmy.h @@ -220,7 +220,7 @@ namespace hemelb { throw Exception() << "Process " << fieldData.GetDomain().GetCommunicator().Rank() << " cannot determine the owner of cell " << cell->GetTag() - << " with barycenter " << cell->GetBarycenter(); + << " with barycentre " << cell->GetBarycentre(); } return owner; }; @@ -308,10 +308,10 @@ namespace hemelb auto const i_end = cells.cend(); while (i_first != i_end) { - auto const barycenter = (*i_first)->GetBarycenter(); - auto checkCell = [&barycenter](FlowExtension const &flow) + auto const barycentre = (*i_first)->GetBarycentre(); + auto checkCell = [&barycentre](FlowExtension const &flow) { - return contains(flow, barycenter); + return contains(flow, barycentre); }; // save current iterator and increment before potential removal. // removing the cell from the set should invalidate only the relevant iterator. @@ -320,7 +320,7 @@ namespace hemelb if (std::find_if(outlets.begin(), outlets.end(), checkCell) != outlets.end()) { std::stringstream message; - message << "Removing cell "<< (*i_current)->GetTag() << " at " << barycenter; + message << "Removing cell "<< (*i_current)->GetTag() << " at " << barycentre; log::Logger::Log(message.str()); cellDnC.remove(*i_current); @@ -335,18 +335,18 @@ namespace hemelb template void CellArmy::AddCell(CellContainer::value_type cell) { - auto const barycenter = cell->GetBarycenter(); + auto const barycentre = cell->GetBarycentre(); //! @todo: #623 AddCell should only be called if the subdomain contains the relevant RBC inlet - // TODO: #759 truncation of barycenter - auto const iter = globalCoordsToProcMap.find(Vec16{barycenter}); + // TODO: #759 truncation of barycentre + auto const iter = globalCoordsToProcMap.find(Vec16{barycentre}); bool insertAtThisRank = (iter != globalCoordsToProcMap.end()) && (iter->second == neighbourDependenciesGraph.Rank()); if (insertAtThisRank) { log::Logger::Log("Adding cell at (%f, %f, %f)", - barycenter.x(), - barycenter.y(), - barycenter.z()); + barycentre.x(), + barycentre.y(), + barycentre.z()); cellDnC.insert(cell); cells.insert(cell); @@ -365,9 +365,9 @@ namespace hemelb if (numCellsAdded != 1) { log::Logger::Log("Failed to add cell at (%f, %f, %f). It was added %d times.", - barycenter.x(), - barycenter.y(), - barycenter.z(), + barycentre.x(), + barycentre.y(), + barycentre.z(), numCellsAdded); hemelb::net::MpiEnvironment::Abort(-1); diff --git a/Code/redblood/CellBase.cc b/Code/redblood/CellBase.cc index 9fcbbf0b4..529e85754 100644 --- a/Code/redblood/CellBase.cc +++ b/Code/redblood/CellBase.cc @@ -82,9 +82,9 @@ namespace hemelb { return static_cast(data->vertices.size()); } - MeshData::Vertices::value_type CellBase::GetBarycenter() const + MeshData::Vertices::value_type CellBase::GetBarycentre() const { - return barycenter(data->vertices); + return barycentre(data->vertices); } //! Scale to apply to the template mesh @@ -101,21 +101,21 @@ namespace hemelb void CellBase::operator*=(Dimensionless const &scaleIn) { - auto const barycenter = GetBarycenter(); + auto const barycentre = GetBarycentre(); for (auto &vertex : data->vertices) { - vertex = (vertex - barycenter) * scaleIn + barycenter; + vertex = (vertex - barycentre) * scaleIn + barycentre; } } void CellBase::operator*=(util::Matrix3D const &rotation) { - auto const barycenter = GetBarycenter(); + auto const barycentre = GetBarycentre(); for (auto &vertex : data->vertices) { - rotation.timesVector(vertex - barycenter, vertex); - vertex += barycenter; + rotation.timesVector(vertex - barycentre, vertex); + vertex += barycentre; } } void CellBase::operator+=(LatticePosition const &offset) diff --git a/Code/redblood/CellBase.h b/Code/redblood/CellBase.h index fa14016aa..3bca0d38c 100644 --- a/Code/redblood/CellBase.h +++ b/Code/redblood/CellBase.h @@ -124,9 +124,9 @@ namespace hemelb return operator()(in); } - //! Scale mesh around barycenter + //! Scale mesh around barycentre void operator*=(Dimensionless const &); - //! Linear transform of each vertex, centered around barycenter + //! Linear transform of each vertex, centered around barycentre void operator*=(util::Matrix3D const &); //! Translate mesh void operator+=(LatticePosition const &offset); @@ -138,7 +138,7 @@ namespace hemelb //! Transform mesh void operator+=(std::vector const &displacements); - MeshData::Vertices::value_type GetBarycenter() const; + MeshData::Vertices::value_type GetBarycentre() const; LatticeVolume GetVolume() const { return volume(GetVertices(), GetTemplateMesh().GetFacets()); diff --git a/Code/redblood/CellControllerBuilder.cc b/Code/redblood/CellControllerBuilder.cc index 141f85dbb..c2b622f69 100644 --- a/Code/redblood/CellControllerBuilder.cc +++ b/Code/redblood/CellControllerBuilder.cc @@ -55,10 +55,10 @@ namespace hemelb::redblood { cell *= rotation; // Figure out size of cell alongst cylinder axis - auto const barycenter = cell.GetBarycenter(); - auto maxExtent = [barycenter, &flowExtension](LatticePosition const pos) + auto const barycentre = cell.GetBarycentre(); + auto maxExtent = [barycentre, &flowExtension](LatticePosition const pos) { - return std::max(Dot(pos - barycenter, flowExtension.normal), 0e0); + return std::max(Dot(pos - barycentre, flowExtension.normal), 0e0); }; auto const maxZ = *std::max_element(cell.GetVertices().begin(), @@ -69,7 +69,7 @@ namespace hemelb::redblood { }); // Place cell as close as possible to 0 of fade length cell += flowExtension.origin - + flowExtension.normal * (flowExtension.fadeLength - maxExtent(maxZ)) - barycenter + + flowExtension.normal * (flowExtension.fadeLength - maxExtent(maxZ)) - barycentre + rotateToFlow * translation; // fail if any node outside flow extension diff --git a/Code/redblood/CellIO.cc b/Code/redblood/CellIO.cc index 736221e1b..dcf15533a 100644 --- a/Code/redblood/CellIO.cc +++ b/Code/redblood/CellIO.cc @@ -104,7 +104,7 @@ namespace hemelb::redblood { for (auto [i, cell]: util::enumerate(cells)) { std::byte tag[UUID_STRING_LEN]; boost::uuids::to_chars(cell->GetTag(), reinterpret_cast(tag)); - xdrWriter << std::span(tag, UUID_STRING_LEN) << cell->GetBarycenter(); + xdrWriter << std::span(tag, UUID_STRING_LEN) << cell->GetBarycentre(); } auto bary_filename = rbcOutputDir / "barycentres.rbc"; diff --git a/Code/redblood/FaderCell.cc b/Code/redblood/FaderCell.cc index 003f2d40f..b9c1be254 100644 --- a/Code/redblood/FaderCell.cc +++ b/Code/redblood/FaderCell.cc @@ -12,11 +12,11 @@ namespace hemelb { LatticeEnergy FaderCell::operator()() const { - auto const barycenter = wrappee->GetBarycenter(); + auto const barycentre = wrappee->GetBarycentre(); auto const energy = wrappee->Energy(); for (auto const& extension : *iolets) { - auto const weight = linearWeight(extension, barycenter); + auto const weight = linearWeight(extension, barycentre); if (weight > 1e-12) { return energy * weight; @@ -27,11 +27,11 @@ namespace hemelb LatticeEnergy FaderCell::operator()(std::vector &forces) const { - auto const barycenter = wrappee->GetBarycenter(); + auto const barycentre = wrappee->GetBarycentre(); auto const energy = wrappee->Energy(forces); for (auto const& extension : *iolets) { - auto const weight = linearWeight(extension, barycenter); + auto const weight = linearWeight(extension, barycentre); if (weight > 1e-12) { for (auto& force : forces) diff --git a/Code/redblood/Mesh.cc b/Code/redblood/Mesh.cc index fce0558d4..393e61da8 100644 --- a/Code/redblood/Mesh.cc +++ b/Code/redblood/Mesh.cc @@ -25,15 +25,15 @@ namespace hemelb::redblood static_assert(std::is_same::value, "hemelb::redblood::IdType must be the same as vtkIdType"); - LatticePosition barycenter(MeshData::Vertices const &vertices) + LatticePosition barycentre(MeshData::Vertices const &vertices) { typedef MeshData::Vertices::value_type Vertex; return std::accumulate(vertices.begin(), vertices.end(), Vertex(0, 0, 0)) / Vertex::value_type(vertices.size()); } - LatticePosition barycenter(MeshData const &mesh) + LatticePosition barycentre(MeshData const &mesh) { - return barycenter(mesh.vertices); + return barycentre(mesh.vertices); } LatticeVolume volume(MeshData::Vertices const &vertices, MeshData::Facets const &facets) { @@ -160,22 +160,22 @@ namespace hemelb::redblood void Mesh::operator*=(Dimensionless const &scale) { - auto const barycenter = GetBarycenter(); + auto const barycentre = GetBarycentre(); for (auto &vertex : mesh->vertices) { - vertex = (vertex - barycenter) * scale + barycenter; + vertex = (vertex - barycentre) * scale + barycentre; } } void Mesh::operator*=(util::Matrix3D const &rotation) { - auto const barycenter = GetBarycenter(); + auto const barycentre = GetBarycentre(); for (auto &vertex : mesh->vertices) { - rotation.timesVector(vertex - barycenter, vertex); - vertex += barycenter; + rotation.timesVector(vertex - barycentre, vertex); + vertex += barycentre; } } diff --git a/Code/redblood/Mesh.h b/Code/redblood/Mesh.h index 1f88d1a1e..5fbda0dc2 100644 --- a/Code/redblood/Mesh.h +++ b/Code/redblood/Mesh.h @@ -46,13 +46,13 @@ namespace hemelb::redblood "Explicit type characteristics" ); - LatticePosition barycenter(MeshData const &mesh); - LatticePosition barycenter(MeshData::Vertices const &vertices); + LatticePosition barycentre(MeshData const &mesh); + LatticePosition barycentre(MeshData::Vertices const &vertices); LatticeVolume volume(MeshData const &mesh); LatticeVolume volume(MeshData::Vertices const &vertices, MeshData::Facets const &facets); LatticeArea area(MeshData const &mesh); LatticeArea area(MeshData::Vertices const &vertices, MeshData::Facets const &facets); - //! DEPRECATED. Orients facets outward, or inward. Algorithm cannot handle case of facet being coplanar with mesh barycenter. + //! DEPRECATED. Orients facets outward, or inward. Algorithm cannot handle case of facet being coplanar with mesh barycentre. unsigned orientFacets(MeshData &mesh, bool outward = true); //! Orients facets inwards/outwards using VTK algorithm to determining outward facing direction. MeshData object should have been constructed from vtkPolyData object. See readMeshDataFromVTKPolyData. unsigned orientFacets(MeshData &mesh, vtkPolyData &polydata, bool outward = true); @@ -126,10 +126,10 @@ namespace hemelb::redblood { } - //! Determines barycenter of mesh - LatticePosition GetBarycenter() const + //! Determines barycentre of mesh + LatticePosition GetBarycentre() const { - return barycenter(*mesh); + return barycentre(*mesh); } //! Computes volume of the mesh LatticeVolume GetVolume() const @@ -168,9 +168,9 @@ namespace hemelb::redblood return Mesh(*this, deepcopy_tag()); } - //! Scale mesh around barycenter + //! Scale mesh around barycentre void operator*=(Dimensionless const &scale); - //! Scale by matrix around barycenter + //! Scale by matrix around barycentre void operator*=(util::Matrix3D const &rotation); //! Translate mesh void operator+=(LatticePosition const &offset); diff --git a/Code/redblood/RBCInserter.h b/Code/redblood/RBCInserter.h index 455b578f1..c0dfdb6db 100644 --- a/Code/redblood/RBCInserter.h +++ b/Code/redblood/RBCInserter.h @@ -42,16 +42,16 @@ namespace hemelb::redblood * @param scale the scale of the cell to insert */ RBCInserter(std::function condition, std::unique_ptr cell) : - condition(std::move(condition)), cell(std::move(cell)), barycenter(this->cell->GetBarycenter()) + condition(std::move(condition)), cell(std::move(cell)), barycentre(this->cell->GetBarycentre()) { } RBCInserter(RBCInserter &&c) : condition(std::move(c.condition)), cell(std::move(c.cell)), - barycenter(c.barycenter) + barycentre(c.barycentre) { } RBCInserter(RBCInserter const&c) : - condition(c.condition), cell(c.cell->clone()), barycenter(c.barycenter) + condition(c.condition), cell(c.cell->clone()), barycentre(c.barycentre) { } virtual ~RBCInserter() = default; @@ -82,9 +82,9 @@ namespace hemelb::redblood if (condition()) { log::Logger::Log("Dropping one cell at (%f, %f, %f)", - barycenter.x(), - barycenter.y(), - barycenter.z()); + barycentre.x(), + barycentre.y(), + barycentre.z()); insertFn(drop()); } } @@ -99,8 +99,8 @@ namespace hemelb::redblood std::function condition; //! The shape of the cells to insert std::unique_ptr cell; - //! barycenter -- for logging - LatticePosition barycenter; + //! barycentre -- for logging + LatticePosition barycentre; }; //! Red blood cell inserter that adds random rotation and translation to each cell diff --git a/Code/redblood/buffer/Buffer.cc b/Code/redblood/buffer/Buffer.cc index 9d76d783e..21f56b32d 100644 --- a/Code/redblood/buffer/Buffer.cc +++ b/Code/redblood/buffer/Buffer.cc @@ -14,15 +14,15 @@ namespace hemelb::redblood::buffer { LatticeDistance maxCellRadius(CellBase const& cell) { - auto const barycenter = cell.GetBarycenter(); + auto const barycentre = cell.GetBarycentre(); auto const &vertices = cell.GetVertices(); auto const first = vertices.begin(); - auto dist = [&barycenter](LatticePosition const &a, LatticePosition const &b) + auto dist = [&barycentre](LatticePosition const &a, LatticePosition const &b) { - return (a-barycenter).GetMagnitudeSquared() < (b-barycenter).GetMagnitudeSquared(); + return (a-barycentre).GetMagnitudeSquared() < (b-barycentre).GetMagnitudeSquared(); }; LatticePosition const &max = *std::max_element(first, vertices.end(), dist); - return 4e0 * (max - barycenter).GetMagnitudeSquared(); + return 4e0 * (max - barycentre).GetMagnitudeSquared(); } template @@ -49,7 +49,7 @@ namespace hemelb::redblood::buffer auto const &normal = geometry->normal; auto getdist = [&normal](CellContainer::value_type const& c) { - return Dot(c->GetBarycenter(), normal); + return Dot(c->GetBarycentre(), normal); }; return orderedCell(getdist, virtuals); } @@ -59,7 +59,7 @@ namespace hemelb::redblood::buffer auto const &normal = geometry->normal; auto getdist = [&normal](const CellContainer::value_type& c) { - return -Dot(c->GetBarycenter(), normal); + return -Dot(c->GetBarycentre(), normal); }; return orderedCell(getdist, virtuals); } @@ -69,7 +69,7 @@ namespace hemelb::redblood::buffer justDropped = nearestCell(); virtuals.erase(justDropped); - lastZ = Dot(justDropped->GetBarycenter(), geometry->normal); + lastZ = Dot(justDropped->GetBarycentre(), geometry->normal); *justDropped += geometry->origin + geometry->normal * offset; return justDropped; } @@ -110,7 +110,7 @@ namespace hemelb::redblood::buffer lastCell = furthestCell(); } // add cell until outside geometry, including interaction radius buffer. - while (isDroppablePosition(lastCell->GetBarycenter() - geometry->normal * interactionRadius)) + while (isDroppablePosition(lastCell->GetBarycentre() - geometry->normal * interactionRadius)) { lastCell = insertCell(); } @@ -157,13 +157,13 @@ namespace hemelb::redblood::buffer } auto const normal = geometry->normal; - auto const zCell = Dot(normal, nearestCell()->GetBarycenter()); + auto const zCell = Dot(normal, nearestCell()->GetBarycentre()); if (not justDropped) { offset = -zCell; return; } - auto const zDropped = Dot(normal, justDropped->GetBarycenter() - geometry->origin) - offset; + auto const zDropped = Dot(normal, justDropped->GetBarycentre() - geometry->origin) - offset; // dropped cell moved forward but distance with next cell is small // Then movement must the smallest of: // - distance moved by dropped cell over last LB iteration diff --git a/Code/redblood/buffer/Buffer.h b/Code/redblood/buffer/Buffer.h index 875545cf5..13bbd7e67 100644 --- a/Code/redblood/buffer/Buffer.h +++ b/Code/redblood/buffer/Buffer.h @@ -101,7 +101,7 @@ namespace hemelb::redblood::buffer //! True if next cell can be dropped bool isDroppablePosition(CellContainer::value_type const &candidate) const { - return isDroppablePosition(candidate->GetBarycenter()); + return isDroppablePosition(candidate->GetBarycentre()); } //! True if position corresponds to that of a droppable cell //! This function works in the buffer's cartesian coordinates. It will take care of adding diff --git a/Code/redblood/buffer/Columns.cc b/Code/redblood/buffer/Columns.cc index 82b94669c..aaf554c7a 100644 --- a/Code/redblood/buffer/Columns.cc +++ b/Code/redblood/buffer/Columns.cc @@ -14,12 +14,12 @@ namespace hemelb::redblood::buffer LatticeDistance maxExtension(MeshData::Vertices const &vertices, LatticePosition const &direction) { - auto const barycenter = redblood::barycenter(vertices); + auto const barycentre = redblood::barycentre(vertices); LatticeDistance result(0); auto const normalised = direction.GetNormalised(); - auto maxdist = [&normalised, &result, &barycenter](LatticePosition const &b) + auto maxdist = [&normalised, &result, &barycentre](LatticePosition const &b) { - result = std::max(result, std::abs(Dot(normalised, b - barycenter))); + result = std::max(result, std::abs(Dot(normalised, b - barycentre))); }; std::for_each(vertices.begin(), vertices.end(), maxdist); return 2e0 * result; @@ -116,7 +116,7 @@ namespace hemelb::redblood::buffer // Cell is rotated to correct orientation *templateCell *= rotationMatrix(cellAxis, colAxis); // And centered at zero - *templateCell -= templateCell->GetBarycenter(); + *templateCell -= templateCell->GetBarycentre(); } CellContainer::value_type ColumnCellDrop::operator()() diff --git a/Code/tests/redblood/CellArmyTests.cc b/Code/tests/redblood/CellArmyTests.cc index 6813194f2..3130b90b4 100644 --- a/Code/tests/redblood/CellArmyTests.cc +++ b/Code/tests/redblood/CellArmyTests.cc @@ -164,7 +164,7 @@ namespace hemelb::tests CellChangeListener callback = [&barycentre](const CellContainer & container) { - barycentre = (*(container.begin()))->GetBarycenter(); + barycentre = (*(container.begin()))->GetBarycentre(); }; CellContainer intel; @@ -173,7 +173,7 @@ namespace hemelb::tests army.AddCellChangeListener(callback); army.NotifyCellChangeListeners(); - REQUIRE(barycentre == cell->GetBarycenter()); + REQUIRE(barycentre == cell->GetBarycentre()); } SECTION("testCellRemoval") { diff --git a/Code/tests/redblood/CellCellInteractionTests.cc b/Code/tests/redblood/CellCellInteractionTests.cc index c34d300fa..92455d912 100644 --- a/Code/tests/redblood/CellCellInteractionTests.cc +++ b/Code/tests/redblood/CellCellInteractionTests.cc @@ -157,7 +157,7 @@ namespace hemelb REQUIRE(cells.size() == 2); auto first = *cells.begin(); auto second = *std::next(cells.begin()); - if (first->GetBarycenter().GetMagnitude() > second->GetBarycenter().GetMagnitude()) + if (first->GetBarycentre().GetMagnitude() > second->GetBarycentre().GetMagnitude()) std::swap(first, second); DivideConquerCells dnc(cells, cutoff, halo); @@ -210,7 +210,7 @@ namespace hemelb // Figures out which cell is which auto firstCell = *cells.begin(); auto secondCell = *std::next(cells.begin()); - if (firstCell->GetBarycenter().GetMagnitude() > secondCell->GetBarycenter().GetMagnitude()) + if (firstCell->GetBarycentre().GetMagnitude() > secondCell->GetBarycentre().GetMagnitude()) { std::swap(firstCell, secondCell); } diff --git a/Code/tests/redblood/CellForceSpreadTests.cc b/Code/tests/redblood/CellForceSpreadTests.cc index d1f2db5cf..036b46d16 100644 --- a/Code/tests/redblood/CellForceSpreadTests.cc +++ b/Code/tests/redblood/CellForceSpreadTests.cc @@ -44,7 +44,7 @@ namespace hemelb::tests LatticeForceVector force_at_center(LatticePosition const &position) { - mesh += position - mesh.GetBarycenter(); + mesh += position - mesh.GetBarycentre(); helpers::ZeroOutForces(*latDat); details::spreadForce2Grid(std::shared_ptr(&mesh, [](CellBase*) diff --git a/Code/tests/redblood/CellIOTests.cc b/Code/tests/redblood/CellIOTests.cc index be3790580..e39eb9127 100644 --- a/Code/tests/redblood/CellIOTests.cc +++ b/Code/tests/redblood/CellIOTests.cc @@ -221,7 +221,7 @@ namespace hemelb::tests auto cell_summary = bci.ReadRows(Comms(), 0, 1); auto [uuid, bcpos] = cell_summary[0]; REQUIRE(uuid == cell->GetTag()); - REQUIRE(bcpos == ApproxV(cell->GetBarycenter())); + REQUIRE(bcpos == ApproxV(cell->GetBarycentre())); // Check mesh char tag[36+5]; diff --git a/Code/tests/redblood/CellInserterTests.cc b/Code/tests/redblood/CellInserterTests.cc index c17a9b140..24bfb1b11 100644 --- a/Code/tests/redblood/CellInserterTests.cc +++ b/Code/tests/redblood/CellInserterTests.cc @@ -131,13 +131,13 @@ namespace hemelb::tests 0), LatticePosition(0, 4, 0)); - auto const barycenter = cells["joe"]->GetBarycenter(); + auto const barycentre = cells["joe"]->GetBarycentre(); for (size_t i(0); i < 500; ++i) { auto const cell = inserter.drop(); - auto const n = cell->GetBarycenter(); - REQUIRE(std::abs(n.x() - barycenter.x()) <= 2e0); - REQUIRE(std::abs(n.y() - barycenter.y()) <= 4e0); - REQUIRE(Approx(barycenter.z()).margin(1e-8) == n.z()); + auto const n = cell->GetBarycentre(); + REQUIRE(std::abs(n.x() - barycentre.x()) <= 2e0); + REQUIRE(std::abs(n.y() - barycentre.y()) <= 4e0); + REQUIRE(Approx(barycentre.z()).margin(1e-8) == n.z()); } } @@ -173,7 +173,7 @@ namespace hemelb::tests REQUIRE(insertTranslated); insertTranslated(addCell); REQUIRE(current_cell); - auto const trans = cell0->GetBarycenter() - current_cell->GetBarycenter(); + auto const trans = cell0->GetBarycentre() - current_cell->GetBarycentre(); auto approx = Approx(0.0).margin(1e-8); REQUIRE(approx(0) == Dot(trans, util::Vector3D{0, 1, 1})); REQUIRE(approx(0.1 / 0.6 * 0.1 / 0.6 * 2e0) == trans.GetMagnitudeSquared()); @@ -185,7 +185,7 @@ namespace hemelb::tests REQUIRE(insertWithZ); insertWithZ(addCell); REQUIRE(current_cell); - auto const transZ = cell0->GetBarycenter() - current_cell->GetBarycenter(); + auto const transZ = cell0->GetBarycentre() - current_cell->GetBarycentre(); REQUIRE(approx(0.1 / 0.6 * std::sqrt(2)) == Dot(transZ, util::Vector3D{0, 1, 1})); REQUIRE(approx(0.1 / 0.6 * 0.1 / 0.6 * 3e0) == transZ.GetMagnitudeSquared()); } diff --git a/Code/tests/redblood/CellIntegrationTests.cc b/Code/tests/redblood/CellIntegrationTests.cc index 6a93d0308..4d7cc2eb1 100644 --- a/Code/tests/redblood/CellIntegrationTests.cc +++ b/Code/tests/redblood/CellIntegrationTests.cc @@ -74,21 +74,21 @@ namespace hemelb::tests auto& dom = fieldData.GetDomain(); auto const mid = LatticePosition(dom.GetGlobalSiteMaxes() + dom.GetGlobalSiteMins()) * 0.5; - (**cells.begin()) += mid - (*cells.begin())->GetBarycenter(); + (**cells.begin()) += mid - (*cells.begin())->GetBarycentre(); (**cells.begin()) += LatticePosition(0, 0, 8 - mid.z()); (**cells.begin()) *= 5.0; auto controller = std::make_shared(fieldData, cells, templates, timings); - auto const barycenter = (*cells.begin())->GetBarycenter(); + auto const barycentre = (*cells.begin())->GetBarycentre(); // run master->RegisterActor(*controller, 1); master->RunSimulation(); // check position of cell has changed - auto const moved = (*cells.begin())->GetBarycenter(); - REQUIRE(Approx(barycenter.x()).margin(1e-12) == moved.x()); - REQUIRE(Approx(barycenter.y()).margin(1e-12) == moved.y()); - REQUIRE(std::abs(barycenter.z() - moved.z()) > 1e-8); + auto const moved = (*cells.begin())->GetBarycentre(); + REQUIRE(Approx(barycentre.x()).margin(1e-12) == moved.x()); + REQUIRE(Approx(barycentre.y()).margin(1e-12) == moved.y()); + REQUIRE(std::abs(barycentre.z() - moved.z()) > 1e-8); // Check there is force on one of the lattice site near a // node node position is guessed at from geometry. This diff --git a/Code/tests/redblood/FadeInOutIntegrationTests.cc b/Code/tests/redblood/FadeInOutIntegrationTests.cc index 22035c108..0e4c33392 100644 --- a/Code/tests/redblood/FadeInOutIntegrationTests.cc +++ b/Code/tests/redblood/FadeInOutIntegrationTests.cc @@ -79,11 +79,11 @@ namespace hemelb::tests static LatticePosition first, current, tenth; static int iter = 0; if(iter == 0) { - first = cell->GetBarycenter(); + first = cell->GetBarycentre(); current = first; tenth = first; } - auto const position = cell->GetBarycenter(); + auto const position = cell->GetBarycentre(); REQUIRE(Approx(first.x()).margin(1e-8) == position.x()); REQUIRE(Approx(first.y()).margin(1e-8) == position.y()); REQUIRE(current.z() <= position.z()); @@ -116,7 +116,7 @@ namespace hemelb::tests } auto cell = *cells.begin(); auto const tag = cell->GetTag(); - auto const b = cell->GetBarycenter(); + auto const b = cell->GetBarycentre(); auto const v = cell->GetVolume(); auto const e = (*cell)(); HEMELB_CAPTURE5(iter, tag, b, v, e); diff --git a/Code/tests/redblood/FaderCellTests.cc b/Code/tests/redblood/FaderCellTests.cc index 0e1989458..e9647aa8b 100644 --- a/Code/tests/redblood/FaderCellTests.cc +++ b/Code/tests/redblood/FaderCellTests.cc @@ -68,7 +68,7 @@ namespace hemelb std::vector forces(2, zero); // No fading here auto approx = Approx(0.0).margin(1e-8); - *fadingCell += LatticePosition(5, 1, 1) - fadingCell->GetBarycenter(); + *fadingCell += LatticePosition(5, 1, 1) - fadingCell->GetBarycentre(); REQUIRE(approx(1e0) == fadingCell->Energy(forces)); REQUIRE(approx(0e0) == forces.front().x()); REQUIRE(approx(1e0) == forces.front().y()); @@ -80,7 +80,7 @@ namespace hemelb // Now fades to 0.7 forces = std::vector(2, zero); *fadingCell += LatticePosition(3.0 - inlet.fadeLength * 0.3, 1, 1) - - fadingCell->GetBarycenter(); + - fadingCell->GetBarycentre(); REQUIRE(approx(0.7 * 1e0) == fadingCell->Energy(forces)); REQUIRE(approx(0.7 * 0e0) == forces.front().x()); REQUIRE(approx(0.7 * 1e0) == forces.front().y()); @@ -92,7 +92,7 @@ namespace hemelb // fades to 0.7 in outlet forces = std::vector(2, zero); *fadingCell += LatticePosition(8.0 + inlet.fadeLength * 0.3, 1, 1) - - fadingCell->GetBarycenter(); + - fadingCell->GetBarycentre(); REQUIRE(approx(0.7 * 1e0) == fadingCell->Energy(forces)); REQUIRE(approx(0.7 * 0e0) == forces.front().x()); REQUIRE(approx(0.7 * 1e0) == forces.front().y()); diff --git a/Code/tests/redblood/LoadDeformedCellTests.cc b/Code/tests/redblood/LoadDeformedCellTests.cc index a725bfce8..3db5a5a61 100644 --- a/Code/tests/redblood/LoadDeformedCellTests.cc +++ b/Code/tests/redblood/LoadDeformedCellTests.cc @@ -79,9 +79,9 @@ namespace hemelb::tests *cell *= scale; *sadcell *= scale; *cell += converter.ConvertPositionToLatticeUnits(PhysicalPosition(0, 0, 0)) - - cell->GetBarycenter(); + - cell->GetBarycentre(); *sadcell += converter.ConvertPositionToLatticeUnits(PhysicalPosition(0, 0, 0)) - - sadcell->GetBarycenter(); + - sadcell->GetBarycentre(); io.writeFile("ideal.vtp", *cell, &converter); io.writeFile("deformed.vtp", *sadcell, &converter); @@ -119,7 +119,7 @@ namespace hemelb::tests // Recentre simulated cell io.writeFile("reformed.vtp", *sadcell, &converter); *sadcell += converter.ConvertPositionToLatticeUnits(PhysicalPosition(0, 0, 0)) - - sadcell->GetBarycenter(); + - sadcell->GetBarycentre(); io.writeFile("reformed_centered.vtp", *sadcell, &converter); // // TODO: Align both cells for comparison diff --git a/Code/tests/redblood/RedBloodMeshTests.cc b/Code/tests/redblood/RedBloodMeshTests.cc index cbe01daf3..7bf4f8e05 100644 --- a/Code/tests/redblood/RedBloodMeshTests.cc +++ b/Code/tests/redblood/RedBloodMeshTests.cc @@ -81,12 +81,12 @@ namespace hemelb } } - SECTION("testBarycenter") { + SECTION("testBarycentre") { LatticePosition a(0.1, 0.1, 0.1), b(1, 0, 0), c(0, 1, 0), d(0, 0, 1); LatticePosition const expected = (a + b + c + d) * 0.25; - REQUIRE(std::abs(barycenter(mesh)[0] - expected[0]) < 1e-8); - REQUIRE(std::abs(barycenter(mesh)[1] - expected[1]) < 1e-8); - REQUIRE(std::abs(barycenter(mesh)[2] - expected[2]) < 1e-8); + REQUIRE(std::abs(barycentre(mesh)[0] - expected[0]) < 1e-8); + REQUIRE(std::abs(barycentre(mesh)[1] - expected[1]) < 1e-8); + REQUIRE(std::abs(barycentre(mesh)[2] - expected[2]) < 1e-8); } SECTION("testScaling") { @@ -95,11 +95,11 @@ namespace hemelb Mesh scaled(mesh); scaled *= scale; - REQUIRE(ApproxV(original.GetBarycenter()) == scaled.GetBarycenter()); + REQUIRE(ApproxV(original.GetBarycentre()) == scaled.GetBarycentre()); LatticePosition const first = (*original.GetVertices().begin() - - original.GetBarycenter()) * scale + original.GetBarycenter(); + - original.GetBarycentre()) * scale + original.GetBarycentre(); LatticePosition const second = (* (++original.GetVertices().begin()) - - original.GetBarycenter()) * scale + original.GetBarycenter(); + - original.GetBarycentre()) * scale + original.GetBarycentre(); REQUIRE(ApproxV(first) == *scaled.GetVertices().begin()); REQUIRE(ApproxV(second) == *(++scaled.GetVertices().begin())); } @@ -110,8 +110,8 @@ namespace hemelb Mesh trans(mesh); trans += offset; - REQUIRE(ApproxV(original.GetBarycenter() + offset) == - trans.GetBarycenter()); + REQUIRE(ApproxV(original.GetBarycentre() + offset) == + trans.GetBarycentre()); LatticePosition const first = *original.GetVertices().begin() + offset; LatticePosition const second = * (++original.GetVertices().begin()) + offset; REQUIRE(ApproxV(first) == *trans.GetVertices().begin()); diff --git a/Code/tests/redblood/SadCellIntegrationTests.cc b/Code/tests/redblood/SadCellIntegrationTests.cc index dbf1d472f..b46615c75 100644 --- a/Code/tests/redblood/SadCellIntegrationTests.cc +++ b/Code/tests/redblood/SadCellIntegrationTests.cc @@ -73,9 +73,9 @@ namespace hemelb::tests sadcell->SetScale(scale); *sadcell *= 1e0 / converter.GetVoxelSize(); *sadcell += converter.ConvertPositionToLatticeUnits(PhysicalPosition(0, 0, 0)) - - sadcell->GetBarycenter(); + - sadcell->GetBarycentre(); *cell += converter.ConvertPositionToLatticeUnits(PhysicalPosition(0, 0, 0)) - - cell->GetBarycenter(); + - cell->GetBarycentre(); vtk_io.writeFile("/tmp/ideal.vtp", *cell, &converter); vtk_io.writeFile("/tmp/deformed.vtp", *sadcell, &converter); sadcell->moduli.bending = 0.0000375; @@ -109,7 +109,7 @@ namespace hemelb::tests vtk_io.writeFile("/tmp/reformed.vtp", *sadcell, &converter); *sadcell += converter.ConvertPositionToLatticeUnits(PhysicalPosition(0, 0, 0)) - - sadcell->GetBarycenter(); + - sadcell->GetBarycentre(); vtk_io.writeFile("/tmp/reformed_centered.vtp", *sadcell, &converter); AssertPresent("results/report.txt"); diff --git a/Code/tests/redblood/VertexBagTests.cc b/Code/tests/redblood/VertexBagTests.cc index 39c774e88..7020a56f8 100644 --- a/Code/tests/redblood/VertexBagTests.cc +++ b/Code/tests/redblood/VertexBagTests.cc @@ -77,7 +77,7 @@ namespace hemelb SECTION("testSplittingCellSingleProc") { auto const cell = std::make_shared(icoSphere()); *cell *= 5e0; - *cell += LatticePosition(50, 50, 50) - cell->GetBarycenter(); + *cell += LatticePosition(50, 50, 50) - cell->GetBarycentre(); auto splits = splitVertices < Stencil > (proc_at_pos, cell); REQUIRE(size_t(1) == splits.size()); REQUIRE(size_t(1) == splits.count(0)); @@ -92,7 +92,7 @@ namespace hemelb SECTION("testSplittingCellMultiProcs") { auto const cell = std::make_shared(icoSphere()); *cell *= 5e0; - *cell += LatticePosition(1, 0, 1) * 50e0 - cell->GetBarycenter(); + *cell += LatticePosition(1, 0, 1) * 50e0 - cell->GetBarycentre(); auto splits = splitVertices < Stencil > (proc_at_pos, cell); REQUIRE(size_t(2) == splits.size()); REQUIRE(size_t(1) == splits.count(0)); diff --git a/Code/tests/redblood/buffer/BufferTests.cc b/Code/tests/redblood/buffer/BufferTests.cc index 1bd7428b2..ec1ce9e63 100644 --- a/Code/tests/redblood/buffer/BufferTests.cc +++ b/Code/tests/redblood/buffer/BufferTests.cc @@ -106,7 +106,7 @@ namespace hemelb std::vector > cells; { auto cell = std::make_shared(icoSphere()); - *cell -= cell->GetBarycenter(); + *cell -= cell->GetBarycentre(); cells.push_back(std::make_shared(*cell)); buffer->insert(cells.back()); *cell += cylinder.normal * 2.0; @@ -138,7 +138,7 @@ namespace hemelb // We know the cells are in cells are sorted auto get_pos = [](CellContainer::value_type a) { - return a->GetBarycenter(); + return a->GetBarycentre(); }; std::vector positions(cells.size()); std::transform(cells.begin(), cells.end(), positions.begin(), get_pos); @@ -155,7 +155,7 @@ namespace hemelb auto expected_pos = positions[i] + cylinder.normal * buffer->GetOffset() + cylinder.origin; REQUIRE(cell == cells[i]); - REQUIRE(cell->GetBarycenter() == ApproxV(expected_pos)); + REQUIRE(cell->GetBarycentre() == ApproxV(expected_pos)); REQUIRE(buffer->GetJustDropped() == cell); } @@ -180,8 +180,8 @@ namespace hemelb buffer->updateOffset(); // updating should set offet such that dropping the cell will place it at the origin auto const cell = buffer->drop(); - auto const barycenter = cell->GetBarycenter(); - REQUIRE(ApproxV(cylinder.origin) == barycenter); + auto const barycentre = cell->GetBarycentre(); + REQUIRE(ApproxV(cylinder.origin) == barycentre); } // Moving perpendicular to the normal should have no effect @@ -231,7 +231,7 @@ namespace hemelb *cell -= cylinder.normal * 2.0; buffer->updateOffset(); auto const nextDrop = buffer->drop(); - REQUIRE(approx(cylinder.origin.x()) == nextDrop->GetBarycenter().x()); + REQUIRE(approx(cylinder.origin.x()) == nextDrop->GetBarycentre().x()); } SECTION("testOutsideInteractionRange") { @@ -239,9 +239,9 @@ namespace hemelb buffer->SetInteraction(1e0); // Arrange cell positions first - * (cells[0]) += cylinder.normal * 0.0 - cells[0]->GetBarycenter(); - * (cells[1]) += cylinder.normal * 5.0 - cells[1]->GetBarycenter(); - * (cells[2]) += cylinder.normal * 10.0 - cells[2]->GetBarycenter(); + * (cells[0]) += cylinder.normal * 0.0 - cells[0]->GetBarycentre(); + * (cells[1]) += cylinder.normal * 5.0 - cells[1]->GetBarycentre(); + * (cells[2]) += cylinder.normal * 10.0 - cells[2]->GetBarycentre(); buffer->updateOffset(); auto cell = buffer->drop(); @@ -270,7 +270,7 @@ namespace hemelb SECTION("testIsDroppable") { auto cell = buffer->nearestCell(); - *cell -= cell->GetBarycenter(); + *cell -= cell->GetBarycentre(); // Center of cylinder should pass *cell += cylinder.normal * cylinder.length * 0.5; buffer->SetOffset(0); diff --git a/Code/tests/redblood/buffer/ColumnsTests.cc b/Code/tests/redblood/buffer/ColumnsTests.cc index aad5eacf1..ccd56f2ca 100644 --- a/Code/tests/redblood/buffer/ColumnsTests.cc +++ b/Code/tests/redblood/buffer/ColumnsTests.cc @@ -24,13 +24,13 @@ namespace hemelb::tests LatticeDistance const sep = 1; auto is_in_cylinder = [&cylinder](LatticePosition const &a, MeshData::Vertices const &verts) -> bool { - LatticePosition const barycenter = redblood::barycenter(verts); + LatticePosition const barycentre = redblood::barycentre(verts); LatticePosition const n0 = cylinder->normal.GetNormalised(); if (Dot(a, cylinder->normal) < -1e-8) { return false; } for (auto const &v : verts) { - LatticePosition const x = a + v - barycenter - cylinder->origin; + LatticePosition const x = a + v - barycentre - cylinder->origin; if (Cross(x, n0).GetMagnitude() >= cylinder->radius) { return false; } @@ -153,8 +153,8 @@ namespace hemelb::tests auto check = [templateCell, &rotation, &is_in_cylinder, &approx](std::shared_ptr acell) { auto const cell = std::static_pointer_cast(acell); - auto const b0 = templateCell->GetBarycenter(); - auto const b1 = cell->GetBarycenter(); + auto const b0 = templateCell->GetBarycentre(); + auto const b1 = cell->GetBarycentre(); auto const& vertices0 = templateCell->GetVertices(); auto const& vertices1 = cell->GetVertices(); REQUIRE(templateCell->GetNumberOfNodes() == cell->GetNumberOfNodes()); diff --git a/Code/tests/redblood/parallel/CellParallelizationTests.cc b/Code/tests/redblood/parallel/CellParallelizationTests.cc index e3f485bbf..0f422ad90 100644 --- a/Code/tests/redblood/parallel/CellParallelizationTests.cc +++ b/Code/tests/redblood/parallel/CellParallelizationTests.cc @@ -135,7 +135,7 @@ namespace hemelb::tests unsigned int depth) const { auto cell = std::make_shared(icoSphere(depth)); - *cell += pos - cell->GetBarycenter(); + *cell += pos - cell->GetBarycentre(); *cell *= scale; cell->SetScale(scale); cell->SetTag(uuid); @@ -212,9 +212,9 @@ namespace hemelb::tests auto const ranks = graph ? graph.RankMap(net::MpiCommunicator::World()) : net::MpiCommunicator::World().RankMap(net::MpiCommunicator::World()); - auto const barycenter = cell->GetBarycenter(); + auto const barycentre = cell->GetBarycentre(); for (int i = 0; i < net::MpiCommunicator::World().Size(); ++i) { - auto const d = (GetCenter(ranks.find(i)->second) - barycenter).GetMagnitudeSquared(); + auto const d = (GetCenter(ranks.find(i)->second) - barycentre).GetMagnitudeSquared(); distances.push_back(d); }; return std::min_element(distances.begin(), distances.end()) - distances.begin(); @@ -522,7 +522,7 @@ namespace hemelb::tests for (size_t i(0); i < sendto.size(); ++i) { cells.push_back(templateCell->clone()); - *cells[i] += GetCenter(sendto[i]) - cells[i]->GetBarycenter(); + *cells[i] += GetCenter(sendto[i]) - cells[i]->GetBarycentre(); boost::uuids::uuid tag; std::fill(tag.begin(), tag.end(), static_cast(i)); cells[i]->SetTag(tag); @@ -585,8 +585,8 @@ namespace hemelb::tests for (size_t i(0); i < sendto.size(); ++i) { cells.push_back(templateCell->clone()); - // one barycenter on each side of the ownership line - *cells[i] += (GetCenter(0) + GetCenter(1)) * 0.5 - cells[i]->GetBarycenter(); + // one barycentre on each side of the ownership line + *cells[i] += (GetCenter(0) + GetCenter(1)) * 0.5 - cells[i]->GetBarycentre(); *cells[i] += (GetCenter(0) - GetCenter(1)).GetNormalised() * (i != 0 ? 0.1 : -0.1); @@ -658,7 +658,7 @@ namespace hemelb::tests boost::uuids::uuid tag; std::fill(tag.begin(), tag.end(), static_cast(u)); result->SetTag(tag); - *result += centerOnLine(i, j, alpha) - result->GetBarycenter(); + *result += centerOnLine(i, j, alpha) - result->GetBarycentre(); return CellContainer::value_type(std::move(result)); }; std::vector const cells { diff --git a/Code/tests/redblood/parallel/MPILockStepTests.cc b/Code/tests/redblood/parallel/MPILockStepTests.cc index 3ae75f6cc..35ef6e495 100644 --- a/Code/tests/redblood/parallel/MPILockStepTests.cc +++ b/Code/tests/redblood/parallel/MPILockStepTests.cc @@ -81,24 +81,24 @@ namespace hemelb::tests result }); } - void checkBarycenter(net::MpiCommunicator const &world, CellContainer const &cells) { + void checkBarycentre(net::MpiCommunicator const &world, CellContainer const &cells) { std::vector uuids; - std::vector barycenters; + std::vector barycentres; for(auto const &cell: cells) { uuids.push_back(*static_cast(static_cast(&cell->GetTag()))); - barycenters.push_back(cell->GetBarycenter()); + barycentres.push_back(cell->GetBarycentre()); } uuids = world.Gather(uuids, 0); - barycenters = world.Gather(barycenters, 0); + barycentres = world.Gather(barycentres, 0); if(world.Rank() == 0) { REQUIRE(uuids.size() == 2 * cells.size()); std::map serial; for(std::size_t i(0); i < cells.size(); ++i) { - serial[uuids[i]] = barycenters[i]; + serial[uuids[i]] = barycentres[i]; } for(std::size_t i(serial.size()); i < uuids.size(); ++i) { REQUIRE(std::size_t(1) == serial.count(uuids[i])); - REQUIRE(ApproxV(barycenters[i]).Margin(1e-11) == serial[uuids[i]]); + REQUIRE(ApproxV(barycentres[i]).Margin(1e-11) == serial[uuids[i]]); } } world.Barrier(); @@ -180,7 +180,7 @@ namespace hemelb::tests ); controller->AddCellChangeListener( [&](CellContainer const& cells) { - return checkBarycenter(world, cells); + return checkBarycentre(world, cells); }); // run the simulation diff --git a/Code/tests/redblood/parallel/RBCInserterWithPerturbationParallelTests.cc b/Code/tests/redblood/parallel/RBCInserterWithPerturbationParallelTests.cc index 11d139916..57a787108 100644 --- a/Code/tests/redblood/parallel/RBCInserterWithPerturbationParallelTests.cc +++ b/Code/tests/redblood/parallel/RBCInserterWithPerturbationParallelTests.cc @@ -43,14 +43,14 @@ namespace hemelb } auto const cell = inserter.drop(); - auto const barycenter = cell->GetBarycenter(); + auto const barycentre = cell->GetBarycentre(); const double p = world.Size(); - auto const x_times_p = world.AllReduce(barycenter.x(), MPI_SUM); - auto const y_times_p = world.AllReduce(barycenter.y(), MPI_SUM); - auto const z_times_p = world.AllReduce(barycenter.z(), MPI_SUM); - auto const mean_barycenter = LatticePosition{x_times_p, y_times_p, z_times_p} / p; - REQUIRE(barycenter == mean_barycenter); + auto const x_times_p = world.AllReduce(barycentre.x(), MPI_SUM); + auto const y_times_p = world.AllReduce(barycentre.y(), MPI_SUM); + auto const z_times_p = world.AllReduce(barycentre.z(), MPI_SUM); + auto const mean_barycentre = LatticePosition{x_times_p, y_times_p, z_times_p} / p; + REQUIRE(barycentre == mean_barycentre); } } }