Skip to content

Commit

Permalink
Be consistent with centre/center
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertnash committed Dec 5, 2023
1 parent 36cb9e2 commit f8ac5fd
Show file tree
Hide file tree
Showing 29 changed files with 148 additions and 148 deletions.
28 changes: 14 additions & 14 deletions Code/redblood/CellArmy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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.
Expand All @@ -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<log::Info, log::OnePerCore>(message.str());

cellDnC.remove(*i_current);
Expand All @@ -335,18 +335,18 @@ namespace hemelb
template<class TRAITS>
void CellArmy<TRAITS>::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<log::Info, log::OnePerCore>("Adding cell at (%f, %f, %f)",
barycenter.x(),
barycenter.y(),
barycenter.z());
barycentre.x(),
barycentre.y(),
barycentre.z());
cellDnC.insert(cell);
cells.insert(cell);

Expand All @@ -365,9 +365,9 @@ namespace hemelb
if (numCellsAdded != 1)
{
log::Logger::Log<log::Info, log::OnePerCore>("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);
Expand Down
14 changes: 7 additions & 7 deletions Code/redblood/CellBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ namespace hemelb
{
return static_cast<site_t>(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
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Code/redblood/CellBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -138,7 +138,7 @@ namespace hemelb
//! Transform mesh
void operator+=(std::vector<LatticePosition> const &displacements);

MeshData::Vertices::value_type GetBarycenter() const;
MeshData::Vertices::value_type GetBarycentre() const;
LatticeVolume GetVolume() const
{
return volume(GetVertices(), GetTemplateMesh().GetFacets());
Expand Down
8 changes: 4 additions & 4 deletions Code/redblood/CellControllerBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Code/redblood/CellIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<char*>(tag));
xdrWriter << std::span<std::byte>(tag, UUID_STRING_LEN) << cell->GetBarycenter();
xdrWriter << std::span<std::byte>(tag, UUID_STRING_LEN) << cell->GetBarycentre();
}

auto bary_filename = rbcOutputDir / "barycentres.rbc";
Expand Down
8 changes: 4 additions & 4 deletions Code/redblood/FaderCell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,11 +27,11 @@ namespace hemelb

LatticeEnergy FaderCell::operator()(std::vector<LatticeForceVector> &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)
Expand Down
16 changes: 8 additions & 8 deletions Code/redblood/Mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ namespace hemelb::redblood
static_assert(std::is_same<IdType, vtkIdType>::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)
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
16 changes: 8 additions & 8 deletions Code/redblood/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions Code/redblood/RBCInserter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ namespace hemelb::redblood
* @param scale the scale of the cell to insert
*/
RBCInserter(std::function<bool()> condition, std::unique_ptr<CellBase const> 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;
Expand Down Expand Up @@ -82,9 +82,9 @@ namespace hemelb::redblood
if (condition())
{
log::Logger::Log<log::Debug, log::OnePerCore>("Dropping one cell at (%f, %f, %f)",
barycenter.x(),
barycenter.y(),
barycenter.z());
barycentre.x(),
barycentre.y(),
barycentre.z());
insertFn(drop());
}
}
Expand All @@ -99,8 +99,8 @@ namespace hemelb::redblood
std::function<bool()> condition;
//! The shape of the cells to insert
std::unique_ptr<CellBase const> cell;
//! barycenter -- for logging
LatticePosition barycenter;
//! barycentre -- for logging
LatticePosition barycentre;
};

//! Red blood cell inserter that adds random rotation and translation to each cell
Expand Down
20 changes: 10 additions & 10 deletions Code/redblood/buffer/Buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<class T_FUNC>
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit f8ac5fd

Please sign in to comment.