├── .clang-format ├── .github ├── actions │ ├── get-tests-repo │ │ ├── README.md │ │ └── action.yml │ ├── install-hemelb-deps │ │ └── action.yml │ └── setup-compilers │ │ └── action.yml └── workflows │ ├── gmy-Linux.conda-env │ ├── gmy-tool.yml │ ├── main-app.yml │ ├── py-hemetools.yml │ └── run-clang-format.py ├── .gitignore ├── AUTHORS ├── CMake ├── Debug.cmake ├── DependencyOptions.cmake ├── FindCTemplate.cmake ├── FindMETIS.cmake ├── FindMPWide.cmake ├── FindParMETIS.cmake ├── FindTinyXML.cmake ├── GlobalOptions.cmake ├── HemeLbDependency.cmake ├── HemeLbOptions.cmake ├── PassOptions.cmake └── UseHDF5.cmake ├── CMakeLists.txt ├── Code ├── .cproject ├── .project ├── .settings │ ├── org.eclipse.cdt.codan.core.prefs │ ├── org.eclipse.cdt.core.prefs │ ├── org.eclipse.cdt.ui.prefs │ ├── org.eclipse.ltk.core.refactoring.prefs │ └── org.eclipse.wst.sse.core.prefs ├── CMakeLists.txt ├── Doxyfile ├── Exception.h ├── README ├── SimulationMaster.h ├── SimulationMaster.impl.h ├── Traits.h ├── build_info.h.in ├── cmake │ ├── build_environment.cmake │ ├── codesign.cmake │ ├── gnu_bug.cmake │ ├── intel_cpp11.cmake │ ├── macos-allow-debug.plist │ ├── mountain_lion_scandir.cmake │ ├── mpi.cmake │ └── platform_checks.cmake ├── colloids │ ├── BodyForceExamples.h │ ├── BodyForces.cc │ ├── BodyForces.h │ ├── BoundaryConditions.cc │ ├── BoundaryConditions.h │ ├── CMakeLists.txt │ ├── ColloidController.cc │ ├── ColloidController.h │ ├── DeletionBC.h │ ├── GraviticBodyForce.h │ ├── LubricationBC.h │ ├── Particle.cc │ ├── Particle.h │ ├── ParticleMpiDatatypes.cc │ ├── ParticleSet.cc │ ├── ParticleSet.h │ ├── PersistedParticle.cc │ └── PersistedParticle.h ├── confcheck.cc ├── configuration │ ├── CMakeLists.txt │ ├── CommandLine.cc │ ├── CommandLine.h │ ├── MonitoringConfig.h │ ├── SimBuilder.cc │ ├── SimBuilder.h │ ├── SimConfig.cc │ └── SimConfig.h ├── constants.h ├── debug.h ├── debug │ ├── CMakeLists.txt │ ├── Debugger.cc │ ├── Debugger.h │ ├── OSX │ │ ├── MPIdebug.applescript │ │ ├── OsxDebugger.cc │ │ ├── OsxDebugger.h │ │ ├── resume.gdb │ │ └── resume.lldb │ ├── PlatformDebugger.h.in │ ├── common │ │ ├── ActiveDebugger.cc │ │ └── ActiveDebugger.h │ ├── linux │ │ ├── LinuxDebugger.cc │ │ ├── LinuxDebugger.h │ │ ├── launchGdbs.sh │ │ ├── launchGnomeTerminal.sh │ │ ├── launchKonsole.sh │ │ └── resume.gdb │ └── none │ │ ├── NullDebugger.cc │ │ └── NullDebugger.h ├── extraction │ ├── ArbitrarySiteListIterableDataSource.cc │ ├── ArbitrarySiteListIterableDataSource.h │ ├── CMakeLists.txt │ ├── GeometrySelector.cc │ ├── GeometrySelector.h │ ├── GeometrySelectors.h │ ├── GeometrySurfaceSelector.cc │ ├── GeometrySurfaceSelector.h │ ├── InputField.h │ ├── IterableDataSource.cc │ ├── IterableDataSource.h │ ├── LbDataSourceIterator.cc │ ├── LbDataSourceIterator.h │ ├── LocalDistributionInput.cc │ ├── LocalDistributionInput.h │ ├── LocalPropertyOutput.cc │ ├── LocalPropertyOutput.h │ ├── OutputField.h │ ├── PlaneGeometrySelector.cc │ ├── PlaneGeometrySelector.h │ ├── PropertyActor.cc │ ├── PropertyActor.h │ ├── PropertyOutputFile.h │ ├── PropertyWriter.cc │ ├── PropertyWriter.h │ ├── StraightLineGeometrySelector.cc │ ├── StraightLineGeometrySelector.h │ ├── SurfacePointSelector.cc │ ├── SurfacePointSelector.h │ ├── WholeGeometrySelector.cc │ └── WholeGeometrySelector.h ├── geometry │ ├── Block.cc │ ├── Block.h │ ├── BlockTraverser.cc │ ├── BlockTraverser.h │ ├── CMakeLists.txt │ ├── Domain.cc │ ├── Domain.h │ ├── FieldData.cc │ ├── FieldData.h │ ├── GeometryBlock.h │ ├── GeometryReader.cc │ ├── GeometryReader.h │ ├── GeometrySite.h │ ├── GeometrySiteLink.h │ ├── GmyReadResult.cc │ ├── GmyReadResult.h │ ├── LookupTree.cc │ ├── LookupTree.h │ ├── NeighbouringProcessor.h │ ├── ParmetisForward.h.in │ ├── ParmetisHeader.h │ ├── Site.h │ ├── SiteData.h │ ├── SiteDataBare.cc │ ├── SiteDataBare.h │ ├── SiteTraverser.cc │ ├── SiteTraverser.h │ ├── SiteType.h │ ├── VolumeTraverser.cc │ ├── VolumeTraverser.h │ ├── decomposition │ │ ├── BasicDecomposition.cc │ │ ├── BasicDecomposition.h │ │ ├── DecompositionWeights.h.in │ │ ├── OptimisedDecomposition.cc │ │ └── OptimisedDecomposition.h │ ├── needs │ │ ├── Needs.cc │ │ └── Needs.h │ └── neighbouring │ │ ├── NeighbouringDataManager.cc │ │ ├── NeighbouringDataManager.h │ │ ├── NeighbouringDomain.cc │ │ ├── NeighbouringDomain.h │ │ ├── NeighbouringSite.cc │ │ ├── NeighbouringSite.h │ │ ├── RequiredSiteInformation.cc │ │ └── RequiredSiteInformation.h ├── hassert.h ├── io │ ├── CMakeLists.txt │ ├── FILE.cc │ ├── FILE.h │ ├── PathManager.cc │ ├── PathManager.h │ ├── XdrSerialisation.h │ ├── formats │ │ ├── colloids.h │ │ ├── extraction.h │ │ ├── formats.h │ │ ├── geometry.cc │ │ ├── geometry.h │ │ └── offset.h │ ├── h5md │ │ ├── H5MD.cc │ │ ├── H5MD.h │ │ ├── H5MDException.h │ │ ├── TimeData.cc │ │ └── TimeData.h │ ├── readers │ │ ├── XdrFileReader.cc │ │ ├── XdrFileReader.h │ │ ├── XdrMemReader.cc │ │ ├── XdrMemReader.h │ │ └── XdrReader.h │ ├── writers │ │ ├── AsciiFileWriter.cc │ │ ├── AsciiFileWriter.h │ │ ├── AsciiStreamWriter.cc │ │ ├── AsciiStreamWriter.h │ │ ├── NullWriter.cc │ │ ├── NullWriter.h │ │ ├── Writer.cc │ │ ├── Writer.h │ │ ├── XdrFileWriter.cc │ │ ├── XdrFileWriter.h │ │ ├── XdrMemWriter.cc │ │ ├── XdrMemWriter.h │ │ ├── XdrVectorWriter.cc │ │ ├── XdrVectorWriter.h │ │ ├── XdrWriter.cc │ │ └── XdrWriter.h │ ├── xml.cc │ └── xml.h ├── lb │ ├── CMakeLists.txt │ ├── Collisions.h │ ├── EntropyTester.h │ ├── HFunction.h │ ├── HydroVars.h │ ├── IncompressibilityChecker.cc │ ├── IncompressibilityChecker.h │ ├── IncompressibilityChecker.hpp │ ├── InitialCondition.cc │ ├── InitialCondition.h │ ├── InitialCondition.hpp │ ├── Kernels.h │ ├── Lattices.h │ ├── LbmParameters.h │ ├── MacroscopicPropertyCache.cc │ ├── MacroscopicPropertyCache.h │ ├── README.md │ ├── SimulationState.cc │ ├── SimulationState.h │ ├── StabilityTester.cc │ ├── StabilityTester.h │ ├── Streamers.h │ ├── collisions │ │ ├── NonZeroVelocityEquilibriumFixedDensity.h │ │ ├── Normal.h │ │ ├── ZeroVelocityEquilibrium.h │ │ └── ZeroVelocityEquilibriumFixedDensity.h │ ├── concepts.h │ ├── iolets │ │ ├── BoundaryComms.cc │ │ ├── BoundaryComms.h │ │ ├── BoundaryCommunicator.cc │ │ ├── BoundaryCommunicator.h │ │ ├── BoundaryValues.cc │ │ ├── BoundaryValues.h │ │ ├── InOutLet.cc │ │ ├── InOutLet.h │ │ ├── InOutLetCosine.cc │ │ ├── InOutLetCosine.h │ │ ├── InOutLetFile.cc │ │ ├── InOutLetFile.h │ │ ├── InOutLetFileVelocity.cc │ │ ├── InOutLetFileVelocity.h │ │ ├── InOutLetMultiscale.cc │ │ ├── InOutLetMultiscale.h │ │ ├── InOutLetParabolicVelocity.cc │ │ ├── InOutLetParabolicVelocity.h │ │ ├── InOutLetVelocity.cc │ │ ├── InOutLetVelocity.h │ │ ├── InOutLetWomersleyVelocity.cc │ │ ├── InOutLetWomersleyVelocity.h │ │ └── InOutLets.h │ ├── kernels │ │ ├── AbstractRheologyModel.cc │ │ ├── AbstractRheologyModel.h │ │ ├── CarreauYasudaRheologyModel.cc │ │ ├── CarreauYasudaRheologyModel.h │ │ ├── CassonRheologyModel.cc │ │ ├── CassonRheologyModel.h │ │ ├── DHumieresD3Q15MRTBasis.cc │ │ ├── DHumieresD3Q15MRTBasis.h │ │ ├── DHumieresD3Q19MRTBasis.cc │ │ ├── DHumieresD3Q19MRTBasis.h │ │ ├── Entropic.h │ │ ├── EntropicAnsumali.h │ │ ├── EntropicChik.h │ │ ├── GuoForcingLBGK.h │ │ ├── LBGK.h │ │ ├── LBGKNN.h │ │ ├── MRT.h │ │ ├── MomentBases.h │ │ ├── RheologyModels.h │ │ ├── TRT.h │ │ ├── TruncatedPowerLawRheologyModel.cc │ │ ├── TruncatedPowerLawRheologyModel.h │ │ └── basis_helpers.h │ ├── lattices │ │ ├── D3Q15.h │ │ ├── D3Q15i.h │ │ ├── D3Q19.h │ │ ├── D3Q27.h │ │ ├── Lattice.h │ │ └── LatticeInfo.h │ ├── lb.h │ ├── lb.hpp │ └── streamers │ │ ├── BouzidiFirdaousLallemand.h │ │ ├── BulkStreamer.h │ │ ├── Common.h │ │ ├── GuoZhengShi.h │ │ ├── JunkYang.h │ │ ├── LaddIolet.h │ │ ├── NashZerothOrderPressure.h │ │ ├── SimpleBounceBack.h │ │ ├── StreamerTypeFactory.h │ │ ├── VirtualSite.h │ │ └── VirtualSiteIolet.h ├── log │ ├── CMakeLists.txt │ ├── Logger.h │ └── Logger.in.cc ├── main.cc ├── mainMultiscale.cc ├── multiscale │ ├── CMakeLists.txt │ ├── Intercommunicand.h │ ├── IntercommunicandType.h │ ├── Intercommunicator.h │ ├── MultiscaleSimulationMaster.h │ ├── SharedValue.h │ └── mpwide │ │ ├── MPWideIntercommunicator.cc │ │ └── MPWideIntercommunicator.h ├── net │ ├── BaseNet.cc │ ├── BaseNet.h │ ├── BuildInfo.h.in │ ├── CMakeLists.txt │ ├── INeighborAllToAll.h │ ├── INeighborAllToAllV.h │ ├── IOCommunicator.cc │ ├── IOCommunicator.h │ ├── IteratedAction.cc │ ├── IteratedAction.h │ ├── MpiCommunicator.cc │ ├── MpiCommunicator.h │ ├── MpiCommunicator.hpp │ ├── MpiDataType.h │ ├── MpiEnvironment.cc │ ├── MpiEnvironment.h │ ├── MpiError.cc │ ├── MpiError.h │ ├── MpiFile.cc │ ├── MpiFile.h │ ├── MpiFile.hpp │ ├── MpiGroup.cc │ ├── MpiGroup.h │ ├── MpiWindow.h │ ├── PhasedBroadcast.h │ ├── PhasedBroadcastIrregular.h │ ├── PhasedBroadcastRegular.h │ ├── ProcComms.cc │ ├── ProcComms.h │ ├── SparseExchange.h │ ├── StoredRequest.h │ ├── mixins │ │ ├── InterfaceDelegationNet.h │ │ ├── StoringNet.cc │ │ ├── StoringNet.h │ │ ├── alltoall │ │ │ ├── SeparatedAllToAll.cc │ │ │ ├── SeparatedAllToAll.h │ │ │ ├── ViaPointPointAllToAll.cc │ │ │ └── ViaPointPointAllToAll.h │ │ ├── gathers │ │ │ ├── SeparatedGathers.cc │ │ │ ├── SeparatedGathers.h │ │ │ ├── ViaPointPointGathers.cc │ │ │ └── ViaPointPointGathers.h │ │ ├── mixins.h │ │ └── pointpoint │ │ │ ├── CoalescePointPoint.cc │ │ │ ├── CoalescePointPoint.h │ │ │ ├── ImmediatePointPoint.cc │ │ │ ├── ImmediatePointPoint.h │ │ │ ├── SeparatedPointPoint.cc │ │ │ └── SeparatedPointPoint.h │ ├── mpi.h │ ├── net.h │ └── phased │ │ ├── Concern.cc │ │ ├── Concern.h │ │ ├── NetConcern.h │ │ ├── StepManager.cc │ │ ├── StepManager.h │ │ └── steps.h ├── quantity.h ├── redblood │ ├── Borders.cc │ ├── Borders.h │ ├── CMakeLists.txt │ ├── Cell.cc │ ├── Cell.h │ ├── CellArmy.h │ ├── CellBase.cc │ ├── CellBase.h │ ├── CellCell.cc │ ├── CellCell.h │ ├── CellController.h │ ├── CellControllerBuilder.cc │ ├── CellControllerBuilder.h │ ├── CellDataDefinition.impl.cc │ ├── CellEnergy.cc │ ├── CellEnergy.h │ ├── DivideConquer.h │ ├── Facet.cc │ ├── Facet.h │ ├── FaderCell.cc │ ├── FaderCell.h │ ├── FlowExtension.cc │ ├── FlowExtension.h │ ├── GridAndCell.h │ ├── GridAndCell.impl.h │ ├── Interpolation.cc │ ├── Interpolation.h │ ├── Mesh.cc │ ├── Mesh.h │ ├── MeshIO.cc │ ├── MeshIO.h │ ├── MeshIdType.h.in │ ├── Node2Node.h │ ├── RBCFile.cc │ ├── RBCFile.h │ ├── RBCInserter.cc │ ├── RBCInserter.h │ ├── VTKError.cc │ ├── VTKError.h │ ├── VelocityInterpolation.h │ ├── VertexBag.cc │ ├── VertexBag.h │ ├── WallCellPairIterator.cc │ ├── WallCellPairIterator.h │ ├── buffer │ │ ├── Buffer.cc │ │ ├── Buffer.h │ │ ├── CellRegulator.h │ │ ├── Columns.cc │ │ └── Columns.h │ ├── parallel │ │ ├── CellParallelization.cc │ │ ├── CellParallelization.h │ │ ├── GraphBasedCommunication.cc │ │ ├── GraphBasedCommunication.h │ │ ├── IntegrateVelocities.cc │ │ ├── IntegrateVelocities.h │ │ ├── NodeCharacterizer.cc │ │ ├── NodeCharacterizer.h │ │ ├── SpreadForces.cc │ │ └── SpreadForces.h │ ├── stencil.h │ ├── types.h │ └── types_fwd.h ├── reporting │ ├── BuildInfo.cc │ ├── BuildInfo.h │ ├── CMakeLists.txt │ ├── Dict.cc │ ├── Dict.h │ ├── Policies.h │ ├── Reportable.h │ ├── Reporter.cc │ ├── Reporter.h │ ├── Timers.cc │ ├── Timers.h │ ├── Timers.hpp │ └── timers_fwd.h ├── resources │ ├── CMakeLists.txt │ ├── Resource.h │ ├── path_parameters.h.in │ ├── report.txt.ctp │ └── report.xml.ctp ├── tests │ ├── CMakeLists.txt │ ├── SimulationMasterTests.cc │ ├── configuration │ │ ├── CMakeLists.txt │ │ ├── CommandLineTests.cc │ │ └── SimConfigTests.cc │ ├── extraction │ │ ├── CMakeLists.txt │ │ ├── DummyDataSource.h │ │ ├── GeometrySelectorTests.cc │ │ └── LocalPropertyOutputTests.cc │ ├── geometry │ │ ├── CMakeLists.txt │ │ ├── GeometryReaderTests.cc │ │ ├── LatticeDataTests.cc │ │ ├── LookupTreeTests.cc │ │ ├── NeedsTests.cc │ │ └── neighbouring │ │ │ ├── CMakeLists.txt │ │ │ ├── NeighbouringDataManagerTests.cc │ │ │ ├── NeighbouringLatticeDataTests.cc │ │ │ └── RequiredSiteInformationTests.cc │ ├── helpers │ │ ├── ApproxVector.h │ │ ├── CMakeLists.txt │ │ ├── EqualitySiteData.h │ │ ├── FolderTestFixture.cc │ │ ├── FolderTestFixture.h │ │ ├── FourCubeBasedTestFixture.cc │ │ ├── FourCubeBasedTestFixture.h │ │ ├── FourCubeLatticeData.cc │ │ ├── FourCubeLatticeData.h │ │ ├── HasCommsTestFixture.cc │ │ ├── HasCommsTestFixture.h │ │ ├── LabelledRequest.cc │ │ ├── LabelledRequest.h │ │ ├── LaddFail.h │ │ ├── LatticeDataAccess.cc │ │ ├── LatticeDataAccess.h │ │ ├── MockNetHelper.cc │ │ ├── MockNetHelper.h │ │ ├── NetMock.h │ │ ├── OneInOneOutSimConfig.cc │ │ ├── OneInOneOutSimConfig.h │ │ ├── RandomSource.h │ │ ├── RandomSourceTests.cc │ │ ├── RecordingNet.cc │ │ ├── RecordingNet.h │ │ ├── SimConfBuildHelp.h │ │ └── SiteIterator.h │ ├── io │ │ ├── CMakeLists.txt │ │ ├── PathManagerTests.cc │ │ ├── XdrReaderTests.cc │ │ ├── XdrWriterTests.cc │ │ ├── generate_xdr_test_data.py │ │ ├── xdr_test_data.cc │ │ ├── xdr_test_data.h │ │ └── xml.cc │ ├── lb │ │ ├── BroadcastMocks.cc │ │ ├── BroadcastMocks.h │ │ ├── CMakeLists.txt │ │ ├── CollisionTests.cc │ │ ├── GuoForcingTests.cc │ │ ├── IncompressibilityCheckerTests.cc │ │ ├── KernelTests.cc │ │ ├── LatticeTests.cc │ │ ├── LbTestsHelper.h │ │ ├── RheologyModelTests.cc │ │ ├── StreamerTests.cc │ │ ├── VirtualSiteIoletStreamerTests.cc │ │ └── iolets │ │ │ ├── BoundaryTests.cc │ │ │ ├── CMakeLists.txt │ │ │ └── InOutLetTests.cc │ ├── main.cc │ ├── multiscale │ │ ├── CMakeLists.txt │ │ ├── MockIntercommunicand.cc │ │ ├── MockIntercommunicand.h │ │ ├── MockIntercommunicator.cc │ │ ├── MockIntercommunicator.h │ │ ├── MockIntercommunicatorTests.cc │ │ └── mpwide │ │ │ ├── CMakeLists.txt │ │ │ ├── IntercommunicatingHemeLB.h │ │ │ ├── MPWSettings.cfg │ │ │ ├── MPWideIntercommunicatorTests.cc │ │ │ └── MockMPWide.h │ ├── net │ │ ├── CMakeLists.txt │ │ ├── MpiTests.cc │ │ ├── NeighborCommTests.cc │ │ └── phased │ │ │ ├── CMakeLists.txt │ │ │ ├── ConcernTests.cc │ │ │ ├── MockConcern.cc │ │ │ ├── MockConcern.h │ │ │ ├── MockIteratedAction.cc │ │ │ ├── MockIteratedAction.h │ │ │ └── StepManagerTests.cc │ ├── pythontests │ │ ├── poiseuilleflowtest.py │ │ └── resources │ │ │ ├── RunCylinderGenerator.sh │ │ │ ├── RunSetupTool.sh │ │ │ ├── poiseuille_flow_test.pro │ │ │ ├── poiseuille_flow_test.stl │ │ │ └── poiseuille_flow_test_master.xml │ ├── redblood │ │ ├── BendingTests.cc │ │ ├── BordersTests.cc │ │ ├── CMakeLists.txt │ │ ├── CellArmyTests.cc │ │ ├── CellCellInteractionTests.cc │ │ ├── CellCellInteractionWithGridTests.cc │ │ ├── CellForceSpreadTests.cc │ │ ├── CellIOTests.cc │ │ ├── CellInserterTests.cc │ │ ├── CellIntegrationTests.cc │ │ ├── CellTests.cc │ │ ├── CellVelocityInterpolTests.cc │ │ ├── DivideConquerTests.cc │ │ ├── EnergyTests.cc │ │ ├── FacetTests.cc │ │ ├── FadeInOutIntegrationTests.cc │ │ ├── FaderCellTests.cc │ │ ├── FedosovValidationTests.cc │ │ ├── Fixtures.cc │ │ ├── Fixtures.h │ │ ├── FlowExtensionTests.cc │ │ ├── GradientKernTests.cc │ │ ├── GradientTests.cc │ │ ├── InterpolationTests.cc │ │ ├── LoadDeformedCellTests.cc │ │ ├── LoadingTimmMeshTests.cc │ │ ├── MulticellBenchmarkTests.cc │ │ ├── Node2NodeTests.cc │ │ ├── NodeIntegrationTests.cc │ │ ├── RedBloodMeshDataIOTests.cc │ │ ├── RedBloodMeshTests.cc │ │ ├── RedBloodMeshVTKDataIOTests.cc │ │ ├── SadCellIntegrationTests.cc │ │ ├── SadCellTest.cc │ │ ├── StencilTests.cc │ │ ├── TopologyTests.cc │ │ ├── VertexBagTests.cc │ │ ├── WallCellPairIteratorTests.cc │ │ ├── WallNodeDnCTests.cc │ │ ├── buffer │ │ │ ├── BufferTests.cc │ │ │ └── ColumnsTests.cc │ │ ├── parallel │ │ │ ├── CellParallelizationTests.cc │ │ │ ├── GraphCommsTests.cc │ │ │ ├── MPIIntegrateVelocities.cc │ │ │ ├── MPILockStepTests.cc │ │ │ ├── MPIParallelIntegrationTests.cc │ │ │ ├── MPISpreadForcesTests.cc │ │ │ ├── NodeParallelizationTests.cc │ │ │ ├── ParallelFixtureTests.cc │ │ │ ├── ParallelFixtures.cc │ │ │ ├── ParallelFixtures.h │ │ │ └── RBCInserterWithPerturbationParallelTests.cc │ │ └── tetrahedron.cc │ ├── reporting │ │ ├── CMakeLists.txt │ │ ├── Mocks.cc │ │ ├── Mocks.h │ │ ├── ReporterTests.cc │ │ └── TimerTests.cc │ ├── resources │ │ ├── 992Particles_rank3_26_t992.msh │ │ ├── 992Particles_rank3_26_t992.vtp │ │ ├── MakeDummyExtraction.py │ │ ├── config-velocity-iolet.xml │ │ ├── config.xml │ │ ├── config0_2_0.xml │ │ ├── config_file_inlet.xml │ │ ├── config_file_velocity_inlet.xml │ │ ├── config_new_velocity_inlets.xml │ │ ├── config_vel_dist.xml │ │ ├── cyl_l100_r5.gmy │ │ ├── cyl_l100_r5.xml │ │ ├── empty_for_relative_paths.xml │ │ ├── fedosov1c.gmy │ │ ├── fedosov1c.xml │ │ ├── four_cube.gmy │ │ ├── four_cube.xml │ │ ├── four_cube_multiscale.xml │ │ ├── iolet.txt │ │ ├── large_cylinder.gmy │ │ ├── large_cylinder.xml │ │ ├── large_cylinder_rbc.xml │ │ ├── rbc_ico_1280.msh │ │ ├── rbc_ico_2880.msh │ │ ├── rbc_ico_720.msh │ │ ├── rbc_ico_720.vtp │ │ ├── rbc_ico_720_correct.msh │ │ ├── red_blood_cell.txt │ │ ├── red_blood_cube.txt │ │ ├── sad.msh │ │ ├── velocity_inlet.txt │ │ ├── velocity_inlet.txt.weights.txt │ │ └── xmltest.xml │ └── util │ │ ├── BesselTests.cc │ │ ├── CMakeLists.txt │ │ ├── Matrix3DTests.cc │ │ ├── UnitConverterTests.cc │ │ ├── Vector3DTests.cc │ │ └── clone_ptr_tests.cc ├── units.h └── util │ ├── Bessel.cc │ ├── Bessel.h │ ├── CMakeLists.txt │ ├── Cache.h │ ├── Cache.hpp │ ├── CheckingCache.h │ ├── CheckingCache.hpp │ ├── Iterator.h │ ├── Matrix3D.cc │ ├── Matrix3D.h │ ├── RefreshableCache.h │ ├── RefreshableCache.hpp │ ├── UnitConverter.cc │ ├── UnitConverter.h │ ├── Vector3D.cc │ ├── Vector3D.h │ ├── Vector3DHemeLb.cc │ ├── clone_ptr.h │ ├── concepts.h │ ├── ct_string.h │ ├── span.h │ ├── traits.h │ ├── utilityFunctions.cc │ ├── utilityFunctions.h │ ├── utilityStructs.h │ └── variant.h ├── INSTALL ├── LICENSE ├── PiT ├── .gitignore ├── Scripts │ ├── coarsen.py │ ├── correction.py │ ├── difference.py │ ├── para_hemelb.py │ ├── refine.py │ └── sum.py ├── control │ ├── logging.cfg │ ├── luigi.cfg │ ├── master.yml │ └── simple.py ├── parareal │ ├── __init__.py │ ├── interfaces │ │ ├── __init__.py │ │ ├── heat1d.py │ │ └── hm.py │ ├── interval.py │ └── iohelp.py ├── requirements.txt ├── setup.py ├── tests │ ├── serial_equiv.py │ ├── test_heat1d.py │ ├── test_hm.py │ └── test_parareal.py └── tox.ini ├── README.md ├── Scripts ├── ParameterChooser.py ├── PrepareRBCsFromTimmsCode.py ├── SimpleGeometryGenerationScripts │ ├── README.txt │ ├── Site.py │ ├── block.py │ ├── four_cube.py │ ├── lattice_fixture.py │ └── link.py ├── checkCopyright.py ├── check_once_guards.py ├── enforce-commit-message.py └── logo.png ├── Tools └── estimates │ └── estimate.py ├── Vagrantfile ├── dependencies ├── Boost │ ├── build.cmake │ └── find.cmake ├── CMakeLists.txt ├── CTemplate │ ├── build.cmake │ ├── ctemplate_align.diff │ ├── ctemplate_vacopy.diff │ ├── find.cmake │ └── use.cmake ├── Catch2 │ ├── build.cmake │ ├── find.cmake │ └── mac-conditionals-gcc.diff ├── HDF5 │ ├── build.cmake │ └── find.cmake ├── MPWide │ ├── build.cmake │ └── find.cmake ├── ParMETIS │ ├── build.cmake │ └── find.cmake ├── README.md ├── TinyXML │ ├── build.cmake │ ├── find.cmake │ └── tinyxml.cmake ├── VTK │ ├── build.cmake │ └── find.cmake ├── ZLIB │ ├── build.cmake │ └── find.cmake ├── distributions │ └── README └── patches │ └── mpwide_include.diff ├── deploy ├── .jobscripts │ └── README ├── __init__.py ├── compile_options.yml ├── fab.py ├── machines.py ├── machines.yml ├── machines_user_example.yml ├── templates.py ├── templates │ ├── batch_build │ ├── batch_build_code │ ├── hemelb │ ├── multijob │ ├── multiscale_hemelb │ ├── no_batch │ ├── pbs │ ├── pbs-archer │ ├── pbs_barebone │ ├── pbs_serial │ ├── regression │ ├── sge │ ├── sge_oppenheimer │ └── unittests └── test │ ├── __init__.py │ ├── fixtures │ └── templates │ │ ├── dummy_ge_header │ │ ├── dummy_jobscript │ │ ├── hemelb │ │ └── no_batch │ ├── machines_user.yml │ └── test_fabric.py ├── doc ├── README.md ├── dev │ ├── README.md │ ├── file-formats │ │ ├── extraction.md │ │ ├── geometry.md │ │ ├── offset.md │ │ └── old-geometry.md │ └── formats │ │ └── Geometry.md └── user │ ├── CMakeOptions.md │ ├── XmlConfiguration.md │ ├── geometry-tool.md │ ├── machine-specific-build-notes │ └── archer2.md │ ├── main-application.md │ ├── non-cylindrical-velocity-inlets.md │ └── python-tools.md ├── fabfile.py ├── geometry-tool ├── .vagrant-provision-ubuntu-20.04.sh ├── CMakeLists.txt ├── HlbGmyTool │ ├── App.py │ ├── Bindings │ │ ├── BindableWxListCtrl.py │ │ ├── Bindings.py │ │ ├── EmptySelection.py │ │ ├── ListController.py │ │ ├── Mappers.py │ │ ├── ObjectController.py │ │ ├── Translators.py │ │ ├── VtkObject.py │ │ ├── WxMappers.py │ │ ├── __init__.py │ │ └── test.py │ ├── Controller │ │ ├── IoletController.py │ │ ├── IoletListController.py │ │ ├── PipelineController.py │ │ ├── PlacedIoletController.py │ │ ├── ProfileController.py │ │ ├── VectorController.py │ │ ├── VtkObjectController.py │ │ └── __init__.py │ ├── Model │ │ ├── Generation │ │ │ ├── .clang-format-ignore │ │ │ ├── Block.cpp │ │ │ ├── Block.h │ │ │ ├── BlockWriter.cpp │ │ │ ├── BlockWriter.h │ │ │ ├── BufferPool.cpp │ │ │ ├── BufferPool.h │ │ │ ├── BuildCGALPolygon.cpp │ │ │ ├── BuildCGALPolygon.h │ │ │ ├── CGALtypedef.h │ │ │ ├── CylinderGenerator.cpp │ │ │ ├── CylinderGenerator.h │ │ │ ├── Debug.cpp │ │ │ ├── Debug.h │ │ │ ├── Domain.cpp │ │ │ ├── Domain.h │ │ │ ├── GenerationError.h │ │ │ ├── GeometryGenerator.cpp │ │ │ ├── GeometryGenerator.h │ │ │ ├── GeometryWriter.cpp │ │ │ ├── GeometryWriter.h │ │ │ ├── InconsistentFluidnessError.cpp │ │ │ ├── InconsistentFluidnessError.h │ │ │ ├── Index.cpp │ │ │ ├── Index.h │ │ │ ├── Iolet.h │ │ │ ├── Neighbours.cpp │ │ │ ├── Neighbours.h │ │ │ ├── Point_inside_polyhedron_3.h │ │ │ ├── PolyDataGenerator.cpp │ │ │ ├── PolyDataGenerator.h │ │ │ ├── PybindVTKTypeCaster.h │ │ │ ├── Site.cpp │ │ │ ├── Site.h │ │ │ ├── SquareDuctGenerator.cpp │ │ │ ├── SquareDuctGenerator.h │ │ │ ├── Triangle_3_Ray_3_do_intersect.h │ │ │ └── Wrap.cpp │ │ ├── Iolets.py │ │ ├── OutputGeneration.py │ │ ├── Pipeline.py │ │ ├── PlacedIolet.py │ │ ├── Profile.py │ │ ├── SideLengthCalculator.py │ │ ├── Vector.py │ │ ├── XmlWriter.py │ │ └── __init__.py │ ├── Util │ │ ├── Enum.py │ │ ├── Observer.py │ │ ├── ProfileUpdateTools.py │ │ └── __init__.py │ ├── View │ │ ├── IoletListCtrl.py │ │ ├── Layout.py │ │ ├── MainWindow.py │ │ ├── ToolPanel.py │ │ ├── VectorCtrl.py │ │ ├── VtkViewPanel.py │ │ └── __init__.py │ ├── __init__.py │ └── scripts │ │ ├── __init__.py │ │ ├── cli.py │ │ ├── config_to_geometry.py │ │ ├── gui.py │ │ └── pro_to_pr2.py ├── InletProcessing │ ├── CreateEmptyWeightsFile.py │ ├── GatherInletData.py │ ├── InletPointFinder.py │ ├── PlotWeightsFile.py │ ├── PoiseuilleSolver.py │ ├── Run.py │ ├── SurfaceIntersectionFinder.py │ ├── TesselateFace.py │ └── __init__.py ├── README.md ├── conda-environment.yml ├── debug.sh ├── macos-fix-gui-launcher.py ├── pyproject.toml ├── setup.py └── tests │ ├── Model │ ├── data │ │ ├── test.gmy │ │ ├── test.pr2 │ │ ├── test.stl │ │ └── test.xml │ ├── fixtures │ │ ├── __init__.py │ │ ├── cube.stl │ │ ├── cylinder.stl │ │ ├── generate.py │ │ └── load.py │ └── test_OutputGeneration.py │ └── Util │ └── test_Observer.py └── python-tools ├── .gitignore ├── MANIFEST.in ├── README.md ├── hlb ├── .project ├── .pydevproject ├── Plane.py ├── SurfacePlaneClipper.py ├── __init__.py ├── cache.py ├── converters │ ├── ExtractedPropertyTextDump.py │ ├── ExtractedPropertyUnstructuredGridReader.py │ ├── Gmy3to4.py │ ├── GmyUnstructuredGridReader.py │ ├── GmyWallPointsReader.py │ └── __init__.py ├── dimension.py ├── parsers │ ├── __init__.py │ ├── extraction.py │ ├── geometry │ │ ├── BaseSite.pxd │ │ ├── BaseSite.pyx │ │ ├── __init__.py │ │ ├── compression.py │ │ ├── count_sites.py │ │ ├── freeing.py │ │ ├── generic.py │ │ ├── multiprocess.py │ │ ├── self_consistency.py │ │ └── simple.py │ └── offset.py ├── simconf │ ├── HemeLbParameters.py │ ├── OneInletHelper.py │ ├── PoiseuilleResistance.py │ ├── VesselNetwork.py │ ├── __init__.py │ └── simplify.py ├── surfacegenerator │ ├── CylinderGenerator.py │ ├── TriangulatedCylinderSource.py │ └── __init__.py ├── utils │ ├── IterPairs.py │ ├── SortedVector.py │ ├── XdrSerialisation.c │ ├── XdrSerialisation.h │ ├── __init__.py │ ├── cxdr.pxd │ ├── default_property.py │ ├── memo.py │ ├── utils.py │ ├── xdr.pxd │ ├── xdr.pyx │ └── xml_compare.py └── vtkhelp │ ├── __init__.py │ └── cells.py ├── pyproject.toml ├── requirements.txt ├── setup.py ├── test-requirements.txt ├── tests ├── conftest.py ├── test_converters.py ├── test_dumpextracted.py ├── test_geometry_compression.py ├── test_geometry_selfconsistent.py ├── test_parser_extracted.py ├── test_parser_geometry.py ├── test_parser_offset.py ├── test_utils.py └── test_xml_compare.py └── tox.ini /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Chromium 2 | -------------------------------------------------------------------------------- /.github/actions/get-tests-repo/README.md: -------------------------------------------------------------------------------- 1 | Get the hemelb-tests repo. 2 | 3 | This action will examine the ref of the hemelb repo. If it's a branch, 4 | it will try to get the same-named branch from hemelb-tests. Otherwise 5 | it will use the default branch (i.e. main). 6 | 7 | -------------------------------------------------------------------------------- /.github/actions/setup-compilers/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Set CC and CXX env vars for the configured compiler' 2 | 3 | inputs: 4 | compiler: 5 | description: 'Use $suite-$version' 6 | required: true 7 | 8 | runs: 9 | using: 'composite' 10 | steps: 11 | - name: Set the env vars with some bash 12 | shell: bash 13 | run: | 14 | set -ex 15 | input=${{ inputs.compiler }} 16 | split=(${input//-/ }) 17 | suite=${split[0]} 18 | version=${split[1]} 19 | case $suite in 20 | gnu) 21 | echo "CC=gcc-$version" >> $GITHUB_ENV 22 | echo "CXX=g++-$version" >> $GITHUB_ENV 23 | ;; 24 | llvm) 25 | echo "CC=clang-$version" >> $GITHUB_ENV 26 | echo "CXX=clang++-$version" >> $GITHUB_ENV 27 | echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV 28 | echo "LDFLAGS=-stdlib=libc++" >> $GITHUB_ENV 29 | ;; 30 | esac 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | *.pyc 3 | *.o 4 | *.d 5 | *~ 6 | .metadata/* 7 | build*/ 8 | Code/build/* 9 | Code/build_clang/* 10 | install/* 11 | results/* 12 | dependencies/build/* 13 | deploy/.jobscripts 14 | deploy/machines_user.json 15 | deploy/machines_user.yml 16 | personal/* 17 | CMakeFiles/* 18 | CMakeCache.txt 19 | Code/client/displayClient 20 | .DS_Store 21 | diffs 22 | dependencies/Makefile 23 | dependencies/cmake_install.cmake 24 | dependencies/bin 25 | dependencies/lib 26 | dependencies/include 27 | dependencies/share 28 | dependencies/distributions 29 | dependencies/parmetis-prefix 30 | dependencies/cppunit-prefix 31 | dependencies/tinyxml-prefix 32 | revision_info.txt 33 | hemelb-prefix/src/hemelb-stamp/hemelb-urlinfo.txt 34 | .*.sw[p, o, n] 35 | tags 36 | i 37 | .astyle 38 | .clang-format 39 | Tools/GenerateStl 40 | *-slack-token 41 | *.egg-info 42 | _skbuild 43 | dist 44 | .vagrant 45 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | This file lists the contributors to HemeLB. If their contributions are 2 | owned by their institution(s), this is listed in parentheses after 3 | their name. The details of authorship can be viewed in the git log. 4 | 5 | UCL = University College London, UK 6 | UoE = The University of Edinburgh, UK 7 | BUL = Brunel University London, UK 8 | 9 | James Hetherington (UCL) 10 | Hywel Carver (UCL) 11 | Rupert Nash (UCL, UoE) 12 | Miguel O. Bernabeu (UCL, UoE) 13 | Marco Mazzeo (UCL) 14 | Steven Manos (UCL) 15 | Derek Groen (UCL, BUL) 16 | David Scott (UoE) 17 | Nick Westlake (UCL) 18 | Daniel Holmes (UoE) 19 | Stefan Zasada (UCL) 20 | Jens H. Nielsen (UCL) 21 | Mayeul d'Avezac (UCL) 22 | Wojciech Kozlowski (UCL) 23 | Robert Haines (University of Manchester) 24 | Jiri Jaros (UCL) 25 | Gary Doctors (UCL) 26 | Robin Richardson (UCL) 27 | Mohamed Itani (UCL) 28 | Sebastian Schmieschek (UCL) 29 | David Abou Chacra 30 | -------------------------------------------------------------------------------- /CMake/DependencyOptions.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | include(PassOptions) 7 | 8 | pass_group_declare(DEPS) 9 | 10 | file(GLOB _dep_findcmake_list RELATIVE "${HEMELB_ROOT_DIR}/dependencies" */find.cmake) 11 | foreach(_dep_findcmake ${_dep_findcmake_list}) 12 | string(REPLACE "/find.cmake" "" _dep_name "${_dep_findcmake}") 13 | string(TOUPPER ${_dep_name} _up_name) 14 | pass_cachevar_choice(DEPS "DEPS_${_up_name}" Auto 15 | STRING "How to get ${_dep_name}. System: use an existing one. Build: build ourselves. Auto: try a system one and fall back to building." System;Auto;Build) 16 | endforeach() 17 | 18 | -------------------------------------------------------------------------------- /CMake/GlobalOptions.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | include(PassOptions) 7 | 8 | # This file defines the CMake options and cache variables across the 9 | # Superbuild, Code and dependencies project. Basically those HemeLB 10 | # options that affect which dependencies are needed. 11 | 12 | pass_group_declare(GLOBAL) 13 | 14 | pass_option(GLOBAL HEMELB_BUILD_MULTISCALE "Build HemeLB Multiscale functionality" OFF) 15 | pass_option(GLOBAL HEMELB_BUILD_RBC "Build the resolved red blood cells functionality" OFF) 16 | pass_option(GLOBAL HEMELB_BUILD_TESTS "Build the tests" ON) 17 | 18 | pass_cachevar(GLOBAL HEMELB_DEPENDENCIES_PATH "${HEMELB_ROOT_DIR}/dependencies" 19 | FILEPATH "Path to find dependency find modules") 20 | pass_cachevar(GLOBAL HEMELB_DEPENDENCIES_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} 21 | FILEPATH "Path to find dependency includes and libraries") 22 | pass_cachevar(GLOBAL HEMELB_SUBPROJECT_MAKE_JOBS 1 23 | STRING "Number of jobs to use for subproject build steps") 24 | -------------------------------------------------------------------------------- /CMake/UseHDF5.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | include(HemeLbDependency) 8 | 9 | find_hemelb_dependency(HDF5 REQUIRED) 10 | 11 | if(NOT TARGET hdf5::hdf5) 12 | message(STATUS "Hacking in a proper target for HDF5") 13 | 14 | add_library(hdf5::hdf5 INTERFACE IMPORTED) 15 | set_target_properties(hdf5::hdf5 PROPERTIES 16 | INTERFACE_COMPILE_DEFINITIONS "${HDF5_C_DEFINITIONS}" 17 | INTERFACE_INCLUDE_DIRECTORIES "${HDF5_C_INCLUDE_DIRS}" 18 | INTERFACE_LINK_LIBRARIES "${HDF5_C_LIBRARIES}" 19 | ) 20 | endif() 21 | 22 | if(NOT TARGET hdf5::hdf5_hl) 23 | message(STATUS "Hacking in a proper target for HDF5 high-level") 24 | 25 | add_library(hdf5::hdf5_hl INTERFACE IMPORTED) 26 | set_target_properties(hdf5::hdf5 PROPERTIES 27 | INTERFACE_LINK_LIBRARIES "hdf5::hdf5" 28 | ) 29 | endif() 30 | -------------------------------------------------------------------------------- /Code/.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | #Fri Oct 08 12:43:09 BST 2010 2 | eclipse.preferences.version=1 3 | formatter_profile=_HemeLB 4 | formatter_settings_version=1 5 | -------------------------------------------------------------------------------- /Code/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | #Thu Feb 03 14:16:44 GMT 2011 2 | eclipse.preferences.version=1 3 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 4 | -------------------------------------------------------------------------------- /Code/.settings/org.eclipse.wst.sse.core.prefs: -------------------------------------------------------------------------------- 1 | #Tue Mar 01 13:04:14 GMT 2011 2 | eclipse.preferences.version=1 3 | task-tags/enabled=true 4 | task-tags/taskPriorities=1,2,1,0 5 | task-tags/taskTags=TODO,FIXME,XXX,NOTE 6 | task-tags/use-project-settings=true 7 | -------------------------------------------------------------------------------- /Code/README: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | 7 | Build instructions: 8 | 9 | You just use "make" but must specificy the machine on which you're 10 | building through the environment variable $HEMELB_MACHINE: 11 | 12 | $ export HEMELB_MACHINE=OSX 13 | $ make 14 | 15 | or on the command line: 16 | $ make HEMELB_MACHINE=OSX 17 | 18 | Object files and the binary will be in the "build" subdirectory. 19 | 20 | "make clean" will clean just the directory you're in. 21 | "make clean_all" will clean the whole build. 22 | -------------------------------------------------------------------------------- /Code/cmake/build_environment.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | #------Capture build environment ------------- 8 | find_package(Git REQUIRED) 9 | execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD 10 | RESULT_VARIABLE rev_ok 11 | OUTPUT_VARIABLE HEMELB_REVISION_NUMBER 12 | OUTPUT_STRIP_TRAILING_WHITESPACE 13 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 14 | 15 | if (NOT rev_ok EQUAL 0) 16 | message("Could not get revision number from Git, looking for revision_info.txt") 17 | execute_process(COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/../revision_info.txt 18 | RESULT_VARIABLE rev_ok 19 | OUTPUT_VARIABLE HEMELB_REVISION_NUMBER 20 | OUTPUT_STRIP_TRAILING_WHITESPACE) 21 | endif() 22 | message("Revision number: ${HEMELB_REVISION_NUMBER}") 23 | 24 | execute_process(COMMAND date 25 | OUTPUT_VARIABLE HEMELB_BUILD_TIME 26 | OUTPUT_STRIP_TRAILING_WHITESPACE) 27 | 28 | -------------------------------------------------------------------------------- /Code/cmake/intel_cpp11.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") 8 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 9 | endif() 10 | -------------------------------------------------------------------------------- /Code/cmake/macos-allow-debug.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.get-task-allow 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Code/cmake/mountain_lion_scandir.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | include(CheckCXXSourceCompiles) 8 | # mountain lion changed the api of scandir from BSD to LINUX style 9 | CHECK_CXX_SOURCE_COMPILES(" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | typedef const struct direct direct_t; 23 | int selectOnlyContents(direct_t *entry) 24 | { 25 | return 1; 26 | } 27 | int main(int count, char** v) 28 | { 29 | std::string pathname = \"\\tmp\"; 30 | struct direct **files; 31 | int file_count = scandir(pathname.c_str(), &files, selectOnlyContents, alphasort); 32 | return 0; 33 | }" 34 | LINUX_SCANDIR) 35 | -------------------------------------------------------------------------------- /Code/cmake/mpi.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | # ------MPI------------------ 8 | # Require MPI for this project: 9 | find_package(MPI REQUIRED) 10 | set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}") 11 | set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${CMAKE_CXX_LINK_FLAGS}") 12 | include_directories(${MPI_INCLUDE_PATH}) 13 | -------------------------------------------------------------------------------- /Code/cmake/platform_checks.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | include(gnu_bug) 8 | include(mountain_lion_scandir) 9 | include(intel_cpp11) 10 | 11 | include(CheckCXXSourceCompiles) 12 | include(CheckCXXSymbolExists) 13 | 14 | CHECK_CXX_SOURCE_COMPILES("#include \n#include \nint main(int c,char** v){ rusage usage;\ngetrusage(RUSAGE_SELF, &usage);\nreturn usage.ru_maxrss; }" HAVE_RUSAGE) 15 | 16 | CHECK_CXX_SOURCE_COMPILES(" 17 | #include 18 | #include 19 | #include 20 | int main(int count, char** v){ 21 | char buffer[15] = \"aaaaaaaaaaaaa\"; 22 | XDR xdr; 23 | xdrmem_create(&xdr, buffer, 32, XDR_ENCODE); 24 | uint16_t a; 25 | uint32_t b; 26 | uint64_t c; 27 | xdr_uint16_t(&xdr, &a); 28 | xdr_uint32_t(&xdr, &b); 29 | xdr_uint64_t(&xdr, &c); 30 | return b; 31 | }" HAVE_XDRUINTXX_T) 32 | 33 | -------------------------------------------------------------------------------- /Code/colloids/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_colloids OBJECT 7 | BoundaryConditions.cc 8 | BodyForces.cc 9 | ParticleMpiDatatypes.cc 10 | ParticleSet.cc 11 | Particle.cc 12 | PersistedParticle.cc 13 | ColloidController.cc 14 | ) 15 | target_link_libraries(hemelb_colloids 16 | hemelb_io 17 | hemelb_configuration 18 | hemelb_lb 19 | ) 20 | target_compile_definitions(hemelb_colloids PUBLIC HEMELB_BUILD_COLLOIDS) 21 | -------------------------------------------------------------------------------- /Code/confcheck.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "configuration/SimConfig.h" 11 | #include "net/MpiEnvironment.h" 12 | 13 | using SimConfig = hemelb::configuration::SimConfig; 14 | 15 | const char* usage = "confcheck hemelb_input_config.xml"; 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | if (argc != 2) { 20 | std::cerr << "Wrong number of arguments\n" 21 | << "Usage: " << usage << std::endl; 22 | return 1; 23 | } 24 | 25 | const auto xml_path = std::string{argv[1]}; 26 | 27 | // When #755 is closed, remove MPI 28 | hemelb::net::MpiEnvironment mpi(argc, argv); 29 | try { 30 | auto conf = SimConfig::New(xml_path); 31 | return 0; 32 | } catch (std::exception& e) { 33 | std::cerr << "Error reading HemeLB configuration XML file: " 34 | << e.what() 35 | << std::endl; 36 | return 1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Code/configuration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_configuration OBJECT CommandLine.cc SimConfig.cc SimBuilder.cc) 7 | -------------------------------------------------------------------------------- /Code/debug.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_DEBUG_H 7 | #define HEMELB_DEBUG_H 8 | 9 | namespace hemelb::net { class MpiCommunicator; } 10 | 11 | namespace hemelb::debug { 12 | class Debugger; 13 | 14 | // Convenient interface to custom small-scale parallel debug. 15 | void Init(bool active, const char * executable, const net::MpiCommunicator& comm); 16 | void Break(); 17 | } 18 | 19 | #endif -------------------------------------------------------------------------------- /Code/debug/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | if(HEMELB_BUILD_DEBUGGER) 7 | if(APPLE) 8 | set(debugger_implementation OSX/OsxDebugger.cc common/ActiveDebugger.cc) 9 | set(HEMELB_DEBUGGER_IMPLEMENTATION OSX) 10 | elseif(UNIX) 11 | set(debugger_implementation linux/LinuxDebugger.cc common/ActiveDebugger.cc) 12 | set(HEMELB_DEBUGGER_IMPLEMENTATION linux) 13 | else() 14 | message("No hemelb built-in debugger available for system ${CMAKE_SYSTEM_NAME}") 15 | set(debugger_implementation none/NullDebugger.cc) 16 | set(HEMELB_DEBUGGER_IMPLEMENTATION none) 17 | endif() 18 | else() 19 | set(HEMELB_DEBUGGER_IMPLEMENTATION none) 20 | endif() 21 | set(HEMELB_DEBUGGER_IMPLEMENTATION_${HEMELB_DEBUGGER_IMPLEMENTATION} ON) 22 | 23 | configure_file ( 24 | "${PROJECT_SOURCE_DIR}/debug/PlatformDebugger.h.in" 25 | "${PROJECT_BINARY_DIR}/debug/PlatformDebugger.h" 26 | ) 27 | 28 | add_library(hemelb_debug OBJECT 29 | Debugger.cc none/NullDebugger.cc ${debugger_implementation}) 30 | #No debugging for now - pending platform dependence 31 | -------------------------------------------------------------------------------- /Code/debug/OSX/OsxDebugger.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_DEBUG_OSX_OSXDEBUGGER_H 7 | #define HEMELB_DEBUG_OSX_OSXDEBUGGER_H 8 | 9 | #include 10 | 11 | namespace hemelb::debug 12 | { 13 | 14 | class OsxDebugger : public ActiveDebugger 15 | { 16 | protected: 17 | // Platform specific getters 18 | [[nodiscard]] std::string GetBinaryPath() const override; 19 | [[nodiscard]] std::string GetPlatformInterpreter() const override; 20 | [[nodiscard]] std::string GetPlatformScript() const override; 21 | 22 | // C'tor... 23 | OsxDebugger(const char* executable, const net::MpiCommunicator& comm); 24 | // ... which the factory function needs to be able to get at. 25 | friend class Debugger; 26 | 27 | }; 28 | 29 | } 30 | 31 | #endif // HEMELB_DEBUG_OSX_OSXDEBUGGER_H 32 | -------------------------------------------------------------------------------- /Code/debug/OSX/resume.gdb: -------------------------------------------------------------------------------- 1 | # Get out of sleep and disable the waiting flag 2 | up 3 | up 4 | up 5 | set var amWaiting = 0 6 | 7 | # Set up a breakpoint for our break function and a command to finish 8 | # it automatically 9 | break hemelb::debug::ActiveDebugger::BreakHere 10 | commands 11 | finish 12 | end 13 | 14 | # carry on 15 | continue 16 | -------------------------------------------------------------------------------- /Code/debug/OSX/resume.lldb: -------------------------------------------------------------------------------- 1 | frame select -r 3 2 | expr amWaiting = 0 3 | breakpoint set -n hemelb::debug::Break 4 | breakpoint command add -o 'finish' 5 | continue 6 | -------------------------------------------------------------------------------- /Code/debug/linux/launchGdbs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | 7 | DIR=$(cd $(dirname "$0"); pwd) 8 | # Try to guess which environment to run appropriate debugger script 9 | if [ "$(pidof ksmserver)" ]; then 10 | # KDE 11 | $DIR/launchKonsole.sh "$@" 12 | elif [ "$(pidof gnome-session)" ]; then 13 | # GNOME 14 | $DIR/launchGnomeTerminal.sh "$@" 15 | else 16 | # Panic 17 | echo "Can't figure out environment" 18 | fi 19 | -------------------------------------------------------------------------------- /Code/debug/linux/launchGnomeTerminal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | DIR=$(dirname "$0") 7 | debuggerCommandFile=$DIR/resume.gdb 8 | 9 | binary=$1 10 | shift 11 | 12 | # Build the debugger invocation 13 | debugger="gdb -q -x $debuggerCommandFile" 14 | # If the -file flag is given then also run those GDB commands 15 | if [ "$1" == "-file" ]; then 16 | debugger="$debugger -x $2" 17 | shift 2 18 | fi 19 | # Add the binary 20 | debugger="$debugger $binary" 21 | 22 | # Positional params now hold the process ids we 23 | # want to attach to. 24 | 25 | command="gnome-terminal" 26 | rank=0 27 | 28 | until [ -z "$1" ] # all params used up 29 | do 30 | pid=$1 31 | shift 32 | 33 | if [ "$rank" -eq "0" ]; then 34 | command="${command} --window -e '${debugger} $pid'" 35 | else 36 | command="${command} --tab -e '${debugger} $pid'" 37 | fi 38 | 39 | ((rank++)) 40 | done 41 | 42 | echo $command 43 | eval $command 44 | 45 | -------------------------------------------------------------------------------- /Code/debug/linux/resume.gdb: -------------------------------------------------------------------------------- 1 | # Get out of sleep and disable the waiting flag 2 | up 3 | up 4 | set amWaiting = 0 5 | 6 | # Set up a breakpoint for our break function and a command to finish 7 | # it automatically 8 | break hemelb::debug::ActiveDebugger::BreakHere 9 | commands 10 | finish 11 | end 12 | 13 | # carry on 14 | continue 15 | -------------------------------------------------------------------------------- /Code/debug/none/NullDebugger.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "debug/none/NullDebugger.h" 7 | 8 | namespace hemelb::debug 9 | { 10 | // Do nothing! 11 | void NullDebugger::Attach() 12 | { 13 | } 14 | void NullDebugger::BreakHere() 15 | { 16 | } 17 | void NullDebugger::Print(const char* iFormat, ...) 18 | { 19 | } 20 | 21 | NullDebugger::NullDebugger(const char* const executable, const net::MpiCommunicator& comm) : 22 | Debugger(executable, comm) 23 | { 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Code/debug/none/NullDebugger.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_DEBUG_NONE_NULLDEBUGGER_H 7 | #define HEMELB_DEBUG_NONE_NULLDEBUGGER_H 8 | 9 | #include "debug/Debugger.h" 10 | 11 | namespace hemelb::debug 12 | { 13 | class NullDebugger : public Debugger 14 | { 15 | public: 16 | void BreakHere() override; 17 | void Print(const char* iFormat, ...) override; 18 | 19 | protected: 20 | void Attach() override; 21 | NullDebugger(const char* executable, const net::MpiCommunicator& comm); 22 | friend class Debugger; 23 | }; 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Code/extraction/ArbitrarySiteListIterableDataSource.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | #include "extraction/ArbitrarySiteListIterableDataSource.h" 6 | 7 | namespace hemelb 8 | { 9 | namespace extraction 10 | { 11 | ArbitrarySiteListIterableDataSource::~ArbitrarySiteListIterableDataSource() 12 | { 13 | 14 | } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Code/extraction/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_extraction OBJECT 7 | GeometrySelector.cc 8 | StraightLineGeometrySelector.cc LocalPropertyOutput.cc 9 | IterableDataSource.cc PlaneGeometrySelector.cc PropertyActor.cc 10 | PropertyWriter.cc WholeGeometrySelector.cc LbDataSourceIterator.cc 11 | GeometrySurfaceSelector.cc SurfacePointSelector.cc LocalDistributionInput.cc) 12 | -------------------------------------------------------------------------------- /Code/extraction/GeometrySelector.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "extraction/GeometrySelector.h" 7 | 8 | namespace hemelb::extraction 9 | { 10 | 11 | bool GeometrySelector::Include(const extraction::IterableDataSource& data, 12 | const util::Vector3D& location) const 13 | { 14 | if (!data.IsValidLatticeSite(location) || !data.IsAvailable(location)) 15 | { 16 | return false; 17 | } 18 | 19 | return IsWithinGeometry(data, location); 20 | } 21 | 22 | util::Vector3D GeometrySelector::LatticeToPhysical(const extraction::IterableDataSource& data, const util::Vector3D& location) const { 23 | return util::Vector3D{location} * float(data.GetVoxelSize()) + data.GetOrigin().as(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Code/extraction/GeometrySelectors.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_EXTRACTION_GEOMETRYSELECTORS_H 7 | #define HEMELB_EXTRACTION_GEOMETRYSELECTORS_H 8 | 9 | #include "extraction/StraightLineGeometrySelector.h" 10 | #include "extraction/PlaneGeometrySelector.h" 11 | #include "extraction/WholeGeometrySelector.h" 12 | #include "extraction/GeometrySurfaceSelector.h" 13 | #include "extraction/SurfacePointSelector.h" 14 | 15 | #endif /* HEMELB_EXTRACTION_GEOMETRYSELECTORS_H */ 16 | -------------------------------------------------------------------------------- /Code/extraction/GeometrySurfaceSelector.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "extraction/GeometrySurfaceSelector.h" 7 | 8 | namespace hemelb::extraction 9 | { 10 | 11 | GeometrySelector* GeometrySurfaceSelector::clone() const { 12 | return new GeometrySurfaceSelector{}; 13 | } 14 | 15 | bool GeometrySurfaceSelector::IsWithinGeometry(const extraction::IterableDataSource& data, 16 | const util::Vector3D& location) const 17 | { 18 | return data.IsWallSite(location); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Code/extraction/GeometrySurfaceSelector.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_EXTRACTION_GEOMETRYSURFACESELECTOR_H 7 | #define HEMELB_EXTRACTION_GEOMETRYSURFACESELECTOR_H 8 | 9 | #include "extraction/GeometrySelector.h" 10 | 11 | namespace hemelb::extraction 12 | { 13 | 14 | class GeometrySurfaceSelector : public GeometrySelector 15 | { 16 | public: 17 | ~GeometrySurfaceSelector() override = default; 18 | GeometrySelector* clone() const override; 19 | 20 | protected: 21 | bool IsWithinGeometry(const extraction::IterableDataSource& data, const util::Vector3D& location) const override; 22 | }; 23 | 24 | } 25 | 26 | #endif // HEMELB_EXTRACTION_GEOMETRYSURFACESELECTOR_H 27 | -------------------------------------------------------------------------------- /Code/extraction/InputField.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_EXTRACTION_INPUTFIELD_H 7 | #define HEMELB_EXTRACTION_INPUTFIELD_H 8 | 9 | #include 10 | #include 11 | #include "io/formats/extraction.h" 12 | 13 | namespace hemelb 14 | { 15 | namespace extraction 16 | { 17 | struct InputField 18 | { 19 | std::string name; 20 | std::uint32_t numberOfElements; 21 | std::uint32_t typecode; 22 | std::uint32_t numberOfOffsets; 23 | // The type of offsets varies depending on typecode, but for now 24 | // we are only dealing with double precision data (the 25 | // distributions) without an offset, so just omit. 26 | // 27 | // std::vector offsets; 28 | }; 29 | } 30 | } 31 | 32 | #endif /* HEMELB_EXTRACTION_INPUTFIELD_H */ 33 | -------------------------------------------------------------------------------- /Code/extraction/IterableDataSource.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "extraction/IterableDataSource.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace extraction 11 | { 12 | IterableDataSource::~IterableDataSource() 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Code/extraction/WholeGeometrySelector.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "extraction/WholeGeometrySelector.h" 7 | 8 | namespace hemelb::extraction 9 | { 10 | 11 | GeometrySelector* WholeGeometrySelector::clone() const { 12 | return new WholeGeometrySelector{}; 13 | } 14 | 15 | bool WholeGeometrySelector::IsWithinGeometry(const extraction::IterableDataSource& data, 16 | const util::Vector3D& location) const 17 | { 18 | return true; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Code/extraction/WholeGeometrySelector.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_EXTRACTION_WHOLEGEOMETRYSELECTOR_H 7 | #define HEMELB_EXTRACTION_WHOLEGEOMETRYSELECTOR_H 8 | 9 | #include "extraction/GeometrySelector.h" 10 | 11 | namespace hemelb::extraction 12 | { 13 | // Class for selecting the whole geometry. 14 | class WholeGeometrySelector : public GeometrySelector 15 | { 16 | public: 17 | ~WholeGeometrySelector() override = default; 18 | GeometrySelector* clone() const override; 19 | 20 | protected: 21 | // Returns true for all locations. 22 | bool IsWithinGeometry(const extraction::IterableDataSource& data, const util::Vector3D& location) const override; 23 | }; 24 | } 25 | 26 | #endif // HEMELB_EXTRACTION_WHOLEGEOMETRYSELECTOR_H 27 | -------------------------------------------------------------------------------- /Code/geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_geometry OBJECT 7 | GmyReadResult.cc 8 | BlockTraverser.cc 9 | GeometryReader.cc needs/Needs.cc 10 | LookupTree.cc 11 | Domain.cc FieldData.cc 12 | SiteDataBare.cc 13 | SiteTraverser.cc VolumeTraverser.cc Block.cc 14 | decomposition/BasicDecomposition.cc 15 | decomposition/OptimisedDecomposition.cc 16 | neighbouring/NeighbouringDomain.cc 17 | neighbouring/NeighbouringDataManager.cc 18 | neighbouring/RequiredSiteInformation.cc 19 | ) 20 | target_link_libraries(hemelb_geometry PRIVATE ParMETIS::ParMETIS ZLIB::ZLIB) 21 | 22 | configure_file( 23 | "${PROJECT_SOURCE_DIR}/geometry/decomposition/DecompositionWeights.h.in" 24 | "${PROJECT_BINARY_DIR}/geometry/decomposition/DecompositionWeights.h" 25 | ) 26 | 27 | configure_file( 28 | "${PROJECT_SOURCE_DIR}/geometry/ParmetisForward.h.in" 29 | "${PROJECT_BINARY_DIR}/geometry/ParmetisForward.h" 30 | ) 31 | -------------------------------------------------------------------------------- /Code/geometry/GeometryBlock.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_GEOMETRY_GEOMETRYBLOCK_H 7 | #define HEMELB_GEOMETRY_GEOMETRYBLOCK_H 8 | 9 | #include 10 | #include "geometry/GeometrySite.h" 11 | 12 | namespace hemelb::geometry 13 | { 14 | /*** 15 | * Model of the information stored for a block in a geometry file. 16 | * Just gives the array of sites 17 | */ 18 | struct BlockReadResult 19 | { 20 | std::vector Sites; 21 | }; 22 | } 23 | 24 | #endif /* HEMELB_GEOMETRY_GEOMETRYBLOCK_H */ 25 | -------------------------------------------------------------------------------- /Code/geometry/ParmetisForward.h.in: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_GEOMETRY_PARMETISFORWARD_H_IN 7 | #define HEMELB_GEOMETRY_PARMETISFORWARD_H_IN 8 | 9 | typedef @METIS_IDX_T@ idx_t; 10 | typedef @METIS_REAL_T@ real_t; 11 | #endif 12 | -------------------------------------------------------------------------------- /Code/geometry/ParmetisHeader.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_GEOMETRY_PARMETISHEADER_H 7 | #define HEMELB_GEOMETRY_PARMETISHEADER_H 8 | 9 | #include "parmetis.h" 10 | #if (PARMETIS_MAJOR_VERSION < 4) 11 | typedef idxtype idx_t; 12 | typedef float real_t; 13 | #endif 14 | 15 | #endif /* HEMELB_GEOMETRY_PARMETISHEADER_H */ 16 | -------------------------------------------------------------------------------- /Code/geometry/SiteData.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_GEOMETRY_SITEDATA_H 7 | #define HEMELB_GEOMETRY_SITEDATA_H 8 | 9 | #include "geometry/SiteDataBare.h" 10 | #include "net/MpiDataType.h" 11 | 12 | 13 | #endif /* HEMELB_GEOMETRY_SITEDATA_H */ 14 | -------------------------------------------------------------------------------- /Code/geometry/SiteTraverser.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "geometry/Domain.h" 7 | #include "geometry/SiteTraverser.h" 8 | 9 | namespace hemelb::geometry 10 | { 11 | SiteTraverser::SiteTraverser(const geometry::Domain& iLatticeData) : 12 | mLatticeData(iLatticeData) 13 | 14 | { 15 | } 16 | 17 | U16 SiteTraverser::GetXCount() const 18 | { 19 | return GetBlockSize(); 20 | } 21 | 22 | U16 SiteTraverser::GetYCount() const 23 | { 24 | return GetBlockSize(); 25 | } 26 | 27 | U16 SiteTraverser::GetZCount() const 28 | { 29 | return GetBlockSize(); 30 | } 31 | 32 | U16 SiteTraverser::GetBlockSize() const 33 | { 34 | return mLatticeData.GetBlockSize(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/geometry/SiteTraverser.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_GEOMETRY_SITETRAVERSER_H 7 | #define HEMELB_GEOMETRY_SITETRAVERSER_H 8 | 9 | #include "geometry/VolumeTraverser.h" 10 | 11 | namespace hemelb::geometry 12 | { 13 | class Domain; 14 | 15 | /** 16 | * SiteTraverser is used to traverse the sites in a speficied block 17 | * within the lattice data 18 | */ 19 | class SiteTraverser : public VolumeTraverser 20 | { 21 | public: 22 | SiteTraverser(const Domain & iLatticeDat); 23 | 24 | ~SiteTraverser() override = default; 25 | 26 | U16 GetXCount() const override; 27 | 28 | U16 GetYCount() const override; 29 | 30 | U16 GetZCount() const override; 31 | 32 | private: 33 | //Returns the block size in number of sites 34 | U16 GetBlockSize() const; 35 | 36 | const Domain & mLatticeData; 37 | }; 38 | 39 | } 40 | 41 | #endif // HEMELB_GEOMETRY_SITETRAVERSER_H 42 | -------------------------------------------------------------------------------- /Code/geometry/SiteType.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_GEOMETRY_SITETYPE_H 7 | #define HEMELB_GEOMETRY_SITETYPE_H 8 | 9 | namespace hemelb::geometry 10 | { 11 | /* 12 | * Note: The implementation contains the MPI type registration code. 13 | */ 14 | enum SiteType: unsigned 15 | { 16 | // These must be consistent with the setup tool 17 | SOLID_TYPE = 0U, 18 | FLUID_TYPE = 1U, 19 | INLET_TYPE = 2U, 20 | OUTLET_TYPE = 3U 21 | }; 22 | 23 | } 24 | 25 | #ifdef HEMELB_CODE 26 | 27 | // If we are building the main app, let MPI use the underlying type of 28 | // the enum for comms. 29 | #include "net/MpiDataType.h" 30 | 31 | namespace hemelb::geometry { 32 | inline MPI_Datatype MpiDataType(SiteType const&) { 33 | return net::MpiDataType(); 34 | } 35 | } 36 | 37 | #endif 38 | 39 | #endif // HEMELB_GEOMETRY_SITETYPE_H 40 | -------------------------------------------------------------------------------- /Code/geometry/neighbouring/NeighbouringSite.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | -------------------------------------------------------------------------------- /Code/hassert.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_HASSERT_H 7 | #define HEMELB_HASSERT_H 8 | 9 | #ifdef HEMELB_CODE 10 | // A HemeLB assertion macro 11 | #include "Exception.h" 12 | #include "build_info.h" 13 | 14 | #define HASSERT(expr) \ 15 | if constexpr (::hemelb::DEBUG) { \ 16 | if (!(expr)) { \ 17 | throw (::hemelb::Exception() << "Assertion failure '" #expr "' in '" __FILE__ ":" << __LINE__); \ 18 | } \ 19 | } 20 | 21 | #else // Fall back to C assert macro 22 | #include 23 | #define HASSERT(expr) assert(expr) 24 | 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Code/io/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | if(NOT HAVE_XDRUINTXX_T) 7 | #Without the standard names for the xdr functions, create aliases for the existing ones. 8 | add_definitions(-Dxdr_uint16_t=xdr_u_int16_t) 9 | add_definitions(-Dxdr_uint32_t=xdr_u_int32_t) 10 | add_definitions(-Dxdr_uint64_t=xdr_u_int64_t) 11 | endif() 12 | 13 | add_library(hemelb_io OBJECT 14 | FILE.cc 15 | PathManager.cc 16 | writers/AsciiFileWriter.cc writers/AsciiStreamWriter.cc 17 | readers/XdrFileReader.cc 18 | readers/XdrMemReader.cc 19 | writers/XdrWriter.cc 20 | writers/XdrMemWriter.cc 21 | writers/XdrFileWriter.cc 22 | writers/XdrVectorWriter.cc 23 | writers/NullWriter.cc 24 | writers/Writer.cc 25 | formats/geometry.cc 26 | xml.cc 27 | ) 28 | 29 | target_link_libraries(hemelb_io PUBLIC 30 | hemelb_util 31 | ) 32 | target_link_libraries(hemelb_io PRIVATE 33 | TinyXML::TinyXML 34 | ) 35 | -------------------------------------------------------------------------------- /Code/io/FILE.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_FILE_H 7 | #define HEMELB_IO_FILE_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace hemelb::io { 14 | class FILE { 15 | struct Closer { 16 | void operator()(std::FILE *); 17 | }; 18 | 19 | using ClosingPtr = std::unique_ptr; 20 | ClosingPtr _handle; 21 | public: 22 | static FILE open(std::filesystem::path const &p, std::string_view mode); 23 | 24 | // Direct file read - calls std::fread on the underlying file handle 25 | std::size_t read(void *buffer, std::size_t size, std::size_t count); 26 | 27 | // Direct file read - calls std::fwrite on the underlying file handle 28 | std::size_t write(void const *buffer, std::size_t size, std::size_t count); 29 | 30 | long tell(); 31 | 32 | int seek(long offset, long origin); 33 | 34 | void clearerr(); 35 | }; 36 | } 37 | #endif -------------------------------------------------------------------------------- /Code/io/formats/formats.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_FORMATS_FORMATS_H 7 | #define HEMELB_IO_FORMATS_FORMATS_H 8 | 9 | namespace hemelb 10 | { 11 | namespace io 12 | { 13 | namespace formats 14 | { 15 | // This is the generic HemeLB binary file identifier. It should be the 16 | // first 4 bytes of every (binary) file used for IO. It should be then 17 | // followed by another 4 bytes identifying the particular type/version, 18 | // that number being terminated by the EOF character (0x04) 19 | enum 20 | { 21 | // ASCII for hlb! 22 | HemeLbMagicNumber = 0x686c6221 23 | }; 24 | } 25 | } 26 | 27 | } 28 | #endif // HEMELB_IO_FORMATS_H 29 | -------------------------------------------------------------------------------- /Code/io/formats/geometry.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/formats/geometry.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace io 11 | { 12 | namespace formats 13 | { 14 | constexpr geometry::DisplacementArray geometry::Neighbourhood; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Code/io/h5md/H5MDException.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | #ifndef HEMELB_IO_H5MD_H5MDEXCEPTION_H 6 | #define HEMELB_IO_H5MD_H5MDEXCEPTION_H 7 | 8 | #include "Exception.h" 9 | 10 | namespace hemelb 11 | { 12 | namespace io 13 | { 14 | namespace h5md 15 | { 16 | 17 | class H5MDException : public ::hemelb::Exception { 18 | public: 19 | H5MDException() {} 20 | H5MDException(const std::string & what) : reason(what) {} 21 | const std::string & what() { return reason; } 22 | private: 23 | std::string reason; 24 | }; 25 | 26 | } 27 | } 28 | } 29 | 30 | #endif // HEMELB_IO_H5MD_H5MDEXCEPTION_H 31 | -------------------------------------------------------------------------------- /Code/io/readers/XdrFileReader.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | #include 6 | #include 7 | 8 | #include "io/readers/XdrFileReader.h" 9 | 10 | namespace hemelb::io 11 | { 12 | // Constructor to create an Xdr object based on a file. 13 | XdrFileReader::XdrFileReader(const std::filesystem::path& fn) : 14 | fh{FILE::open(fn, "r")} { 15 | } 16 | 17 | unsigned XdrFileReader::GetPosition() { 18 | return fh.tell(); 19 | } 20 | 21 | const char* XdrFileReader::get_bytes(size_t n) { 22 | buf.clear(); 23 | buf.resize(n); 24 | auto nread = fh.read(buf.data(), 1, n); 25 | if (nread != n) 26 | throw Exception() << "Could not read " << n << " bytes, instead got " << nread; 27 | return buf.data(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Code/io/readers/XdrFileReader.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_READERS_XDRFILEREADER_H 7 | #define HEMELB_IO_READERS_XDRFILEREADER_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "io/readers/XdrReader.h" 14 | #include "io/FILE.h" 15 | 16 | namespace hemelb::io 17 | { 18 | // Deserialise from a file given by path. 19 | class XdrFileReader : public XdrReader { 20 | public: 21 | XdrFileReader(const std::filesystem::path& fn); 22 | ~XdrFileReader() override = default; 23 | unsigned GetPosition() override; 24 | protected: 25 | const char* get_bytes(size_t n) override; 26 | private: 27 | FILE fh; 28 | // Buffer for holding read data 29 | std::vector buf; 30 | }; 31 | 32 | } 33 | 34 | #endif // HEMELB_IO_READERS_XDRFILEREADER_H 35 | -------------------------------------------------------------------------------- /Code/io/readers/XdrMemReader.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/readers/XdrMemReader.h" 7 | #include "hassert.h" 8 | 9 | namespace hemelb::io 10 | { 11 | // Constructor to create an Xdr object based on a memory buffer 12 | XdrMemReader::XdrMemReader(const char* buf, unsigned int dataLength) 13 | : start(buf), current(buf), len(dataLength) 14 | { 15 | } 16 | 17 | XdrMemReader::XdrMemReader(const std::vector& dataVec) 18 | : start(dataVec.data()), current(start), len(dataVec.size()) 19 | { 20 | } 21 | 22 | unsigned XdrMemReader::GetPosition() { 23 | return current - start; 24 | } 25 | 26 | const char* XdrMemReader::get_bytes(size_t n) { 27 | HASSERT(GetPosition() + n <= len); 28 | auto ans = current; 29 | current += n; 30 | return ans; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Code/io/readers/XdrMemReader.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_READERS_XDRMEMREADER_H 7 | #define HEMELB_IO_READERS_XDRMEMREADER_H 8 | 9 | #include 10 | 11 | #include "io/readers/XdrReader.h" 12 | 13 | namespace hemelb::io 14 | { 15 | 16 | // Deserialise from some memory. 17 | // 18 | // NB: this class does not OWN the memory you pass to its 19 | // constructor. Caller is responsible for ensuring its lifetime 20 | // exceeds that of the object. 21 | class XdrMemReader : public XdrReader 22 | { 23 | public: 24 | XdrMemReader(const char* dataBuffer, unsigned int dataLength); 25 | XdrMemReader(const std::vector& dataVec); 26 | ~XdrMemReader() override = default; 27 | unsigned GetPosition() override; 28 | protected: 29 | const char* get_bytes(size_t n) override; 30 | private: 31 | const char* start; 32 | const char* current; 33 | size_t len; 34 | }; 35 | } 36 | 37 | #endif // HEMELB_IO_READERS_XDRMEMREADER_H 38 | -------------------------------------------------------------------------------- /Code/io/writers/AsciiFileWriter.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include 7 | #include 8 | 9 | #include "io/writers/AsciiFileWriter.h" 10 | 11 | namespace hemelb::io 12 | { 13 | 14 | // Implement a constructor that opens the file and creates the Xdr 15 | // object to write to it. 16 | AsciiFileWriter::AsciiFileWriter(std::string const& fileName) 17 | { 18 | outStream = std::make_unique(fileName); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Code/io/writers/AsciiFileWriter.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_WRITERS_ASCIIFILEWRITER_H 7 | #define HEMELB_IO_WRITERS_ASCIIFILEWRITER_H 8 | 9 | #include 10 | 11 | #include "io/writers/AsciiStreamWriter.h" 12 | 13 | namespace hemelb::io 14 | { 15 | // Class to write a file. The actual write functions are implemented 16 | // in the base class. 17 | class AsciiFileWriter : public AsciiStreamWriter 18 | { 19 | 20 | public: 21 | explicit AsciiFileWriter(std::string const& fileName); 22 | ~AsciiFileWriter() override = default; 23 | 24 | }; 25 | } 26 | #endif // HEMELB_IO_WRITERS_ASCIIFILEWRITER_H 27 | -------------------------------------------------------------------------------- /Code/io/writers/Writer.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/writers/Writer.h" 7 | 8 | namespace hemelb::io 9 | { 10 | 11 | Writer& Writer::operator<<(enum Writer::Separator const & value) 12 | { 13 | writeRecordSeparator(); 14 | return *this; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Code/io/writers/XdrFileWriter.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/writers/XdrFileWriter.h" 7 | 8 | namespace hemelb::io 9 | { 10 | 11 | // Use base class special constructor 12 | // Functor 1 opens the file 13 | // Functor 2 makes an iterator that writes to it 14 | XdrFileWriter::XdrFileWriter(const std::string& fileName) : 15 | base([&fileName]() { 16 | return std::ofstream(fileName); 17 | }, 18 | [](std::ofstream& fb){ 19 | return std::ostreambuf_iterator(fb); 20 | }) 21 | { 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Code/io/writers/XdrFileWriter.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_WRITERS_XDRFILEWRITER_H 7 | #define HEMELB_IO_WRITERS_XDRFILEWRITER_H 8 | 9 | #include 10 | #include 11 | #include "io/writers/XdrWriter.h" 12 | 13 | namespace hemelb::io 14 | { 15 | 16 | using CharFileIter = std::ostreambuf_iterator; 17 | 18 | // Wrapper that owns a filehandle and uses that as the sink for data 19 | class XdrFileWriter : public XdrMetaWriter 20 | { 21 | using base = XdrMetaWriter; 22 | public: 23 | explicit XdrFileWriter(const std::string& fileName); 24 | }; 25 | 26 | } 27 | #endif // HEMELB_IO_WRITERS_XDRFILEWRITER_H 28 | -------------------------------------------------------------------------------- /Code/io/writers/XdrMemWriter.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/writers/XdrMemWriter.h" 7 | 8 | namespace hemelb::io 9 | { 10 | 11 | XdrMemWriter::XdrMemWriter(char* dataBuffer, unsigned int dataLength) : 12 | XdrMetaWriter(dataBuffer, dataBuffer + dataLength) 13 | { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Code/io/writers/XdrMemWriter.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_WRITERS_XDRMEMWRITER_H 7 | #define HEMELB_IO_WRITERS_XDRMEMWRITER_H 8 | 9 | #include "io/writers/XdrWriter.h" 10 | 11 | namespace hemelb::io 12 | { 13 | // Simple wrapper to allow construction from pointer-length 14 | // arguments. 15 | class XdrMemWriter : public XdrMetaWriter { 16 | public: 17 | XdrMemWriter(char* dataBuffer, unsigned int dataLength); 18 | }; 19 | } 20 | #endif // HEMELB_IO_WRITERS_XDRMEMWRITER_H 21 | -------------------------------------------------------------------------------- /Code/io/writers/XdrVectorWriter.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/writers/XdrVectorWriter.h" 7 | 8 | namespace hemelb::io 9 | { 10 | // Use the magic protected constructor. 11 | // First function obj makes a std::vector 12 | // Second one creates a std::back_insert_iterator from it 13 | XdrVectorWriter::XdrVectorWriter() : base([](){ 14 | return char_vec{}; 15 | }, 16 | [](char_vec& v){ 17 | return std::back_inserter(v); 18 | }) 19 | { 20 | } 21 | // Delegate to above then do the reserve 22 | XdrVectorWriter::XdrVectorWriter(size_t n) : XdrVectorWriter() 23 | { 24 | res.reserve(n); 25 | } 26 | 27 | const char_vec& XdrVectorWriter::GetBuf() const 28 | { 29 | return res; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Code/io/writers/XdrVectorWriter.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_WRITERS_XDRVECTORWRITER_H 7 | #define HEMELB_IO_WRITERS_XDRVECTORWRITER_H 8 | 9 | #include 10 | 11 | #include "io/writers/XdrWriter.h" 12 | 13 | namespace hemelb::io 14 | { 15 | using char_vec = std::vector; 16 | using char_vec_appender = std::back_insert_iterator; 17 | 18 | // XDR encoder that will put its buffer in a vector so you 19 | // don't have to worry about managing memory. The encoder owns 20 | // the memory but you can get a reference to the data with 21 | // GetBuf() 22 | class XdrVectorWriter : public XdrMetaWriter 23 | { 24 | using base = XdrMetaWriter; 25 | public: 26 | // Start with no memory reserved 27 | XdrVectorWriter(); 28 | // Reserve n bytes of memory for storage 29 | XdrVectorWriter(size_t n); 30 | 31 | const char_vec& GetBuf() const; 32 | }; 33 | 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Code/io/writers/XdrWriter.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "io/writers/XdrWriter.h" 7 | 8 | namespace hemelb::io 9 | { 10 | 11 | // No field/record separators in XDR files 12 | void XdrWriter::writeFieldSeparator() 13 | { 14 | } 15 | void XdrWriter::writeRecordSeparator() 16 | { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Code/lb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_lb OBJECT 7 | iolets/BoundaryCommunicator.cc iolets/BoundaryComms.cc iolets/BoundaryValues.cc 8 | iolets/InOutLet.cc 9 | iolets/InOutLetCosine.cc iolets/InOutLetFile.cc 10 | iolets/InOutLetMultiscale.cc 11 | iolets/InOutLetVelocity.cc 12 | iolets/InOutLetParabolicVelocity.cc iolets/InOutLetWomersleyVelocity.cc iolets/InOutLetFileVelocity.cc 13 | IncompressibilityChecker.cc 14 | kernels/DHumieresD3Q15MRTBasis.cc kernels/DHumieresD3Q19MRTBasis.cc 15 | kernels/AbstractRheologyModel.cc kernels/CarreauYasudaRheologyModel.cc 16 | kernels/CassonRheologyModel.cc kernels/TruncatedPowerLawRheologyModel.cc 17 | MacroscopicPropertyCache.cc SimulationState.cc StabilityTester.cc 18 | InitialCondition.cc 19 | ) 20 | -------------------------------------------------------------------------------- /Code/lb/Collisions.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_LB_COLLISIONS_H 7 | #define HEMELB_LB_COLLISIONS_H 8 | 9 | #include "lb/collisions/NonZeroVelocityEquilibriumFixedDensity.h" 10 | #include "lb/collisions/Normal.h" 11 | #include "lb/collisions/ZeroVelocityEquilibrium.h" 12 | #include "lb/collisions/ZeroVelocityEquilibriumFixedDensity.h" 13 | 14 | #endif /* HEMELB_LB_COLLISIONS_H */ 15 | -------------------------------------------------------------------------------- /Code/lb/IncompressibilityChecker.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/lattices/D3Q15.h" 7 | #include "lb/IncompressibilityChecker.hpp" 8 | 9 | namespace hemelb 10 | { 11 | namespace lb 12 | { 13 | // Explicit instantiation 14 | template class IncompressibilityChecker > ; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Code/lb/StabilityTester.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/StabilityTester.h" 7 | #include "lb/LbmParameters.h" 8 | 9 | namespace hemelb 10 | { 11 | namespace lb 12 | { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Code/lb/iolets/BoundaryCommunicator.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/iolets/BoundaryCommunicator.h" 7 | 8 | namespace hemelb::lb 9 | { 10 | 11 | BoundaryCommunicator::BoundaryCommunicator(const net::MpiCommunicator& parent) : 12 | MpiCommunicator(parent.Duplicate()) 13 | { 14 | 15 | } 16 | bool BoundaryCommunicator::IsCurrentProcTheBCProc() const 17 | { 18 | return Rank() == GetBCProcRank(); 19 | } 20 | int BoundaryCommunicator::GetBCProcRank() const 21 | { 22 | return 0; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Code/lb/iolets/BoundaryCommunicator.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_LB_IOLETS_BOUNDARYCOMMUNICATOR_H 7 | #define HEMELB_LB_IOLETS_BOUNDARYCOMMUNICATOR_H 8 | 9 | #include "net/MpiCommunicator.h" 10 | 11 | namespace hemelb::lb 12 | { 13 | class BoundaryCommunicator : public net::MpiCommunicator 14 | { 15 | public: 16 | BoundaryCommunicator(const net::MpiCommunicator& parent); 17 | bool IsCurrentProcTheBCProc() const; 18 | int GetBCProcRank() const; 19 | }; 20 | } 21 | 22 | #endif // HEMELB_LB_IOLETS_BOUNDARYCOMMUNICATOR_H 23 | -------------------------------------------------------------------------------- /Code/lb/iolets/InOutLetVelocity.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | #include "lb/iolets/InOutLetVelocity.h" 6 | #include "configuration/SimConfig.h" 7 | 8 | namespace hemelb::lb 9 | { 10 | InOutLetVelocity::InOutLetVelocity() : 11 | radius(0.) 12 | { 13 | } 14 | 15 | LatticeDensity InOutLetVelocity::GetDensityMin() const 16 | { 17 | return 1.0; 18 | } 19 | LatticeDensity InOutLetVelocity::GetDensityMax() const 20 | { 21 | return 1.0; 22 | } 23 | LatticeDensity InOutLetVelocity::GetDensity(LatticeTimeStep time_step) const 24 | { 25 | return 1.0; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/lb/iolets/InOutLets.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_LB_IOLETS_INOUTLETS_H 7 | #define HEMELB_LB_IOLETS_INOUTLETS_H 8 | 9 | #include "lb/iolets/InOutLet.h" 10 | #include "lb/iolets/InOutLetCosine.h" 11 | #include "lb/iolets/InOutLetFile.h" 12 | #include "lb/iolets/InOutLetMultiscale.h" 13 | #include "lb/iolets/InOutLetParabolicVelocity.h" 14 | #include "lb/iolets/InOutLetWomersleyVelocity.h" 15 | #include "lb/iolets/InOutLetFileVelocity.h" 16 | 17 | #endif /* HEMELB_LB_IOLETS_INOUTLETS_H */ 18 | -------------------------------------------------------------------------------- /Code/lb/kernels/CarreauYasudaRheologyModel.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/kernels/CarreauYasudaRheologyModel.h" 7 | #include 8 | 9 | namespace hemelb::lb 10 | { 11 | 12 | template 13 | double CarreauYasudaRheologyModel::CalculateViscosityForShearRate( 14 | const double &iShearRate, const distribn_t &iDensity) const 15 | { 16 | constexpr double exponent = (CYFIT.N - 1.0) / CYFIT.A; 17 | double eta = CYFIT.ETA_INF 18 | + (CYFIT.ETA_ZERO - CYFIT.ETA_INF) 19 | * pow( (1.0 + pow(CYFIT.LAMBDA * iShearRate, CYFIT.A)), 20 | exponent); 21 | return eta; 22 | } 23 | 24 | template class CarreauYasudaRheologyModel; 25 | template class CarreauYasudaRheologyModel; 26 | } 27 | -------------------------------------------------------------------------------- /Code/lb/kernels/CassonRheologyModel.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/kernels/CassonRheologyModel.h" 7 | #include "util/utilityFunctions.h" 8 | #include 9 | 10 | namespace hemelb::lb 11 | { 12 | double CassonRheologyModel::CalculateViscosityForShearRate(const double &iShearRate, 13 | const distribn_t &iDensity) const 14 | { 15 | double k0_k1_gamma = K0 + K1 * std::sqrt(iShearRate); 16 | double eta = (k0_k1_gamma * k0_k1_gamma) / iShearRate; 17 | 18 | // In the Casson rheology model, viscosity tends to infinity as shear rate goes to zero. Bound it. 19 | return util::NumericalFunctions::min(eta, CASSON_MAX_VISCOSITY); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Code/lb/kernels/DHumieresD3Q15MRTBasis.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/kernels/DHumieresD3Q15MRTBasis.h" 7 | 8 | namespace hemelb::lb 9 | { 10 | auto DHumieresD3Q15MRTBasis::SetUpCollisionMatrix(distribn_t tau) -> std::array 11 | { 12 | // Relaxation values taken from d'Humieres 2002, except for the kinematic viscosity where the usual tau formula is used. 13 | return { 14 | 1.6, // e (s1) 15 | 1.2, // epsilon (s2) 16 | 1.6, // q_x (s4) 17 | 1.6, // q_y (s4) 18 | 1.6, // q_z (s4) 19 | 1.0 / tau, // 3p_xx (s9) 20 | 1.0 / tau, // p_ww (s9) 21 | 1.0 / tau, // p_xy (s11 = s9) 22 | 1.0 / tau, // p_yz (s11 = s9) 23 | 1.0 / tau, // p_zx (s11 = s9) 24 | 1.2 // m_xyz (s14) 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/lb/kernels/MomentBases.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_LB_KERNELS_MOMENTBASES_H 7 | #define HEMELB_LB_KERNELS_MOMENTBASES_H 8 | 9 | #include "lb/kernels/DHumieresD3Q15MRTBasis.h" 10 | #include "lb/kernels/DHumieresD3Q19MRTBasis.h" 11 | 12 | #endif /* HEMELB_LB_KERNELS_MOMENTBASES_H */ 13 | -------------------------------------------------------------------------------- /Code/lb/kernels/RheologyModels.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_LB_KERNELS_RHEOLOGYMODELS_H 7 | #define HEMELB_LB_KERNELS_RHEOLOGYMODELS_H 8 | 9 | #include "lb/kernels/CarreauYasudaRheologyModel.h" 10 | #include "lb/kernels/CassonRheologyModel.h" 11 | #include "lb/kernels/TruncatedPowerLawRheologyModel.h" 12 | 13 | #endif /* HEMELB_LB_KERNELS_RHEOLOGYMODELS_H */ 14 | -------------------------------------------------------------------------------- /Code/lb/kernels/TruncatedPowerLawRheologyModel.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "lb/kernels/TruncatedPowerLawRheologyModel.h" 7 | #include "lb/LbmParameters.h" 8 | #include "util/utilityFunctions.h" 9 | 10 | namespace hemelb::lb 11 | { 12 | TruncatedPowerLawRheologyModel::TruncatedPowerLawRheologyModel(InitParams& initParams) : M_CONSTANT(initParams.lbmParams->GetEta()) { 13 | } 14 | double TruncatedPowerLawRheologyModel::CalculateViscosityForShearRate( 15 | const double &iShearRate, const distribn_t &iDensity) const 16 | { 17 | // Don't allow shear rates outside [GAMMA_ZERO, GAMMA_INF] 18 | double gamma = util::NumericalFunctions::enforceBounds(iShearRate, GAMMA_ZERO, GAMMA_INF); 19 | return M_CONSTANT * pow(gamma, N_CONSTANT - 1); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Code/lb/kernels/basis_helpers.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_LB_KERNELS_BASIS_HELPERS_H 7 | #define HEMELB_LB_KERNELS_BASIS_HELPERS_H 8 | 9 | #include 10 | #include 11 | 12 | namespace hemelb::lb { 13 | 14 | template 15 | struct moment_traits { 16 | using MatrixType = std::array, NUM_MOMS>; 17 | 18 | static constexpr auto DiagSelfProduct(MatrixType const &mat) { 19 | std::array ans; 20 | for (unsigned i = 0; i < NUM_MOMS; ++i) { 21 | auto &row = mat[i]; 22 | ans[i] = std::inner_product(row.begin(), row.end(), row.begin(), T{0}); 23 | } 24 | return ans; 25 | } 26 | }; 27 | 28 | } 29 | #endif -------------------------------------------------------------------------------- /Code/lb/lattices/D3Q15i.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | #ifndef HEMELB_LB_LATTICES_D3Q15I_H 6 | #define HEMELB_LB_LATTICES_D3Q15I_H 7 | 8 | #include "lb/lattices/Lattice.h" 9 | #include "lb/lattices/D3Q15.h" 10 | 11 | namespace hemelb::lb { 12 | // Use inheritance rather than an alias to get a nicer name when compiling/debugging. 13 | struct D3Q15i : Lattice< 14 | 15, 15 | D3Q15::VECTORS, 16 | D3Q15::EQMWEIGHTS, 17 | false 18 | > {}; 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /Code/log/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | configure_file("Logger.in.cc" "${CMAKE_CURRENT_BINARY_DIR}/Logger.cc") 7 | add_library(hemelb_log OBJECT 8 | ${CMAKE_CURRENT_BINARY_DIR}/Logger.cc ${logger}) 9 | 10 | if(HAVE_RUSAGE) 11 | target_compile_definitions(hemelb_log PRIVATE HAVE_RUSAGE) 12 | endif() 13 | -------------------------------------------------------------------------------- /Code/multiscale/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | find_hemelb_dependency(MPWide REQUIRED) 7 | 8 | add_library(hemelb_multiscale OBJECT 9 | mpwide/MPWideIntercommunicator.cc 10 | ) 11 | target_link_libraries(hemelb_multiscale PUBLIC MPWide::MPWide) 12 | -------------------------------------------------------------------------------- /Code/net/BuildInfo.h.in: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_BUILDINFO_H_IN 7 | #define HEMELB_NET_BUILDINFO_H_IN 8 | namespace hemelb 9 | { 10 | namespace net 11 | { 12 | typedef @HEMELB_POINTPOINT_IMPLEMENTATION@PointPoint PointPointImpl ; 13 | typedef @HEMELB_GATHERS_IMPLEMENTATION@Gathers GathersImpl ; 14 | typedef @HEMELB_ALLTOALL_IMPLEMENTATION@AllToAll AllToAllImpl ; 15 | #cmakedefine HEMELB_SEPARATE_CONCERNS 16 | #ifdef HEMELB_SEPARATE_CONCERNS 17 | static const bool separate_communications = true; 18 | #else 19 | static const bool separate_communications = false; 20 | #endif 21 | } 22 | } 23 | #endif // HEMELB_NET_BUILDINFO_H_IN -------------------------------------------------------------------------------- /Code/net/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_net OBJECT 7 | MpiEnvironment.cc MpiError.cc 8 | MpiCommunicator.cc MpiGroup.cc MpiFile.cc 9 | IteratedAction.cc BaseNet.cc 10 | IOCommunicator.cc 11 | mixins/pointpoint/CoalescePointPoint.cc 12 | mixins/pointpoint/SeparatedPointPoint.cc 13 | mixins/pointpoint/ImmediatePointPoint.cc 14 | mixins/gathers/SeparatedGathers.cc 15 | mixins/gathers/ViaPointPointGathers.cc 16 | mixins/alltoall/SeparatedAllToAll.cc 17 | mixins/alltoall/ViaPointPointAllToAll.cc 18 | mixins/StoringNet.cc 19 | phased/StepManager.cc) 20 | configure_file ( 21 | "${PROJECT_SOURCE_DIR}/net/BuildInfo.h.in" 22 | "${PROJECT_BINARY_DIR}/net/BuildInfo.h" 23 | ) 24 | -------------------------------------------------------------------------------- /Code/net/IOCommunicator.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "net/IOCommunicator.h" 7 | #include "net/mpi.h" 8 | 9 | namespace hemelb::net 10 | { 11 | IOCommunicator::IOCommunicator(const MpiCommunicator& comm) : 12 | MpiCommunicator(comm), 13 | nodeComm(comm.SplitType()), 14 | amNodeLeader(nodeComm.Rank() == IO_RANK), 15 | leadersComm(comm.Split(amNodeLeader)) 16 | { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Code/net/IteratedAction.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_ITERATEDACTION_H 7 | #define HEMELB_NET_ITERATEDACTION_H 8 | #include "net/phased/Concern.h" 9 | namespace hemelb 10 | { 11 | namespace net 12 | { 13 | class IteratedAction : public phased::Concern 14 | { 15 | public: 16 | /*** 17 | * When an iterated actor is called through the phased::StepManager mechanism, 18 | * this method dispatches to the individual step methods 19 | * @param action Enumeration indicating the step 20 | * @return True if an action was successfully called for the step 21 | */ 22 | bool CallAction(int action); 23 | virtual ~IteratedAction(); 24 | virtual void RequestComms(); 25 | virtual void PreSend(); 26 | virtual void PreReceive(); 27 | virtual void PostReceive(); 28 | virtual void EndIteration(); 29 | }; 30 | } 31 | } 32 | 33 | #endif /* HEMELB_NET_ITERATEDACTION_H */ 34 | -------------------------------------------------------------------------------- /Code/net/MpiError.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "net/MpiError.h" 7 | #include "debug/Debugger.h" 8 | #include 9 | 10 | namespace hemelb::net 11 | { 12 | MpiError::MpiError(const char* mpiFunc_, const int errorCode_, const char* fileName_, 13 | const int lineNo_) : 14 | mpiFunc(mpiFunc_), errorCode(errorCode_), fileName(fileName_), lineNo(lineNo_) 15 | { 16 | // Construct the first bit of error message 17 | *this << fileName << ":" << lineNo << ": " << mpiFunc << ": "; 18 | 19 | // Query the MPI implementation for its reason for failure 20 | char buffer[MPI_MAX_ERROR_STRING]; 21 | int len; 22 | MPI_Error_string(errorCode, buffer, &len); 23 | // If the debugger is active, probably want to break here 24 | debug::Debugger::Get()->BreakHere(); 25 | 26 | *this << buffer; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Code/net/mixins/alltoall/SeparatedAllToAll.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "net/mixins/alltoall/SeparatedAllToAll.h" 7 | #include "hassert.h" 8 | 9 | namespace hemelb::net 10 | { 11 | SeparatedAllToAll::SeparatedAllToAll(const MpiCommunicator& comms) : 12 | BaseNet(comms), StoringNet(comms) 13 | { 14 | } 15 | 16 | void SeparatedAllToAll::WaitAllToAll() 17 | { 18 | HASSERT(allToAllReceiveProcComms.size() == allToAllSendProcComms.size()); 19 | for (unsigned int i = 0; i < allToAllReceiveProcComms.size(); i++) 20 | { 21 | auto& sendreq = allToAllSendProcComms[i]; 22 | auto& receivereq = allToAllReceiveProcComms[i]; 23 | HEMELB_MPI_CALL(MPI_Alltoall, 24 | (sendreq.Pointer, sendreq.Count, sendreq.Type, receivereq.Pointer, receivereq.Count, receivereq.Type, communicator)); 25 | } 26 | 27 | allToAllReceiveProcComms.clear(); 28 | allToAllSendProcComms.clear(); 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /Code/net/mixins/alltoall/SeparatedAllToAll.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_MIXINS_ALLTOALL_SEPARATEDALLTOALL_H 7 | #define HEMELB_NET_MIXINS_ALLTOALL_SEPARATEDALLTOALL_H 8 | 9 | #include "net/mixins/StoringNet.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace net 14 | { 15 | 16 | class SeparatedAllToAll : public virtual StoringNet 17 | { 18 | public: 19 | SeparatedAllToAll(const MpiCommunicator& comms); 20 | private: 21 | void ReceiveAllToAll() 22 | { 23 | } 24 | void SendAllToAll() 25 | { 26 | } 27 | void WaitAllToAll(); 28 | }; 29 | } 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /Code/net/mixins/alltoall/ViaPointPointAllToAll.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_MIXINS_ALLTOALL_VIAPOINTPOINTALLTOALL_H 7 | #define HEMELB_NET_MIXINS_ALLTOALL_VIAPOINTPOINTALLTOALL_H 8 | 9 | #include "net/mixins/StoringNet.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace net 14 | { 15 | 16 | class ViaPointPointAllToAll : public virtual StoringNet 17 | { 18 | public: 19 | ViaPointPointAllToAll(const MpiCommunicator& comms); 20 | private: 21 | void ReceiveAllToAll(); 22 | void SendAllToAll(); 23 | void WaitAllToAll() 24 | { 25 | } 26 | }; 27 | } 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /Code/net/mixins/gathers/SeparatedGathers.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_MIXINS_GATHERS_SEPARATEDGATHERS_H 7 | #define HEMELB_NET_MIXINS_GATHERS_SEPARATEDGATHERS_H 8 | 9 | #include "net/mixins/StoringNet.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace net 14 | { 15 | 16 | class SeparatedGathers : public virtual StoringNet 17 | { 18 | public: 19 | SeparatedGathers(const MpiCommunicator& comms); 20 | private: 21 | void ReceiveGathers() 22 | { 23 | } 24 | void SendGathers() 25 | { 26 | } 27 | void ReceiveGatherVs() 28 | { 29 | } 30 | void SendGatherVs() 31 | { 32 | } 33 | void WaitGathers(); 34 | void WaitGatherVs(); 35 | }; 36 | 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /Code/net/mixins/gathers/ViaPointPointGathers.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_MIXINS_GATHERS_VIAPOINTPOINTGATHERS_H 7 | #define HEMELB_NET_MIXINS_GATHERS_VIAPOINTPOINTGATHERS_H 8 | 9 | #include "net/mixins/StoringNet.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace net 14 | { 15 | /*** 16 | * Reimplement gathers via point-point calls 17 | * This code is not robust for working with gathers of complex defined datatypes. 18 | * It is intended for testing and performance measurement use, and should not be used in production. 19 | */ 20 | class ViaPointPointGathers : public virtual StoringNet 21 | { 22 | public: 23 | ViaPointPointGathers(const MpiCommunicator& comms); 24 | private: 25 | void ReceiveGathers(); 26 | void SendGathers(); 27 | void ReceiveGatherVs(); 28 | void SendGatherVs(); 29 | void WaitGathers() 30 | { 31 | } 32 | void WaitGatherVs() 33 | { 34 | } 35 | }; 36 | } 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /Code/net/mixins/mixins.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_MIXINS_MIXINS_H 7 | #define HEMELB_NET_MIXINS_MIXINS_H 8 | 9 | #include "net/mixins/pointpoint/CoalescePointPoint.h" 10 | #include "net/mixins/pointpoint/ImmediatePointPoint.h" 11 | #include "net/mixins/pointpoint/SeparatedPointPoint.h" 12 | #include "net/mixins/StoringNet.h" 13 | #include "net/mixins/gathers/SeparatedGathers.h" 14 | #include "net/mixins/InterfaceDelegationNet.h" 15 | #include "net/mixins/gathers/ViaPointPointGathers.h" 16 | #include "net/mixins/alltoall/SeparatedAllToAll.h" 17 | #include "net/mixins/alltoall/ViaPointPointAllToAll.h" 18 | #endif 19 | -------------------------------------------------------------------------------- /Code/net/mpi.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_MPI_H 7 | #define HEMELB_NET_MPI_H 8 | 9 | #include 10 | #include "net/MpiDataType.h" 11 | #include "net/MpiEnvironment.h" 12 | #include "net/MpiCommunicator.h" 13 | #include "net/MpiGroup.h" 14 | #include "net/MpiError.h" 15 | #include "net/MpiFile.h" 16 | 17 | #endif // HEMELB_NET_MPI_H 18 | -------------------------------------------------------------------------------- /Code/net/net.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_NET_H 7 | #define HEMELB_NET_NET_H 8 | 9 | #include "net/BaseNet.h" 10 | #include "net/mixins/mixins.h" 11 | #include "net/BuildInfo.h" 12 | namespace hemelb 13 | { 14 | namespace net 15 | { 16 | class Net : public PointPointImpl, 17 | public InterfaceDelegationNet, 18 | public AllToAllImpl, 19 | public GathersImpl 20 | { 21 | public: 22 | Net(const MpiCommunicator &communicator) : 23 | BaseNet(communicator), StoringNet(communicator), PointPointImpl(communicator), 24 | InterfaceDelegationNet(communicator), AllToAllImpl(communicator), 25 | GathersImpl(communicator) 26 | { 27 | } 28 | }; 29 | } 30 | } 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /Code/net/phased/Concern.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | -------------------------------------------------------------------------------- /Code/net/phased/Concern.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_PHASED_CONCERN_H 7 | #define HEMELB_NET_PHASED_CONCERN_H 8 | namespace hemelb 9 | { 10 | namespace net 11 | { 12 | namespace phased 13 | { 14 | class Concern 15 | { 16 | public: 17 | Concern() 18 | { 19 | } 20 | virtual ~Concern() 21 | { 22 | } 23 | virtual bool CallAction(int action)=0; 24 | }; 25 | } 26 | } 27 | } 28 | #endif //ONCE 29 | -------------------------------------------------------------------------------- /Code/net/phased/steps.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_NET_PHASED_STEPS_H 7 | #define HEMELB_NET_PHASED_STEPS_H 8 | 9 | namespace hemelb 10 | { 11 | namespace net 12 | { 13 | namespace phased 14 | { 15 | namespace steps 16 | { 17 | enum Step 18 | { 19 | // Order significant here 20 | // BeginPhase must begin and EndPhase must end, those steps which should be called for a given phase. 21 | BeginAll = -1, // Called only before first phase 22 | BeginPhase = 0, 23 | Receive = 1, 24 | PreSend = 2, 25 | Send = 3, 26 | PreWait = 4, 27 | Wait = 5, 28 | EndPhase = 6, 29 | EndAll = 7, // Called only after final phase 30 | }; 31 | } 32 | } 33 | } 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /Code/redblood/Interpolation.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "redblood/Interpolation.h" 7 | #include 8 | 9 | namespace hemelb 10 | { 11 | namespace redblood 12 | { 13 | void IndexIterator::operator++() 14 | { 15 | #ifndef NDEBUG 16 | 17 | if (not IsValid()) 18 | { 19 | throw Exception() << "Cannot increment invalid iterator\n"; 20 | } 21 | 22 | #endif 23 | 24 | if (current[2] < max[2]) 25 | { 26 | ++current[2]; 27 | return; 28 | } 29 | 30 | current[2] = min[2]; 31 | 32 | if (current[1] < max[1]) 33 | { 34 | ++current[1]; 35 | return; 36 | } 37 | 38 | current[1] = min[1]; 39 | ++current[0]; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Code/redblood/MeshIdType.h.in: -------------------------------------------------------------------------------- 1 | // -*- mode: C++; -*- 2 | // This file is part of HemeLB and is Copyright (C) 3 | // the HemeLB team and/or their institutions, as detailed in the 4 | // file AUTHORS. This software is provided under the terms of the 5 | // license in the file LICENSE. 6 | 7 | #ifndef HEMELB_REDBLOOD_MESHIDTYPE_H_IN 8 | #define HEMELB_REDBLOOD_MESHIDTYPE_H_IN 9 | 10 | namespace hemelb 11 | { 12 | namespace redblood 13 | { 14 | // CMake knows what type VTK uses for its IDs 15 | // Use that here without pulling VTK into the entire code. 16 | using IdType = @HEMELB_RBC_IDTYPE@; 17 | } 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Code/redblood/RBCInserter.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "redblood/RBCInserter.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace redblood 11 | { 12 | CellContainer::value_type RBCInserterWithPerturbation::drop() 13 | { 14 | auto const result = RBCInserter::drop(); 15 | 16 | // apply rotation 17 | auto const theta = dtheta * (2e0 * uniformDistribution(randomGenerator) - 1e0); 18 | auto const phi = dphi * (2e0 * uniformDistribution(randomGenerator) - 1e0); 19 | using std::cos; 20 | using std::sin; 21 | LatticePosition const z(cos(theta) * sin(phi), sin(theta) * sin(phi), cos(phi)); 22 | util::Matrix3D const rotation = initialRotation * rotationMatrix(LatticePosition(0, 0, 1), z) 23 | * initialRotation.transpose(); 24 | *result *= rotation; 25 | 26 | // apply translation 27 | *result += dx * uniformDistribution(randomGenerator) + dy * uniformDistribution(randomGenerator); 28 | return result; 29 | } 30 | } 31 | } // hemelb::redblood 32 | -------------------------------------------------------------------------------- /Code/redblood/VTKError.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "redblood/VTKError.h" 7 | #include 8 | 9 | namespace hemelb::redblood { 10 | 11 | vtkStandardNewMacro(ErrThrowOutputWindow); 12 | 13 | ErrThrowOutputWindow::ErrThrowOutputWindow() = default; 14 | 15 | ErrThrowOutputWindow::~ErrThrowOutputWindow() = default; 16 | 17 | void ErrThrowOutputWindow::DisplayErrorText(char const* txt) { 18 | throw Exception() << txt; 19 | } 20 | 21 | VtkErrorsThrow::VtkErrorsThrow() : originalWindow(vtkOutputWindow::GetInstance()) { 22 | vtkOutputWindow::SetInstance(ErrThrowOutputWindow::New()); 23 | } 24 | 25 | VtkErrorsThrow::~VtkErrorsThrow() { 26 | vtkOutputWindow::SetInstance(originalWindow); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Code/redblood/types.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_REDBLOOD_TYPES_H 7 | #define HEMELB_REDBLOOD_TYPES_H 8 | 9 | #include 10 | #include 11 | 12 | #include "redblood/types_fwd.h" 13 | #include "redblood/CellBase.h" 14 | #include "units.h" 15 | 16 | namespace hemelb 17 | { 18 | namespace redblood 19 | { 20 | namespace details 21 | { 22 | //! Stable comparison of cells across nodes 23 | bool CellUUIDComparison::operator()(std::shared_ptr const&a, 24 | std::shared_ptr const &b) const 25 | { 26 | return a->GetTag() < b->GetTag(); 27 | } 28 | } 29 | } 30 | } // namespace hemelb::redblood 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /Code/reporting/BuildInfo.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_REPORTING_BUILDINFO_H 7 | #define HEMELB_REPORTING_BUILDINFO_H 8 | #include "reporting/Reportable.h" 9 | 10 | namespace hemelb::reporting 11 | { 12 | class BuildInfo : public Reportable { 13 | public: 14 | void Report(Dict& dictionary) override; 15 | }; 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /Code/reporting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_reporting OBJECT BuildInfo.cc Reporter.cc Timers.cc Dict.cc) 7 | target_link_libraries(hemelb_reporting PRIVATE CTemplate::CTemplate) 8 | -------------------------------------------------------------------------------- /Code/reporting/Reportable.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_REPORTING_REPORTABLE_H 7 | #define HEMELB_REPORTING_REPORTABLE_H 8 | 9 | #include "reporting/Dict.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace reporting 14 | { 15 | /** 16 | * Defines the interface for classes that can have entries in reports. 17 | */ 18 | class Reportable 19 | { 20 | public: 21 | virtual ~Reportable() noexcept = default; 22 | virtual void Report(Dict& dictionary) = 0; 23 | }; 24 | } 25 | } 26 | 27 | #endif /* HEMELB_REPORTING_REPORTABLE_H */ 28 | -------------------------------------------------------------------------------- /Code/reporting/Timers.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "reporting/Timers.hpp" 7 | namespace hemelb 8 | { 9 | namespace reporting 10 | { 11 | template class TimersBase ; 12 | // explicit instantiate 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Code/reporting/timers_fwd.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_REPORTING_TIMERS_FWD_H 7 | #define HEMELB_REPORTING_TIMERS_FWD_H 8 | 9 | namespace hemelb::reporting { 10 | template 11 | class TimerBase; 12 | template 13 | class TimersBase; 14 | 15 | class MPICommsPolicy; 16 | class HemeLBClockPolicy; 17 | 18 | using Timer = TimerBase; 19 | using Timers = TimersBase; 20 | 21 | } 22 | #endif -------------------------------------------------------------------------------- /Code/resources/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | # Nothing to do here 7 | -------------------------------------------------------------------------------- /Code/resources/path_parameters.h.in: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_RESOURCES_PATH_PARAMETERS_H_IN 7 | #define HEMELB_RESOURCES_PATH_PARAMETERS_H_IN 8 | 9 | #include 10 | 11 | namespace hemelb::resources { 12 | static const std::filesystem::path build_resource_path="@BUILD_RESOURCE_PATH@"; 13 | static const std::filesystem::path install_resource_path="@INSTALL_RESOURCE_PATH@"; 14 | } 15 | #endif // HEMELB_RESOURCES_PATH_PARAMETERS_H_IN 16 | -------------------------------------------------------------------------------- /Code/tests/configuration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_configuration 6 | CommandLineTests.cc 7 | SimConfigTests.cc 8 | ) 9 | -------------------------------------------------------------------------------- /Code/tests/configuration/CommandLineTests.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include 7 | #include 8 | 9 | #include "configuration/CommandLine.h" 10 | #include "resources/Resource.h" 11 | 12 | #include "tests/helpers/FolderTestFixture.h" 13 | 14 | namespace hemelb 15 | { 16 | namespace tests 17 | { 18 | using namespace helpers; 19 | 20 | TEST_CASE_METHOD(helpers::FolderTestFixture, "CommandLine") { 21 | auto configFile = resources::Resource("four_cube.xml").Path(); 22 | const int argc = 3; 23 | const char* argv[] = { 24 | "hemelb", 25 | "-in", 26 | configFile.c_str() 27 | }; 28 | 29 | 30 | SECTION("Construct"){ 31 | auto options = std::make_unique(argc, argv); 32 | REQUIRE(options != nullptr); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/tests/extraction/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_extraction 6 | GeometrySelectorTests.cc 7 | LocalPropertyOutputTests.cc 8 | ) 9 | -------------------------------------------------------------------------------- /Code/tests/geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_geometry 6 | GeometryReaderTests.cc 7 | LatticeDataTests.cc 8 | NeedsTests.cc 9 | LookupTreeTests.cc 10 | ) 11 | add_subdirectory(neighbouring) 12 | target_link_libraries(test_geometry PUBLIC test_neighbouring) 13 | -------------------------------------------------------------------------------- /Code/tests/geometry/neighbouring/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_neighbouring 6 | NeighbouringDataManagerTests.cc 7 | NeighbouringLatticeDataTests.cc 8 | RequiredSiteInformationTests.cc 9 | ) 10 | -------------------------------------------------------------------------------- /Code/tests/helpers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test-helpers 6 | FolderTestFixture.cc 7 | FourCubeBasedTestFixture.cc 8 | FourCubeLatticeData.cc 9 | HasCommsTestFixture.cc 10 | LabelledRequest.cc 11 | LatticeDataAccess.cc 12 | MockNetHelper.cc 13 | OneInOneOutSimConfig.cc 14 | RandomSourceTests.cc 15 | RecordingNet.cc 16 | ) 17 | target_link_libraries(test-helpers PRIVATE TinyXML::TinyXML) 18 | -------------------------------------------------------------------------------- /Code/tests/helpers/EqualitySiteData.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_HELPERS_EQUALITYSITEDATA_H 7 | #define HEMELB_TESTS_HELPERS_EQUALITYSITEDATA_H 8 | 9 | #include "geometry/SiteData.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace geometry { 14 | inline bool operator==(const hemelb::geometry::SiteData& x, const hemelb::geometry::SiteData& y) { 15 | return (x.GetWallIntersectionData() == y.GetWallIntersectionData()) && (x.GetIoletIntersectionData() == y.GetIoletIntersectionData()) && (x.GetSiteType() 16 | == y.GetSiteType()) && (x.GetIoletId() == y.GetIoletId()); 17 | } 18 | } 19 | } 20 | 21 | #endif // ONCE 22 | -------------------------------------------------------------------------------- /Code/tests/helpers/HasCommsTestFixture.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "tests/helpers/HasCommsTestFixture.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace tests 11 | { 12 | namespace helpers 13 | { 14 | 15 | void HasCommsTestFixture::Init(const net::IOCommunicator& inst) 16 | { 17 | hemelbCommunicator = &inst; 18 | } 19 | 20 | const net::IOCommunicator& HasCommsTestFixture::Comms() 21 | { 22 | return *hemelbCommunicator; 23 | } 24 | 25 | const net::IOCommunicator* HasCommsTestFixture::hemelbCommunicator = nullptr; 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Code/tests/helpers/HasCommsTestFixture.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_HELPERS_HASCOMMSTESTFIXTURE_H 7 | #define HEMELB_TESTS_HELPERS_HASCOMMSTESTFIXTURE_H 8 | 9 | #include "net/IOCommunicator.h" 10 | 11 | namespace hemelb 12 | { 13 | namespace tests 14 | { 15 | namespace helpers 16 | { 17 | class HasCommsTestFixture 18 | { 19 | private: 20 | static const net::IOCommunicator* hemelbCommunicator; 21 | public: 22 | static void Init(const net::IOCommunicator& inst); 23 | protected: 24 | static const net::IOCommunicator& Comms(); 25 | }; 26 | } 27 | } 28 | } 29 | #endif // HEMELB_TESTS_HELPERS_HASCOMMSTESTFIXTURE_H 30 | -------------------------------------------------------------------------------- /Code/tests/helpers/LaddFail.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_HELPERS_LADDFAIL_H 7 | #define HEMELB_TESTS_HELPERS_LADDFAIL_H 8 | 9 | #include 10 | 11 | #define HEMELB_TESTS_HELPERS_LADDFAIL_Q(str) #str 12 | #define HEMELB_TESTS_HELPERS_LADDFAIL_QQ(str) HEMELB_TESTS_HELPERS_LADDFAIL_Q(str) 13 | 14 | #define LADD_FAIL() if (std::strcmp(HEMELB_TESTS_HELPERS_LADDFAIL_QQ(HEMELB_INLET_BOUNDARY), "LADDIOLET") == 0 || std::strcmp(HEMELB_TESTS_HELPERS_LADDFAIL_QQ(HEMELB_OUTLET_BOUNDARY), "LADDIOLET") == 0) FAIL("This test has been marked as fatal when HemeLB is built with LADDIOLET. See ticket #605.") 15 | 16 | 17 | #endif // ONCE 18 | -------------------------------------------------------------------------------- /Code/tests/helpers/MockNetHelper.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "tests/helpers/MockNetHelper.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace tests 11 | { 12 | namespace helpers 13 | { 14 | 15 | MockMpiCommunicator::MockMpiCommunicator(int rank_, int size_) : 16 | MpiCommunicator(MpiCommunicator::mock_ctor_tag{}, rank_, size_) 17 | { 18 | } 19 | 20 | void MockNetHelper::setUp(const proc_t core_count, const proc_t current_core) { 21 | communicatorMock = new MockMpiCommunicator(current_core, core_count); 22 | netMock = new net::NetMock(*communicatorMock); 23 | } 24 | MockNetHelper::~MockNetHelper(){ 25 | delete communicatorMock; 26 | delete netMock; 27 | } 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Code/tests/helpers/MockNetHelper.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_HELPERS_MOCKNETHELPER_H 7 | #define HEMELB_TESTS_HELPERS_MOCKNETHELPER_H 8 | 9 | #include "net/MpiCommunicator.h" 10 | 11 | #include "tests/helpers/NetMock.h" 12 | 13 | namespace hemelb 14 | { 15 | namespace tests 16 | { 17 | namespace helpers 18 | { 19 | class MockMpiCommunicator : public net::MpiCommunicator 20 | { 21 | public: 22 | /*** 23 | * Constructor for a dummy communicator 24 | * Can be useful for testing but can't actually be used 25 | * @param rank 26 | * @param size 27 | */ 28 | MockMpiCommunicator(int rank_, int size_); 29 | }; 30 | 31 | class MockNetHelper 32 | { 33 | protected: 34 | net::MpiCommunicator* communicatorMock = nullptr; 35 | net::NetMock* netMock = nullptr; 36 | void setUp(const proc_t core_count, const proc_t current_core); 37 | ~MockNetHelper(); 38 | 39 | }; 40 | 41 | } 42 | } 43 | } 44 | 45 | #endif // HEMELB_TESTS_HELPERS_RANDOMSOURCE_H 46 | -------------------------------------------------------------------------------- /Code/tests/helpers/OneInOneOutSimConfig.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_HELPERS_ONEINONEOUTSIMCONFIG_H 7 | #define HEMELB_TESTS_HELPERS_ONEINONEOUTSIMCONFIG_H 8 | 9 | #include 10 | 11 | #include "io/xml.h" 12 | #include "configuration/SimConfig.h" 13 | #include "configuration/SimBuilder.h" 14 | 15 | namespace hemelb::tests::helpers 16 | { 17 | // TODO: Figure out what this is supposed to be. 18 | class OneInOneOutSimConfig : public configuration::SimConfig 19 | { 20 | public: 21 | OneInOneOutSimConfig(); 22 | protected: 23 | void CheckIoletMatchesCMake(const io::xml::Element& ioletEl, 24 | const std::string& requiredBC) const override; 25 | }; 26 | 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Code/tests/helpers/SimConfBuildHelp.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_HELPERS_SIMCONFBUILDHELP_H 7 | #define HEMELB_TESTS_HELPERS_SIMCONFBUILDHELP_H 8 | 9 | #include 10 | #include "configuration/SimConfig.h" 11 | #include "configuration/SimBuilder.h" 12 | 13 | namespace hemelb::tests { 14 | 15 | class UninitSimConfig : public configuration::SimConfig { 16 | public: 17 | inline explicit UninitSimConfig(const std::string &path) : configuration::SimConfig(path) { 18 | } 19 | }; 20 | 21 | class UninitSimBuilder : public configuration::SimBuilder { 22 | public: 23 | inline UninitSimBuilder(configuration::SimConfig const &conf, std::shared_ptr conv) 24 | : configuration::SimBuilder{conf, false} { 25 | unit_converter = std::move(conv); 26 | } 27 | }; 28 | } 29 | #endif // ONCE 30 | -------------------------------------------------------------------------------- /Code/tests/io/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_io 6 | xdr_test_data.cc 7 | PathManagerTests.cc 8 | XdrWriterTests.cc 9 | XdrReaderTests.cc 10 | xml.cc 11 | ) 12 | -------------------------------------------------------------------------------- /Code/tests/io/xdr_test_data.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_IO_XDR_TEST_DATA_H 7 | #define HEMELB_TESTS_IO_XDR_TEST_DATA_H 8 | #include 9 | 10 | namespace hemelb 11 | { 12 | namespace tests 13 | { 14 | template 15 | struct test_data { 16 | static const std::vector& unpacked(); 17 | static const std::vector& packed(); 18 | }; 19 | } 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /Code/tests/lb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_lb 6 | BroadcastMocks.cc 7 | CollisionTests.cc 8 | IncompressibilityCheckerTests.cc 9 | KernelTests.cc 10 | LatticeTests.cc 11 | RheologyModelTests.cc 12 | StreamerTests.cc 13 | VirtualSiteIoletStreamerTests.cc 14 | GuoForcingTests.cc 15 | ) 16 | add_subdirectory(iolets) 17 | target_link_libraries(test_lb PRIVATE test_iolets) 18 | -------------------------------------------------------------------------------- /Code/tests/lb/iolets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_iolets 6 | BoundaryTests.cc 7 | InOutLetTests.cc 8 | ) 9 | -------------------------------------------------------------------------------- /Code/tests/multiscale/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_multiscale 6 | MockIntercommunicand.cc 7 | MockIntercommunicator.cc 8 | MockIntercommunicatorTests.cc 9 | ) 10 | 11 | if (HEMELB_BUILD_MULTISCALE) 12 | add_subdirectory(mpwide) 13 | endif() 14 | -------------------------------------------------------------------------------- /Code/tests/multiscale/MockIntercommunicand.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "tests/multiscale/MockIntercommunicand.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace tests 11 | { 12 | /*** 13 | * A mock intercommunicand, representing an iolet which has density (a.k.a. pressure) and a velocity. 14 | */ 15 | 16 | MockIntercommunicand::MockIntercommunicand(double pressure, double velocity) : 17 | Intercommunicand(), pressure(this,pressure), velocity(this,velocity) 18 | { 19 | } 20 | MockIntercommunicand::~MockIntercommunicand() 21 | { 22 | } 23 | double MockIntercommunicand::GetPressure(){ 24 | return pressure; 25 | } 26 | double MockIntercommunicand::GetVelocity(){ 27 | return velocity; 28 | } 29 | void MockIntercommunicand::SetPressure(double aPressure){ 30 | pressure.SetPayload(aPressure); 31 | } 32 | void MockIntercommunicand::SetVelocity(double aVelocity){ 33 | velocity.SetPayload(aVelocity); 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Code/tests/multiscale/mpwide/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | if (HEMELB_BUILD_MULTISCALE) 6 | target_sources(hemelb-tests PRIVATE 7 | ${CMAKE_CURRENT_SOURCE_DIR}/MPWideIntercommunicatorTests.cc 8 | ) 9 | target_link_libraries(hemelb-tests PRIVATE hemelb_multiscale) 10 | endif() 11 | -------------------------------------------------------------------------------- /Code/tests/multiscale/mpwide/MPWSettings.cfg: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 127.0.0.1 4 | 6000 5 | 1 6 | 127.0.0.1 7 | 6002 8 | 1 -------------------------------------------------------------------------------- /Code/tests/net/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_net 6 | MpiTests.cc 7 | NeighborCommTests.cc 8 | ) 9 | add_subdirectory(phased) 10 | target_link_libraries(test_net PRIVATE test_phased) 11 | -------------------------------------------------------------------------------- /Code/tests/net/phased/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_phased 6 | ConcernTests.cc 7 | MockConcern.cc 8 | MockIteratedAction.cc 9 | StepManagerTests.cc 10 | ) 11 | -------------------------------------------------------------------------------- /Code/tests/net/phased/MockConcern.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "tests/net/phased/MockConcern.h" 7 | 8 | namespace hemelb 9 | { 10 | namespace tests 11 | { 12 | 13 | MockConcern::MockConcern(const std::string &name) : 14 | calls(), name(name) 15 | { 16 | } 17 | 18 | bool MockConcern::CallAction(int action) 19 | { 20 | // this is where a real concern would switch on the action, and call the appropriate method 21 | calls.push_back(action); 22 | return true; 23 | } 24 | 25 | std::vector const & MockConcern::ActionsCalled() const 26 | { 27 | return calls; 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Code/tests/net/phased/MockConcern.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_NET_PHASED_MOCKCONCERN_H 7 | #define HEMELB_TESTS_NET_PHASED_MOCKCONCERN_H 8 | 9 | #include 10 | #include 11 | 12 | #include "net/phased/Concern.h" 13 | 14 | namespace hemelb 15 | { 16 | namespace tests 17 | { 18 | class MockConcern : public net::phased::Concern 19 | { 20 | public: 21 | MockConcern(const std::string &name); 22 | 23 | bool CallAction(int action); 24 | 25 | std::vector const & ActionsCalled() const; 26 | 27 | private: 28 | std::vector calls; 29 | std::string name; 30 | }; 31 | 32 | } 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /Code/tests/net/phased/MockIteratedAction.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_NET_PHASED_MOCKITERATEDACTION_H 7 | #define HEMELB_TESTS_NET_PHASED_MOCKITERATEDACTION_H 8 | 9 | #include 10 | #include 11 | 12 | #include "net/IteratedAction.h" 13 | 14 | namespace hemelb 15 | { 16 | namespace tests 17 | { 18 | 19 | class MockIteratedAction : public hemelb::net::IteratedAction 20 | { 21 | public: 22 | MockIteratedAction(const std::string & name); 23 | 24 | void PreSend(); 25 | void PreReceive(); 26 | void PostReceive(); 27 | void EndIteration(); 28 | void RequestComms(); 29 | void Reset(); 30 | std::string CallsSoFar(); 31 | 32 | private: 33 | std::string name; 34 | std::stringstream calls; 35 | }; 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Code/tests/pythontests/resources/RunCylinderGenerator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | env PYTHONPATH=../../../../Tools:$PYTHONPATH python -m hemeTools.surfacegenerator.CylinderGenerator 0.75 62 32 poiseuille_flow_test.stl 7 | -------------------------------------------------------------------------------- /Code/tests/pythontests/resources/RunSetupTool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | env PYTHONPATH=../../../../Tools/setuptool/:$PYTHONPATH ../../../../Tools/setuptool/scripts/hemelb-setup-nogui poiseuille_flow_test.pro 7 | cp poiseuille_flow_test_master.xml poiseuille_flow_test.xml 8 | -------------------------------------------------------------------------------- /Code/tests/pythontests/resources/poiseuille_flow_test.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Code/tests/pythontests/resources/poiseuille_flow_test.pro -------------------------------------------------------------------------------- /Code/tests/reporting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_reporting 6 | Mocks.cc 7 | ReporterTests.cc 8 | TimerTests.cc 9 | ) 10 | target_link_libraries(test_reporting PRIVATE CTemplate::CTemplate) 11 | -------------------------------------------------------------------------------- /Code/tests/reporting/Mocks.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_TESTS_REPORTING_MOCKS_H 7 | #define HEMELB_TESTS_REPORTING_MOCKS_H 8 | 9 | #include 10 | #include "units.h" 11 | 12 | namespace hemelb 13 | { 14 | namespace net { 15 | class IOCommunicator; 16 | } 17 | 18 | namespace tests 19 | { 20 | class ClockMock { 21 | public: 22 | ClockMock(); 23 | protected: 24 | double CurrentTime(); 25 | private: 26 | double fakeTime; 27 | }; 28 | 29 | class MPICommsMock { 30 | public: 31 | MPICommsMock(const net::IOCommunicator& ignored); 32 | protected: 33 | int Reduce(double *sendbuf, 34 | double *recvbuf, 35 | int count, 36 | MPI_Datatype datatype, 37 | MPI_Op op, 38 | int root); 39 | proc_t GetProcessorCount(); 40 | private: 41 | unsigned int calls; 42 | }; 43 | } 44 | } 45 | 46 | #endif // HEMELB_TESTS_REPORTING_MOCKS_H 47 | -------------------------------------------------------------------------------- /Code/tests/resources/cyl_l100_r5.gmy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Code/tests/resources/cyl_l100_r5.gmy -------------------------------------------------------------------------------- /Code/tests/resources/empty_for_relative_paths.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Code/tests/resources/empty_for_relative_paths.xml -------------------------------------------------------------------------------- /Code/tests/resources/fedosov1c.gmy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Code/tests/resources/fedosov1c.gmy -------------------------------------------------------------------------------- /Code/tests/resources/four_cube.gmy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Code/tests/resources/four_cube.gmy -------------------------------------------------------------------------------- /Code/tests/resources/iolet.txt: -------------------------------------------------------------------------------- 1 | 0.0 78.0 2 | 1.0 80.0 3 | 2.0 82.0 4 | 3.0 80.0 5 | 4.0 78.0 -------------------------------------------------------------------------------- /Code/tests/resources/large_cylinder.gmy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Code/tests/resources/large_cylinder.gmy -------------------------------------------------------------------------------- /Code/tests/resources/red_blood_cube.txt: -------------------------------------------------------------------------------- 1 | $MeshFormat 2 | 2 0 8 3 | $EndMeshFormat 4 | $Nodes 5 | 8 6 | 1 0 0 0 7 | 2 1 0 0 8 | 3 1 1 0 9 | 4 0 1 0 10 | 5 0 0 1 11 | 6 1 0 1 12 | 7 1 1 1 13 | 8 0 1 1 14 | $EndNodes 15 | $Elements 16 | 12 17 | 1 0 0 0 0 0 1 2 3 18 | 2 0 0 0 0 0 1 3 4 19 | 3 0 0 0 0 0 2 6 7 20 | 4 0 0 0 0 0 2 7 3 21 | 5 0 0 0 0 0 6 5 8 22 | 6 0 0 0 0 0 6 8 7 23 | 7 0 0 0 0 0 5 1 4 24 | 8 0 0 0 0 0 5 4 8 25 | 9 0 0 0 0 0 5 6 2 26 | 10 0 0 0 0 0 5 2 1 27 | 11 0 0 0 0 0 4 3 7 28 | 12 0 0 0 0 0 4 7 8 29 | -------------------------------------------------------------------------------- /Code/tests/resources/velocity_inlet.txt: -------------------------------------------------------------------------------- 1 | 0.0 0.0 2 | 1.0 0.02 3 | 2.0 0.03 4 | 3.0 0.01 5 | 4.0 0.0 -------------------------------------------------------------------------------- /Code/tests/resources/velocity_inlet.txt.weights.txt: -------------------------------------------------------------------------------- 1 | 1 1 1 0.1 2 | 1 2 1 0.3 3 | 1 3 1 0.3 4 | 1 4 1 0.1 5 | 2 1 1 0.3 6 | 2 2 1 1.0 7 | 2 3 1 1.0 8 | 2 4 1 0.3 9 | 3 1 1 0.3 10 | 3 2 1 1.0 11 | 3 3 1 1.0 12 | 3 4 1 0.3 13 | 4 1 1 0.1 14 | 4 2 1 0.3 15 | 4 3 1 0.3 16 | 4 4 1 0.1 17 | -------------------------------------------------------------------------------- /Code/tests/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | add_test_lib(test_util 6 | BesselTests.cc 7 | Matrix3DTests.cc 8 | Vector3DTests.cc 9 | UnitConverterTests.cc 10 | clone_ptr_tests.cc 11 | ) 12 | -------------------------------------------------------------------------------- /Code/util/Bessel.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "util/Bessel.h" 7 | 8 | #include 9 | #include "hassert.h" 10 | 11 | namespace hemelb::util 12 | { 13 | 14 | std::complex BesselJ0ComplexArgument(const std::complex& z, double tolSq) 15 | { 16 | // Zeroth term is 1 17 | std::complex sum(1.0, 0.0); 18 | double fact = 1; 19 | std::complex zSqOver4_pow(1.0, 0.0); 20 | std::complex term(1.0, 0.0); 21 | 22 | unsigned i; 23 | for (i = 1; term.real() * term.real() + term.imag() * term.imag() > tolSq; ++i) 24 | { 25 | fact *= i; 26 | zSqOver4_pow *= -0.25 * z * z; 27 | term = zSqOver4_pow / (fact * fact); 28 | sum += term; 29 | } 30 | 31 | // If this assertion trips, it is likely that the zSqOver4_pow / (fact * fact) has become inf / inf 32 | HASSERT(!std::isnan(real(sum)) && !std::isnan(imag(sum))); 33 | 34 | return sum; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | add_library(hemelb_util OBJECT 7 | UnitConverter.cc utilityFunctions.cc Vector3D.cc Vector3DHemeLb.cc Matrix3D.cc Bessel.cc) 8 | 9 | if(LINUX_SCANDIR) 10 | target_compile_definitions(hemelb_util PRIVATE LINUX_SCANDIR) 11 | endif() 12 | -------------------------------------------------------------------------------- /Code/util/Cache.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_UTIL_CACHE_HPP 7 | #define HEMELB_UTIL_CACHE_HPP 8 | 9 | namespace hemelb 10 | { 11 | namespace util 12 | { 13 | template 14 | Cache::Cache(unsigned long size) : 15 | items(size) 16 | { 17 | 18 | } 19 | 20 | template 21 | const CacheType& Cache::Get(unsigned long index) const 22 | { 23 | return items[index]; 24 | } 25 | 26 | template 27 | void Cache::Put(unsigned long index, const CacheType item) 28 | { 29 | items[index] = item; 30 | } 31 | 32 | template 33 | void Cache::Reserve(unsigned long size) 34 | { 35 | items.resize(size); 36 | } 37 | } 38 | } 39 | 40 | #endif /* HEMELB_UTIL_CACHE_HPP */ 41 | -------------------------------------------------------------------------------- /Code/util/Vector3DHemeLb.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "util/Vector3D.h" 7 | #include "net/mpi.h" 8 | #include "Exception.h" 9 | 10 | namespace hemelb::util 11 | { 12 | namespace 13 | { 14 | void DefaultHandlerFunction(int direction) 15 | { 16 | // TODO need to find a way of handling this case better. 17 | throw Exception() << "Failed while accessing a direction in Vector3D."; 18 | } 19 | } 20 | Vector3DBase::HandlerFunction* Vector3DBase::handler = DefaultHandlerFunction; 21 | } 22 | -------------------------------------------------------------------------------- /Code/util/concepts.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_UTIL_CONCEPTS_H 7 | #define HEMELB_UTIL_CONCEPTS_H 8 | 9 | #include 10 | #include "util/traits.h" 11 | 12 | namespace hemelb::util { 13 | 14 | template 15 | concept optional = is_optional::value; 16 | 17 | template 18 | concept base_of = std::derived_from; 19 | 20 | template 21 | concept pointer_base_of = std::derived_from< 22 | std::decay_t())>, 23 | std::decay_t())> 24 | >; 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Code/util/span.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_UTIL_SPAN_H 7 | #define HEMELB_UTIL_SPAN_H 8 | 9 | #include 10 | #include 11 | 12 | namespace hemelb { 13 | // Helpers to turn vectors into spans 14 | template 15 | std::span to_span(std::vector& v) { 16 | return {v.data(), v.size()}; 17 | } 18 | 19 | template 20 | std::span to_const_span(std::vector const& v) { 21 | return {v.data(), v.size()}; 22 | } 23 | 24 | template 25 | std::span to_span(std::vector const& v) { 26 | return {v.data(), v.size()}; 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Code/util/traits.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_UTIL_TRAITS_H 7 | #define HEMELB_UTIL_TRAITS_H 8 | 9 | #include 10 | #include 11 | 12 | namespace hemelb::util { 13 | 14 | // Type trait for a class being an instantiation of std::optional. 15 | template 16 | struct is_optional : std::false_type {}; 17 | template 18 | struct is_optional> : std::true_type {}; 19 | 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Code/util/utilityFunctions.cc: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "net/mpi.h" 7 | namespace hemelb 8 | { 9 | namespace util 10 | { 11 | // Returns the number of seconds to 6dp elapsed since the Epoch 12 | double myClock() 13 | { 14 | return MPI_Wtime(); 15 | } 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Code/util/utilityStructs.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_UTIL_UTILITYSTRUCTS_H 7 | #define HEMELB_UTIL_UTILITYSTRUCTS_H 8 | 9 | namespace hemelb 10 | { 11 | namespace util 12 | { 13 | 14 | // Allows sorting key-value pairs using the standard library sort 15 | template 16 | struct key_value_pair 17 | { 18 | public: 19 | keyType key; 20 | valueType value; 21 | 22 | bool operator<(const key_value_pair other_key_value_pair) const 23 | { 24 | return key < other_key_value_pair.key; 25 | } 26 | }; 27 | 28 | } 29 | } 30 | 31 | #endif /* HEMELB_UTIL_UTILITYSTRUCTS_H */ 32 | -------------------------------------------------------------------------------- /PiT/.gitignore: -------------------------------------------------------------------------------- 1 | .tox 2 | .cache 3 | .pytest_cache 4 | -------------------------------------------------------------------------------- /PiT/control/logging.cfg: -------------------------------------------------------------------------------- 1 | [loggers] 2 | keys: root,luigi,scheduler,parareal 3 | 4 | [handlers] 5 | keys: stderr,luigi,parareal 6 | 7 | [formatters] 8 | keys: simple 9 | 10 | [logger_root] 11 | level: DEBUG 12 | handlers: stderr 13 | 14 | [logger_luigi] 15 | level: DEBUG 16 | handlers: luigi 17 | qualname: luigi-interface 18 | propagate: 0 19 | 20 | [logger_scheduler] 21 | level: DEBUG 22 | handlers: luigi 23 | qualname: luigi.scheduler 24 | propagate:0 25 | 26 | [logger_parareal] 27 | level: DEBUG 28 | handlers: parareal 29 | qualname: parareal 30 | propagate: 0 31 | 32 | [handler_stderr] 33 | class: StreamHandler 34 | level: DEBUG 35 | args: () 36 | 37 | [handler_luigi] 38 | class: FileHandler 39 | level: DEBUG 40 | args: ('luigi.log', 'w') 41 | formatter: simple 42 | 43 | [handler_parareal] 44 | class: FileHandler 45 | level: DEBUG 46 | args: ('parareal.log', 'w') 47 | formatter: simple 48 | 49 | [formatter_simple] 50 | format:%(asctime)s: %(levelname)s: %(message)s 51 | datefmt: 52 | -------------------------------------------------------------------------------- /PiT/control/luigi.cfg: -------------------------------------------------------------------------------- 1 | [core] 2 | workers: 1 3 | logging_conf_file: logging.cfg 4 | 5 | [parareal] 6 | filename: master.yml 7 | -------------------------------------------------------------------------------- /PiT/control/master.yml: -------------------------------------------------------------------------------- 1 | num_time_slices: 4 2 | num_parareal_iters: 2 3 | 4 | sim_params: 5 | b: 0.1 6 | omega: 1.0 7 | 8 | initial_conditions: 9 | x: 1.0 10 | v: 0.0 11 | 12 | time: 13 | start: 0.0 14 | dt: 2.0 * pi/1000 15 | n: 1000 16 | -------------------------------------------------------------------------------- /PiT/parareal/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /PiT/parareal/iohelp.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | import yaml 6 | 7 | class LoadableMixin: 8 | '''Define a class method from_dict and this will add loading from 9 | streams and files. 10 | ''' 11 | 12 | @classmethod 13 | def from_file(cls, fn): 14 | with open(fn) as f: 15 | return cls.from_stream(f) 16 | 17 | @classmethod 18 | def from_stream(cls, stream): 19 | state = yaml.load(stream) 20 | return cls.from_dict(state) 21 | 22 | pass 23 | 24 | class DumpableMixin: 25 | '''Define a method to_dict and this will add writing to streams and 26 | files. 27 | ''' 28 | def to_file(self, fn): 29 | with open(fn, 'w') as f: 30 | self.to_stream(f) 31 | 32 | def to_stream(self, stream): 33 | state = self.to_dict() 34 | yaml.dump(state, stream) 35 | 36 | pass 37 | 38 | __all__ = ['LoadableMixin', 'DumpableMixin'] 39 | -------------------------------------------------------------------------------- /PiT/requirements.txt: -------------------------------------------------------------------------------- 1 | luigi 2 | numpy 3 | scipy 4 | pyyaml 5 | -------------------------------------------------------------------------------- /PiT/tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py27,py36 3 | 4 | [testenv] 5 | deps = 6 | -rrequirements.txt 7 | pytest 8 | commands = py.test 9 | 10 | [testenv:py27] 11 | deps = 12 | {[testenv]deps} 13 | enum34 14 | -------------------------------------------------------------------------------- /Scripts/SimpleGeometryGenerationScripts/README.txt: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | Run ./four_cube.py to generate the file four_cube.gmy 7 | 8 | More details about the geometry in four_cube.py 9 | -------------------------------------------------------------------------------- /Scripts/SimpleGeometryGenerationScripts/block.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from Site import Site 7 | 8 | class Block(object): 9 | def __init__(self, sites): 10 | self.sites = sites 11 | 12 | def get_number_of_fluid_sites(self): 13 | n = 0 14 | for site in self.sites: 15 | if site.site_type == Site.fluid_site: 16 | n += 1 17 | return n 18 | 19 | -------------------------------------------------------------------------------- /Scripts/SimpleGeometryGenerationScripts/link.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | class Link(object): 7 | 8 | # Type of boundary crossed by a link 9 | no_boundary, wall, inlet, outlet = range(4) 10 | 11 | def __init__(self, link_type, wall_distance=0, iolet_index=0): 12 | self.link_type = link_type 13 | 14 | # Distance to the boundary, as a fraction of the lattice vector 15 | self.wall_distance = wall_distance 16 | 17 | # Inlet/outlet index 18 | self.iolet_index = iolet_index 19 | -------------------------------------------------------------------------------- /Scripts/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemelb-codes/hemelb/432d3386e32571487a1521f88a407db5dc9ca171/Scripts/logo.png -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure("2") do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | config.vm.define "gmy" do |gmy| 14 | gmy.vm.box = "ubuntu/focal64" 15 | 16 | # Provider-specific configuration 17 | gmy.vm.provider "virtualbox" do |vb| 18 | # Display the VirtualBox GUI when booting the machine 19 | vb.gui = true 20 | # Make sure the graphics aren't tiny 21 | vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"] 22 | # Moar RAM and GPU 23 | vb.memory = "4096" 24 | vb.cpus = 4 25 | end 26 | 27 | # Install things 28 | gmy.vm.provision "shell", path: "geometry-tool/.vagrant-provision-ubuntu-20.04.sh" 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /dependencies/Boost/build.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_file(BOOST_TARBALL boost_1_77_0.tar.gz 8 | DOC "Path to download BOOST (can be url http://)" 9 | PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions 10 | ) 11 | if(NOT BOOST_TARBALL) 12 | message("No boost source found, will download.") 13 | set(BOOST_TARBALL https://archives.boost.io/release/1.77.0/source/boost_1_77_0.tar.gz 14 | CACHE STRING "Path to download BOOST (can be local file://)" FORCE) 15 | endif() 16 | ExternalProject_Add( 17 | dep_Boost 18 | INSTALL_DIR ${HEMELB_DEPENDENCIES_INSTALL_PREFIX} 19 | URL ${BOOST_TARBALL} 20 | BUILD_COMMAND "" 21 | INSTALL_COMMAND cp -r /boost /include 22 | CONFIGURE_COMMAND "" 23 | BUILD_IN_SOURCE 1 24 | ) 25 | -------------------------------------------------------------------------------- /dependencies/Boost/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_package(Boost 1.77 ${DEPS_FIND_MODE_Boost}) 8 | -------------------------------------------------------------------------------- /dependencies/CTemplate/ctemplate_align.diff: -------------------------------------------------------------------------------- 1 | diff -r 3d87a62c5939 src/base/manual_constructor.h 2 | --- a/src/base/manual_constructor.h Wed May 09 11:41:21 2012 +0100 3 | +++ b/src/base/manual_constructor.h Wed May 09 12:50:26 2012 +0100 4 | @@ -68,7 +68,7 @@ 5 | #define UTIL_GTL_ALIGN_ATTRIBUTE(X) __declspec(align(X)) 6 | #define UTIL_GTL_ALIGN_OF(T) __alignof(T) 7 | #elif defined(__GNUC__) || defined(__APPLE__) || defined(__INTEL_COMPILER) \ 8 | - || defined(__nacl__) 9 | + || defined(__nacl__) || true 10 | #define UTIL_GTL_ALIGN_ATTRIBUTE(X) __attribute__((aligned(X))) 11 | #define UTIL_GTL_ALIGN_OF(T) __alignof__(T) 12 | #endif 13 | -------------------------------------------------------------------------------- /dependencies/CTemplate/ctemplate_vacopy.diff: -------------------------------------------------------------------------------- 1 | diff -r 3d87a62c5939 src/template_dictionary.cc 2 | --- a/src/template_dictionary.cc Wed May 09 11:41:21 2012 +0100 3 | +++ b/src/template_dictionary.cc Wed May 09 12:50:11 2012 +0100 4 | @@ -44,7 +44,7 @@ 5 | #include 6 | #include // for pair<> 7 | #include 8 | - 9 | +#define va_copy(to, from) ((void)((to) = (from))) 10 | #include "base/arena-inl.h" 11 | #include "base/thread_annotations.h" 12 | #include "indented_writer.h" 13 | -------------------------------------------------------------------------------- /dependencies/CTemplate/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | find_package(CTemplate ${DEPS_FIND_MODE_CTemplate}) 7 | -------------------------------------------------------------------------------- /dependencies/CTemplate/use.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | hemelb_dependency(ctemplate find) 8 | 9 | macro(hemelb_add_target_dependency_ctemplate tgt) 10 | target_link_libraries(${tgt} PRIVATE CTemplate::CTemplate) 11 | endmacro() 12 | -------------------------------------------------------------------------------- /dependencies/Catch2/build.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_file(CATCH2_TARBALL v2.13.9.tar.gz 8 | DOC "Path to download Catch2 (can be url http://)" 9 | PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions 10 | ) 11 | if(NOT CATCH2_TARBALL) 12 | message("No Catch2 source found, will download.") 13 | set(CATCH2_TARBALL https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.9.tar.gz 14 | CACHE STRING "Path to download Catch2 (can be local file://)" FORCE) 15 | endif() 16 | ExternalProject_Add( 17 | dep_Catch2 18 | URL ${CATCH2_TARBALL} 19 | CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${HEMELB_DEPENDENCIES_INSTALL_PREFIX} -DBUILD_TESTING=OFF 20 | PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/mac-conditionals-gcc.diff 21 | ) 22 | -------------------------------------------------------------------------------- /dependencies/Catch2/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | find_package(Catch2 ${DEPS_FIND_MODE_Catch2} CONFIG) 7 | -------------------------------------------------------------------------------- /dependencies/Catch2/mac-conditionals-gcc.diff: -------------------------------------------------------------------------------- 1 | --- a/single_include/catch2/catch.hpp 2022-04-12 21:38:17 2 | +++ b/single_include/catch2/catch.hpp 2024-05-03 12:54:23 3 | @@ -69,6 +69,11 @@ 4 | // See e.g.: 5 | // https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html 6 | #ifdef __APPLE__ 7 | +# ifndef __clang__ 8 | +# if !__has_builtin(__has_extension) 9 | +# define __has_extension(x) 0 10 | +# endif 11 | +# endif 12 | # include 13 | # if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ 14 | (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) 15 | -------------------------------------------------------------------------------- /dependencies/HDF5/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | cmake_policy(SET CMP0074 NEW) 7 | 8 | set(HDF5_PREFER_PARALLEL TRUE) 9 | find_package(HDF5 1.8 ${DEPS_FIND_MODE_HDF5} COMPONENTS C HL) 10 | 11 | if(HDF5_FOUND AND NOT HDF5_IS_PARALLEL) 12 | string(FIND "${DEPS_FIND_MODE_HDF5}" REQUIRED req_ind) 13 | if(req_ind GREATER -1) 14 | set(mtype FATAL_ERROR) 15 | else() 16 | set(mtype WARNING) 17 | endif() 18 | message(${mtype} "HDF5 found but not parallel") 19 | set(HDF5_FOUND 0) 20 | endif() 21 | -------------------------------------------------------------------------------- /dependencies/MPWide/build.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_file(MPWIDE_TARBALL v1.1.tar.gz 8 | DOC "Path to download MPWide (can be url http://)" 9 | PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions 10 | ) 11 | if(NOT MPWIDE_TARBALL) 12 | message("No MPWide source found, will download.") 13 | set(MPWIDE_TARBALL https://github.com/djgroen/MPWide/archive/v1.1.tar.gz 14 | CACHE STRING "Path to download MPWide (can be local file://)" FORCE) 15 | endif() 16 | ExternalProject_Add( 17 | dep_MPWide 18 | URL ${MPWIDE_TARBALL} 19 | BUILD_IN_SOURCE 1 20 | CONFIGURE_COMMAND echo "No configure step for MPWIDE" 21 | BUILD_COMMAND make -j${HEMELB_SUBPROJECT_MAKE_JOBS} 22 | INSTALL_COMMAND cp /libMPW.a ${HEMELB_DEPENDENCIES_INSTALL_PREFIX}/lib && cp /MPWide.h ${HEMELB_DEPENDENCIES_INSTALL_PREFIX}/include 23 | ) 24 | -------------------------------------------------------------------------------- /dependencies/MPWide/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_package(MPWide $ENV{DEPS_FIND_MODE_MPWide}) 8 | -------------------------------------------------------------------------------- /dependencies/ParMETIS/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_package(ParMETIS ${DEPS_FIND_MODE_ParMETIS}) 8 | -------------------------------------------------------------------------------- /dependencies/README.md: -------------------------------------------------------------------------------- 1 | # HemeLB dependency builder 2 | 3 | This CMake project automates installing most of the main application's dependencies. 4 | 5 | For each dependency, there is a folder with the same name (case sensitive as the CMake package). 6 | 7 | In the folder there are two required files: `find.cmake` and `build.cmake`, which do what you might expect. 8 | 9 | The for a package called `Foo`, the find file should call `find_package(Foo ${DEP_FIND_MODE_Foo})` where `DEP_FIND_MODE_Foo` is filled in to zero or more of `QUIET` and `REQUIRED` by the calling code. You can add version and component specifiers in the usual way, see the [CMake docs for find_package](https://cmake.org/cmake/help/latest/command/find_package.html). 10 | 11 | For the same package, the build file should call `ExternalProject_add` with a target name of `dep_Foo` and whatever options needed. The source tarball should searched for in `dependendencies/distributions/` first before downloading to allow this to work on machines that don't allow outgoing connections. 12 | -------------------------------------------------------------------------------- /dependencies/TinyXML/build.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_file(TINYXML_TARBALL tinyxml_2_6_2.tar.gz 8 | DOC "Path to download TinyXML (can be url http://)" 9 | PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions 10 | ) 11 | if(NOT TINYXML_TARBALL) 12 | message("No TinyXML source found, will download.") 13 | set(TINYXML_TARBALL http://sourceforge.net/projects/tinyxml/files/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz 14 | CACHE STRING "Path to download TinyXML (can be local file://)" FORCE) 15 | endif() 16 | ExternalProject_Add( 17 | dep_TinyXML 18 | INSTALL_DIR ${HEMELB_DEPENDENCIES_INSTALL_PREFIX} 19 | URL ${TINYXML_TARBALL} 20 | CONFIGURE_COMMAND cmake 21 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} 22 | -DCMAKE_INSTALL_PREFIX= 23 | -DTIXML_USE_STL=ON 24 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} 25 | -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} 26 | PATCH_COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/tinyxml.cmake CMakeLists.txt 27 | BUILD_COMMAND make 28 | ) 29 | -------------------------------------------------------------------------------- /dependencies/TinyXML/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_package(TinyXML $ENV{DEPS_FIND_MODE_TinyXML}) 8 | -------------------------------------------------------------------------------- /dependencies/TinyXML/tinyxml.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | cmake_minimum_required(VERSION 3.2) 7 | 8 | project(TinyXml) 9 | 10 | set(CMAKE_CXX_STANDARD 11) 11 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 12 | 13 | OPTION(TIXML_USE_STL "Use STL with TIXML" ON) 14 | if(TIXML_USE_STL) 15 | add_definitions(-DTIXML_USE_STL) 16 | endif(TIXML_USE_STL) 17 | add_library( 18 | tinyxml 19 | tinyxml.cpp 20 | tinystr.cpp 21 | tinyxmlerror.cpp 22 | tinyxmlparser.cpp 23 | ) 24 | 25 | INSTALL( FILES tinyxml.h tinystr.h DESTINATION include ) 26 | INSTALL( TARGETS tinyxml ARCHIVE DESTINATION lib ) 27 | -------------------------------------------------------------------------------- /dependencies/VTK/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_package(VTK 9.0 ${DEPS_FIND_MODE_VTK} NO_MODULE) 8 | -------------------------------------------------------------------------------- /dependencies/ZLIB/build.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_file(ZLIB_TARBALL zlib-1.2.6.tar.gz 8 | DOC "Path to download ZLIB (can be url http://)" 9 | PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions 10 | ) 11 | if(NOT ZLIB_TARBALL) 12 | message("No zlib source found, will download.") 13 | set(ZLIB_TARBALL http://sourceforge.net/projects/libpng/files/zlib/1.2.6/zlib-1.2.6.tar.gz 14 | CACHE STRING "Path to download ZLIB (can be local file://)" FORCE) 15 | endif() 16 | ExternalProject_Add( 17 | dep_ZLIB 18 | INSTALL_DIR ${HEMELB_DEPENDENCIES_INSTALL_PREFIX} 19 | URL ${ZLIB_TARBALL} 20 | CONFIGURE_COMMAND /configure --prefix= 21 | BUILD_COMMAND make -j${HEMELB_SUBPROJECT_MAKE_JOBS} 22 | BUILD_IN_SOURCE 1 23 | ) 24 | -------------------------------------------------------------------------------- /dependencies/ZLIB/find.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | include_guard() 6 | 7 | find_package(ZLIB ${DEPS_FIND_MODE_ZLIB}) 8 | -------------------------------------------------------------------------------- /dependencies/distributions/README: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | This is a recommended location to put downloads of distribution tarballs 7 | -------------------------------------------------------------------------------- /dependencies/patches/mpwide_include.diff: -------------------------------------------------------------------------------- 1 | --- a/Test.cpp Wed May 09 11:41:21 2012 +0100 2 | +++ b/Test.cpp Wed May 09 12:50:11 2012 +0100 3 | @@ -1,3 +1,4 @@ 4 | +#include 5 | #include 6 | #include 7 | #include 8 | -------------------------------------------------------------------------------- /deploy/.jobscripts/README: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | Folder to keep jobscripts for deployment 7 | -------------------------------------------------------------------------------- /deploy/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | -------------------------------------------------------------------------------- /deploy/machines_user_example.yml: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | 7 | # Copy this file as machines_user.yml, and fill in your details. 8 | # Details given in the default dictionary will override default settings in machines.yml 9 | # Details given in per-machine dictionaries will override machine settings in machines.yml 10 | default: 11 | local_results: "~/devel/ccs/fabric/hemelb/results" 12 | local_configs: "~/devel/ccs/fabric/hemelb/config_files" 13 | local_profiles: "~/devel/ccs/fabric/hemelb/config_profiles" 14 | username: "jamespjh" 15 | legion: 16 | username: "ucgajhe" 17 | project: "jamespjh_ccs" 18 | hector: 19 | project: "e10" 20 | budget: "e10-jamespjh" -------------------------------------------------------------------------------- /deploy/templates/batch_build: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | $build_prefix 7 | rm -rf $build_path 8 | mkdir -p $build_path 9 | cd $build_path 10 | cmake $repository_path $cmake_flags 11 | make 12 | make install 13 | chmod u+x $install_path/bin/unittests_hemelb $install_path/bin/hemelb 14 | -------------------------------------------------------------------------------- /deploy/templates/batch_build_code: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | $build_prefix 7 | rm -rf $code_build_path 8 | mkdir -p $code_build_path 9 | cd $code_build_path 10 | cmake $repository_path/Code $cmake_flags 11 | make 12 | make install 13 | chmod u+x $install_path/bin/unittests_hemelb $install_path/bin/hemelb 14 | cp $code_build_cache $build_cache 15 | -------------------------------------------------------------------------------- /deploy/templates/hemelb: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | export OMP_NUM_THREADS=1 7 | 8 | cd $job_results 9 | $run_prefix 10 | rm -rf results 11 | cp $job_config_path/* . 12 | $run_command $install_path/bin/$executable -in config.xml 13 | -------------------------------------------------------------------------------- /deploy/templates/multijob: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | cd $job_results 7 | $run_prefix 8 | $jobstorun -------------------------------------------------------------------------------- /deploy/templates/multiscale_hemelb: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | cd $job_results 7 | $run_prefix 8 | rm -rf results 9 | cp $job_config_path/* . 10 | $run_command $install_path/bin/multiscale_hemelb -in config.xml -s $snapshots 11 | -------------------------------------------------------------------------------- /deploy/templates/no_batch: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | # no batch system 7 | 8 | -------------------------------------------------------------------------------- /deploy/templates/pbs: -------------------------------------------------------------------------------- 1 | #!/bin/bash --login 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | #PBS -N $job_name 7 | #PBS -l mppwidth=$cores_reserved 8 | #PBS -l mppnppn=$corespernode 9 | #PBS -l walltime=$wall_time 10 | #PBS -A $budget 11 | #PBS -q $queue 12 | #PBS -m abe 13 | -------------------------------------------------------------------------------- /deploy/templates/pbs-archer: -------------------------------------------------------------------------------- 1 | #!/bin/bash --login 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | #PBS -N $job_name 7 | #PBS -l select=$nodes:mpiprocs=$corespernode 8 | #PBS -l walltime=$wall_time 9 | #PBS -A $budget 10 | #PBS -q $queue 11 | #PBS -m abe 12 | -------------------------------------------------------------------------------- /deploy/templates/pbs_barebone: -------------------------------------------------------------------------------- 1 | #!/bin/bash --login 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | #PBS -N $job_name 7 | #PBS -l mppwidth=$cores_reserved 8 | #PBS -l mppnppn=$corespernode 9 | #PBS -l walltime=$wall_time 10 | #PBS -m abe 11 | -------------------------------------------------------------------------------- /deploy/templates/pbs_serial: -------------------------------------------------------------------------------- 1 | #!/bin/bash --login 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | #PBS -N $job_name 7 | #PBS -l walltime=$wall_time 8 | #PBS -l cput=$wall_time 9 | #PBS -A $budget 10 | #PBS -q serial 11 | #PBS -m abe 12 | -------------------------------------------------------------------------------- /deploy/templates/regression: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | cd $job_results 7 | $run_prefix 8 | rm -rf results 9 | $run_command $install_path/bin/hemelb -in $regression_test_path/config.xml -out $job_results/results 10 | $run_command_one_proc $regression_test_path/NumericalComparison $regression_test_path/CleanExtracted results/Extracted -------------------------------------------------------------------------------- /deploy/templates/sge: -------------------------------------------------------------------------------- 1 | #!/bin/bash -l 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | #$$ -S /bin/bash 7 | 8 | #$$ -l h_rt=$wall_time 9 | 10 | #$$ -l mem=$memory 11 | 12 | #$$ -N $job_name 13 | 14 | #$$ -pe openmpi $cores_reserved 15 | 16 | #$$ -P $project 17 | 18 | #$$ -wd $job_results 19 | $node_type_restriction 20 | export TMP=$job_results 21 | -------------------------------------------------------------------------------- /deploy/templates/sge_oppenheimer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | #$$ -wd $job_results 7 | #$$ -q all.q 8 | #$$ -pe openmpi $cores_reserved 9 | #$$ -N $job_name 10 | #$$ -e $job_results/${name}.error 11 | #$$ -o $job_results/${name}.output 12 | -------------------------------------------------------------------------------- /deploy/templates/unittests: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | cd $job_results 7 | $run_prefix 8 | $run_command $install_path/bin/unittests_hemelb -o 'tests.xml' 9 | -------------------------------------------------------------------------------- /deploy/test/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | -------------------------------------------------------------------------------- /deploy/test/fixtures/templates/dummy_ge_header: -------------------------------------------------------------------------------- 1 | user: $username 2 | -------------------------------------------------------------------------------- /deploy/test/fixtures/templates/dummy_jobscript: -------------------------------------------------------------------------------- 1 | run bananas 2 | -------------------------------------------------------------------------------- /deploy/test/fixtures/templates/hemelb: -------------------------------------------------------------------------------- 1 | cd $job_results 2 | $run_prefix 3 | rm -rf results 4 | cp $job_config_path/* . 5 | mpirun -np $cores $install_path/bin/hemelb -in config.xml 6 | -------------------------------------------------------------------------------- /deploy/test/fixtures/templates/no_batch: -------------------------------------------------------------------------------- 1 | # no batch system 2 | -------------------------------------------------------------------------------- /deploy/test/machines_user.yml: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | 7 | default: 8 | local_results: "$test_home/fixtures/results" 9 | local_configs: "$test_home/fixtures/configs" 10 | local_profiles: "$test_home/fixtures/profiles" 11 | local_templates_path: "$test_home/fixtures/templates" 12 | username: "test_user" 13 | legion: 14 | username: "test_user_legion" 15 | project: "testproject" 16 | hector: 17 | project: "testproject" 18 | budget: "testbudget" 19 | localhost: 20 | home_path_template: "/Users/$username/devel/fabric/hemelb/local" 21 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # HemeLB 2 | 3 | A typical workflow with HemeLB consists of four steps: 4 | 5 | 1. A preprocessing step where you create a mesh or geometry file (we 6 | use extension .gmy) from a representation of the surface of your 7 | domain. For this, you need to use the application in the 8 | [geometry-tool](../geometry-tool) 9 | directory. [Documentation](user/geometry-tool.md) 10 | 11 | 2. Setting options in the configuration XML file, such as timestep and 12 | output data and 13 | frequency. [Documentation](user/XmlConfiguration.md) 14 | 15 | 3. Compiling and running the 16 | [main application](user/main-application.md). 17 | 18 | 4. Post processing the results, using the Python packages in the 19 | [python-tools](../python-tools) directory. [Documentation](user/python-tools.md) 20 | 21 | 22 | [Developer documentation](dev) 23 | 24 | -------------------------------------------------------------------------------- /doc/dev/README.md: -------------------------------------------------------------------------------- 1 | # HemeLB Developers' Documentation 2 | -------------------------------------------------------------------------------- /doc/dev/file-formats/offset.md: -------------------------------------------------------------------------------- 1 | # Offset files 2 | 3 | These store where each MPI rank of the simulation wrote its contiguous 4 | chunk of data. This makes resuming a checkpoint on the same number of 5 | ranks much easier and faster. 6 | 7 | The file has a header and a body. 8 | 9 | ## Header 10 | This contains, encoded as uint32, in order: 11 | - HemeLbMagicNumber 12 | - OffsetMagicNumber (0x6F666604 == 'xtr\eof') 13 | - OffsetVersionNumber (currently 1) 14 | Then, encoded as an int32 (because MPI defines it as signed) 15 | - Number of ranks 16 | 17 | # Body 18 | 19 | This holds number of ranks + 1 entries, XDR encoded as uint64. Each 20 | gives the offset (in number of bytes) into the extraction file of the 21 | start of that rank's chunk. The final value holds the 22 | just-past-the-end value. 23 | 24 | The length of a single timestep of pure data in an extraction file is 25 | given by `data[n_ranks] - data[0]`. 26 | -------------------------------------------------------------------------------- /doc/user/machine-specific-build-notes/archer2.md: -------------------------------------------------------------------------------- 1 | # Building on ARCHER2 2 | 3 | HPE Cray EX https://docs.archer2.ac.uk 4 | 5 | ``` 6 | module load cmake/3.21.3 7 | module load PrgEnv-gnu 8 | module swap gcc gcc/11.2.0 9 | module load boost/1.72.0 10 | module load parmetis/4.0.3 11 | module load cray-hdf5-parallel 12 | 13 | thisdir=$(readlink -f $(dirname $BASH_SOURCE)) 14 | build_dir=$thisdir/build 15 | install_dir=$thisdir/install 16 | source_dir=path/to/hemelb 17 | 18 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$install -DHEMELB_BUILD_RBC=ON -B $build_dir -S $source_dir 19 | cmake --build build 20 | ``` 21 | -------------------------------------------------------------------------------- /fabfile.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from deploy.fab import * 7 | -------------------------------------------------------------------------------- /geometry-tool/.vagrant-provision-ubuntu-20.04.sh: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | # Ubuntu pacakages 7 | apt-get update 8 | DEBIAN_FRONTEND=noninteractive apt-get install -y \ 9 | cmake \ 10 | gcc-9 \ 11 | jq \ 12 | libboost-dev \ 13 | libcgal-dev \ 14 | libopengl0 \ 15 | libosmesa6 \ 16 | libxt6 \ 17 | ninja-build \ 18 | python-is-python3 \ 19 | python3.8-venv \ 20 | python3.8-dev \ 21 | python3-pip \ 22 | python3-wxgtk4.0 \ 23 | xfce4 \ 24 | virtualbox-guest-dkms \ 25 | virtualbox-guest-utils \ 26 | virtualbox-guest-x11 27 | 28 | # Allow non-root to run GUI 29 | echo "allowed_users=anybody" > /etc/X11/Xwrapper.config 30 | # NOTE: VM requires reboot before running GUI 31 | echo "Before using the GUI run `vagrant reload gmy` 32 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Bindings/EmptySelection.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from ..Util.Observer import Observable 7 | 8 | 9 | class EmptySelection(Observable): 10 | """Represent an empty selection.""" 11 | 12 | def __getattr__(self, attr): 13 | return self 14 | 15 | pass 16 | 17 | 18 | EmptySelection = EmptySelection() 19 | 20 | 21 | def isNone(value): 22 | return (value is None) or (value is EmptySelection) 23 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Controller/IoletController.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | import weakref 7 | 8 | from ..Bindings.ObjectController import ObjectController 9 | from .VectorController import HasVectorKeys 10 | 11 | 12 | class IoletController(HasVectorKeys, ObjectController): 13 | """Controller for inlets and outlets. 14 | 15 | The constructor 16 | """ 17 | 18 | _instanceDict = weakref.WeakValueDictionary() 19 | 20 | @classmethod 21 | def New(cls, delegate): 22 | try: 23 | con = cls._instanceDict[delegate] 24 | except KeyError: 25 | con = cls._instanceDict[delegate] = cls(delegate) 26 | pass 27 | return con 28 | 29 | def __init__(self, delegate): 30 | ObjectController.__init__(self, delegate) 31 | 32 | self.DefineVectorKey("Centre") 33 | self.DefineVectorKey("Normal") 34 | self.DefineVectorKey("Pressure") 35 | return 36 | 37 | pass 38 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Controller/VtkObjectController.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Controller/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/.clang-format-ignore: -------------------------------------------------------------------------------- 1 | */PybindVTKTypeCaster.h 2 | */Point_inside_polyhedron_3.h 3 | */Triangle_3_Ray_3_do_intersect.h 4 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/BufferPool.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_BUFFERPOOL_H 7 | #define HEMELBSETUPTOOL_BUFFERPOOL_H 8 | #include 9 | 10 | // Allocates and frees or reuses buffers of a given size. 11 | class BufferPool { 12 | public: 13 | // C'tor- argument is the size of buffers to work with. 14 | BufferPool(unsigned int); 15 | ~BufferPool(); 16 | // Returns an uninitialized buffer 17 | char* New(); 18 | // Return a buffer to the pool or free it 19 | void Free(char*); 20 | // Returns the size of buffers managed by the pool 21 | unsigned int GetSize() const; 22 | 23 | private: 24 | unsigned int size; 25 | std::stack unused; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/BuildCGALPolygon.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_BUILDCGALPOLYGON_H 7 | #define HEMELBSETUPTOOL_BUILDCGALPOLYGON_H 8 | 9 | #include "CGALtypedef.h" 10 | 11 | #include "Block.h" 12 | 13 | #include 14 | #include 15 | 16 | class vtkPoints; 17 | class vtkCellArray; 18 | class vtkIntArray; 19 | 20 | template 21 | class BuildCGALPolygon : public CGAL::Modifier_base { 22 | public: 23 | BuildCGALPolygon(vtkPoints* ptsin, 24 | vtkCellArray* polysin, 25 | vtkIntArray* IoletIdArrayIn) { 26 | this->pts = ptsin; 27 | this->polys = polysin; 28 | this->IoletIdArray = IoletIdArrayIn; 29 | } 30 | void operator()(HDS& hds); 31 | 32 | private: 33 | vtkPoints* pts; 34 | vtkCellArray* polys; 35 | vtkIntArray* IoletIdArray; 36 | }; 37 | 38 | #endif // HEMELBSETUPTOOL_BUILDCGALPOLYGON_H 39 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/Debug.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "Debug.h" 7 | 8 | namespace { 9 | DummyStream ds; 10 | } 11 | 12 | DummyStream& Log() { 13 | return ds; 14 | } 15 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/Debug.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_DEBUG_H 7 | #define HEMELBSETUPTOOL_DEBUG_H 8 | 9 | #include 10 | 11 | class DummyStream {}; 12 | 13 | #ifdef DEBUG 14 | 15 | template 16 | DummyStream& operator<<(DummyStream& ds, const T& val) { 17 | std::cout << val; 18 | return ds; 19 | } 20 | inline DummyStream& operator<<(DummyStream& ds, 21 | std::ostream& (*func)(std::ostream& os)) { 22 | std::cout << std::endl; 23 | return ds; 24 | } 25 | 26 | #else 27 | 28 | template 29 | DummyStream& operator<<(DummyStream& ds, const T& val) { 30 | return ds; 31 | } 32 | inline DummyStream& operator<<(DummyStream& ds, 33 | std::ostream& (*func)(std::ostream& os)) { 34 | return ds; 35 | } 36 | 37 | #endif // DEBUG 38 | 39 | DummyStream& Log(); 40 | 41 | #endif // HEMELBSETUPTOOL_DEBUG_H 42 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/GenerationError.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_GENERATIONERROR_H 7 | #define HEMELBSETUPTOOL_GENERATIONERROR_H 8 | #include 9 | #include 10 | 11 | struct GenerationError : public std::exception { 12 | virtual const char* what() const noexcept { return "GenerationError"; } 13 | }; 14 | 15 | struct GenerationErrorMessage : public GenerationError { 16 | GenerationErrorMessage(const std::string errorMessage) : msg(errorMessage) {} 17 | ~GenerationErrorMessage() {} 18 | virtual const char* what() const noexcept { return msg.c_str(); } 19 | 20 | const std::string msg; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/Index.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #include "Index.h" 7 | 8 | namespace { 9 | void DefaultHandlerFunction(int direction) { 10 | throw IndexError(); 11 | } 12 | } // namespace 13 | 14 | namespace hemelb { 15 | namespace util { 16 | Vector3DBase::HandlerFunction* Vector3DBase::handler = DefaultHandlerFunction; 17 | } 18 | } // namespace hemelb 19 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/Index.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_INDEX_H 7 | #define HEMELBSETUPTOOL_INDEX_H 8 | 9 | #include 10 | #include "util/Vector3D.h" 11 | 12 | class IndexError : public std::exception { 13 | public: 14 | virtual const char* what() const noexcept { return "IndexError"; } 15 | }; 16 | 17 | typedef hemelb::util::Vector3D Index; 18 | typedef hemelb::util::Vector3D Vector; 19 | 20 | #endif // HEMELBSETUPTOOL_INDEX_H 21 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/Iolet.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_IOLET_H 7 | #define HEMELBSETUPTOOL_IOLET_H 8 | 9 | #include "Index.h" 10 | struct Iolet { 11 | Vector Centre; 12 | Vector Normal; 13 | 14 | double Radius; 15 | int Id; 16 | bool IsInlet; 17 | }; 18 | 19 | #endif // HEMELBSETUPTOOL_IOLET_H 20 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Generation/Neighbours.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELBSETUPTOOL_NEIGHBOURS_H 7 | #define HEMELBSETUPTOOL_NEIGHBOURS_H 8 | 9 | #include 10 | #include "Index.h" 11 | 12 | #include "io/formats/geometry.h" 13 | 14 | struct Neighbours { 15 | // shortcut to geometry class 16 | using gmy = hemelb::io::formats::geometry; 17 | 18 | // This assumes that the hemelb lattice descriptor class has a zero vector. 19 | static constexpr int n = gmy::NumberOfDisplacements; 20 | static constexpr int nLater = n / 2; 21 | 22 | static std::vector laterNeighbourIndices; 23 | static std::vector vectors; 24 | static std::vector norms; 25 | static std::vector inverses; 26 | 27 | static void Init(); 28 | 29 | private: 30 | // Private to ensure it's not instantiated. 31 | Neighbours(); 32 | }; 33 | #endif // HEMELBSETUPTOOL_NEIGHBOURS_H 34 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/Vector.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from ..Util.Observer import Observable 7 | 8 | 9 | class Vector(Observable): 10 | _Args = {"x": float("nan"), "y": float("nan"), "z": float("nan")} 11 | 12 | def __init__(self, *args): 13 | if len(args) == 0: 14 | nan = float("nan") 15 | self.x = nan 16 | self.y = nan 17 | self.z = nan 18 | elif len(args) == 1: 19 | self.x, self.y, self.z = args[0] 20 | elif len(args) == 3: 21 | self.x, self.y, self.z = args 22 | else: 23 | raise ValueError 24 | 25 | return 26 | 27 | def __repr__(self): 28 | return "Vector({0.x}, {0.y}, {0.z})".format(self) 29 | 30 | def __str__(self): 31 | return "({0.x},{0.y},{0.z})".format(self) 32 | 33 | pass 34 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Model/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | import vtk 7 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/Util/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/View/IoletListCtrl.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from ..Bindings.BindableWxListCtrl import BindableWxListCtrl 7 | 8 | 9 | class IoletListCtrl(BindableWxListCtrl): 10 | def __init__(self, *args, **kwargs): 11 | BindableWxListCtrl.__init__(self, *args, **kwargs) 12 | self.InsertColumn(0, "Name") 13 | return 14 | 15 | pass 16 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/View/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/scripts/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/scripts/config_to_geometry.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | import argparse 6 | 7 | 8 | def main(): 9 | p = argparse.ArgumentParser( 10 | description='Upgrade an saved profile from "config" to "geometry"' 11 | ) 12 | p.add_argument("input") 13 | p.add_argument("output") 14 | args = p.parse_args() 15 | 16 | from ..Util.ProfileUpdateTools import Upgrade 17 | 18 | Upgrade(args.input, args.output) 19 | -------------------------------------------------------------------------------- /geometry-tool/HlbGmyTool/scripts/pro_to_pr2.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | from argparse import ArgumentParser 6 | import os.path 7 | 8 | 9 | def main(): 10 | # Parse command line arguments 11 | parser = ArgumentParser(description="Upgrade an old setuptool profile file") 12 | 13 | parser.add_argument("old", help="The old profile file") 14 | parser.add_argument( 15 | "new", 16 | nargs="?", 17 | help="The new profile file (if absent, assumed to be basename(old) + .pr2)", 18 | ) 19 | 20 | args = parser.parse_args() 21 | if args.new is None: 22 | base, ext = os.path.splitext(args.old) 23 | args.new = base + ".pr2" 24 | pass 25 | 26 | # Import our module late to give erroneous args a chance to be caught 27 | # quickly 28 | from ..Model.Profile import Profile 29 | 30 | p = Profile() 31 | p.LoadFromFile(args.old) 32 | p.Save(args.new) 33 | -------------------------------------------------------------------------------- /geometry-tool/InletProcessing/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /geometry-tool/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | # HemeLB geometry generation tool 7 | 8 | Please see the documentation in <../doc/user/geometry-tool.md> 9 | -------------------------------------------------------------------------------- /geometry-tool/conda-environment.yml: -------------------------------------------------------------------------------- 1 | name: gmy-tool 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - vmtk=1.5.0 6 | - wxpython=4.0.6 7 | -------------------------------------------------------------------------------- /geometry-tool/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | 7 | # Append '-g' and '-O0' to the compile flags and build the extension 8 | # in place (i.e. $ python setup.py build_ext --inplace) 9 | # Then treat this script just like the python executable 10 | # (e.g. ./debug.sh scripts/hemelb-setup-nogui /path/to/profile.pro) 11 | 12 | # Create a file break.gdb and add a series of GDB break statements. 13 | # They will be set before execution starts. 14 | 15 | cat > prebreak.gdb < run.gdb < 2 | 3 | 4 | 5 | 6 | # HemeLB python tools 7 | 8 | Please see the doc folder: <../doc/user/python-tools.md> 9 | -------------------------------------------------------------------------------- /python-tools/hlb/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HemeTools 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /python-tools/hlb/.pydevproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | HemeLB SetupTool virtualenv 4 | python 2.7 5 | 6 | /${PROJECT_DIR_NAME} 7 | 8 | 9 | -------------------------------------------------------------------------------- /python-tools/hlb/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /python-tools/hlb/converters/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /python-tools/hlb/parsers/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | """Package for reading/writing HemeLB file formats. 7 | 8 | Beginning August 2011, binary formats will be identified with magic numbers 9 | http://en.wikipedia.org/wiki/File_format#Magic_number 10 | 11 | Here we define the generic HemeLB binary file identifier. It should be 12 | the first 4 bytes of every (binary) file used for IO. It will be then 13 | followed by another 4 bytes identifying the particular type/version, 14 | that number being terminated by the EOF character (0x04). 15 | """ 16 | 17 | import numpy as np 18 | 19 | HemeLbMagicNumber = 0x686C6221 20 | -------------------------------------------------------------------------------- /python-tools/hlb/parsers/geometry/BaseSite.pxd: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | cimport numpy as np 6 | from hlb.utils cimport xdr 7 | 8 | cdef class BaseSite: 9 | cdef public: 10 | # BEWARE: Adding attributes to this class requires programming 11 | # their pickling/unpickling in __getstate__ and __setstate__ 12 | int Type 13 | np.ndarray Index 14 | np.ndarray IntersectionType 15 | np.ndarray IntersectionDistance 16 | np.ndarray IOletIndex 17 | bint WallNormalAvailable 18 | np.ndarray WallNormal 19 | object GetBlock 20 | 21 | cdef bint _IsFluid(self) 22 | cdef bint _IsSolid(self) 23 | cdef bint _IsEdge(self) 24 | cdef np.ndarray _Position(self) 25 | cpdef LoadFrom(self, xdr.Unpacker loader) 26 | 27 | pass 28 | -------------------------------------------------------------------------------- /python-tools/hlb/simconf/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /python-tools/hlb/simconf/simplify.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | from functools import wraps 6 | import quantities as pq 7 | 8 | 9 | def simplify(func): 10 | """Decorator to simplify the units of the return value of a function.""" 11 | 12 | @wraps(func) 13 | def wrapper(*args, **kwargs): 14 | ans = func(*args, **kwargs) 15 | if isinstance(ans, pq.Quantity): 16 | return ans.simplified 17 | 18 | return ans 19 | 20 | return wrapper 21 | -------------------------------------------------------------------------------- /python-tools/hlb/surfacegenerator/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/IterPairs.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | def IterPairs(iterable): 6 | """Return adjacent pairs of items from iterable. I.e.: 7 | IterPairs(lst) -> (lst[0], lst[1]), (lst[1], lst[2]), (lst[2], lst[3]), ..., (lst[i], lst[i+1]) 8 | """ 9 | first = True 10 | for item in iterable: 11 | if first: 12 | new = item 13 | first = False 14 | continue 15 | else: 16 | old = new 17 | new = item 18 | yield old, new 19 | continue 20 | return 21 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/XdrSerialisation.h: -------------------------------------------------------------------------------- 1 | // This file is part of HemeLB and is Copyright (C) 2 | // the HemeLB team and/or their institutions, as detailed in the 3 | // file AUTHORS. This software is provided under the terms of the 4 | // license in the file LICENSE. 5 | 6 | #ifndef HEMELB_IO_WRITERS_XDR_SERIALISATION_H 7 | #define HEMELB_IO_WRITERS_XDR_SERIALISATION_H 8 | 9 | #include 10 | 11 | // Signed and unsigned integers of 32 bits or less 12 | void xdr_deserialise_int32(int32_t* val, const char* src_buf); 13 | void xdr_deserialise_uint32(uint32_t* val, const char* src_buf); 14 | 15 | // Signed and unsigned 64 bit ints 16 | void xdr_deserialise_int64(int64_t* val, const char* src_buf); 17 | void xdr_deserialise_uint64(uint64_t* val, const char* src_buf); 18 | 19 | // 32 bit floats 20 | void xdr_deserialise_float(float* val, const char* src_buf); 21 | 22 | // 64 bit doubles 23 | void xdr_deserialise_double(double* val, const char* src_buf); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file is part of HemeLB and is Copyright (C) 3 | # the HemeLB team and/or their institutions, as detailed in the 4 | # file AUTHORS. This software is provided under the terms of the 5 | # license in the file LICENSE. 6 | import sys 7 | import os 8 | from .utils import * 9 | 10 | 11 | def main(): 12 | pass 13 | 14 | 15 | if __name__ == "__main__": 16 | main() 17 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/cxdr.pxd: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from libc.stdint cimport int32_t, uint32_t 7 | 8 | cdef extern from "XdrSerialisation.h": 9 | void xdr_deserialise_int32(int32_t* val, const char* src_buf) 10 | void xdr_deserialise_uint32(uint32_t* val, const char* src_buf) 11 | void xdr_deserialise_float(float* val, const char* src_buf) 12 | void xdr_deserialise_double(double* val, const char* src_buf) 13 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/default_property.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | class default_property(object): 6 | """Decorator to make a property with a default value (the result 7 | of evaluating the method) that can be overriden by setting a 8 | value. The default is restored by deleting the attribute. 9 | """ 10 | 11 | def __init__(self, fcalc): 12 | self.value_attr_name = "_default_" + fcalc.func_name 13 | self.calc_default = fcalc 14 | return 15 | 16 | def __get__(self, instance, owner_cls): 17 | try: 18 | return getattr(instance, self.value_attr_name) 19 | except AttributeError: 20 | return self.calc_default(instance) 21 | 22 | def __set__(self, instance, value): 23 | return setattr(instance, self.value_attr_name, value) 24 | 25 | def __delete__(self, instance): 26 | try: 27 | return delattr(instance, self.value_attr_name) 28 | except AttributeError: 29 | raise AttributeError("can't delete attribute") 30 | 31 | pass 32 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/memo.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | """Memoize computed properties. 6 | 7 | """ 8 | 9 | 10 | class memo_property(object): 11 | """Decorator for memoizing computed, static properties.""" 12 | 13 | def __init__(self, fget): 14 | self.memo_attr_name = "_memo_" + fget.func_name 15 | self.getter = fget 16 | return 17 | 18 | def __get__(self, instance, owner_cls): 19 | try: 20 | ans = getattr(instance, self.memo_attr_name) 21 | except AttributeError: 22 | ans = self.getter(instance) 23 | setattr(instance, self.memo_attr_name, ans) 24 | pass 25 | return ans 26 | 27 | pass 28 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/xdr.pxd: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | cdef class Unpacker: 7 | cdef char* _buf 8 | cdef int _pos 9 | # def __cinit__(self, bytes buf) 10 | # def __dealloc__(self) 11 | cpdef double unpack_double(self) 12 | cpdef float unpack_float(self) 13 | cpdef int unpack_int(self) 14 | cpdef unsigned int unpack_uint(self) 15 | -------------------------------------------------------------------------------- /python-tools/hlb/utils/xdr.pyx: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | cimport cxdr 7 | from libc.stdint cimport int32_t, uint32_t 8 | 9 | cdef class Unpacker: 10 | def __cinit__(self, bytes buf): 11 | self._buf = buf 12 | self._pos = 0 13 | 14 | cpdef double unpack_double(self): 15 | cdef double ans 16 | cxdr.xdr_deserialise_double(&ans, &self._buf[self._pos]) 17 | self._pos += 8 18 | return ans 19 | 20 | cpdef float unpack_float(self): 21 | cdef float ans 22 | cxdr.xdr_deserialise_float(&ans, &self._buf[self._pos]) 23 | self._pos += 4 24 | return ans 25 | 26 | cpdef int unpack_int(self): 27 | cdef int32_t ans 28 | cxdr.xdr_deserialise_int32(&ans, &self._buf[self._pos]) 29 | self._pos += 4 30 | return ans 31 | 32 | cpdef unsigned int unpack_uint(self): 33 | cdef uint32_t ans 34 | cxdr.xdr_deserialise_uint32(&ans, &self._buf[self._pos]) 35 | self._pos += 4 36 | return ans 37 | -------------------------------------------------------------------------------- /python-tools/hlb/vtkhelp/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | -------------------------------------------------------------------------------- /python-tools/hlb/vtkhelp/cells.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | from vtk.util.numpy_support import vtk_to_numpy 6 | 7 | 8 | def IterCellPtIds(cellArray): 9 | """Iterate over the cells, yielding NumPy arrays of the point IDs 10 | making up each cell. 11 | """ 12 | data = vtk_to_numpy(cellArray.GetData()) 13 | n = len(data) 14 | 15 | lenId = 0 16 | while lenId < n: 17 | start = lenId + 1 18 | end = start + data[lenId] 19 | 20 | yield data[start:end] 21 | 22 | lenId = end 23 | continue 24 | return 25 | -------------------------------------------------------------------------------- /python-tools/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "Cython ~= 0.29", "numpy"] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /python-tools/requirements.txt: -------------------------------------------------------------------------------- 1 | Cython 2 | numpy 3 | vtk 4 | -------------------------------------------------------------------------------- /python-tools/test-requirements.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | pyyaml 3 | -------------------------------------------------------------------------------- /python-tools/tests/conftest.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | import os.path 7 | 8 | import pytest 9 | 10 | 11 | @pytest.fixture 12 | def diffTestDir(): 13 | testdir = os.environ["HEMELB_TESTS_DIR"] 14 | diff = os.path.join(testdir, "diffTest") 15 | assert os.path.isdir(diff) 16 | return diff 17 | -------------------------------------------------------------------------------- /python-tools/tests/test_dumpextracted.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from io import StringIO 7 | import os.path 8 | 9 | from hlb.converters.ExtractedPropertyTextDump import unpack 10 | 11 | 12 | def test_simple(diffTestDir): 13 | # Just a smoke test 14 | snap = os.path.join(diffTestDir, "CleanExtracted", "flow_snapshot.xtr") 15 | buf = StringIO() 16 | unpack(snap, stream=buf) 17 | -------------------------------------------------------------------------------- /python-tools/tests/test_geometry_selfconsistent.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | import os.path 7 | from hlb.parsers.geometry.self_consistency import CheckingLoader 8 | 9 | 10 | def test_gmy_selfconsist(diffTestDir): 11 | config = os.path.join(diffTestDir, "config.xml") 12 | ldr = CheckingLoader(config) 13 | ldr.Load() 14 | 15 | assert not ldr.HadErrors 16 | -------------------------------------------------------------------------------- /python-tools/tests/test_parser_offset.py: -------------------------------------------------------------------------------- 1 | # This file is part of HemeLB and is Copyright (C) 2 | # the HemeLB team and/or their institutions, as detailed in the 3 | # file AUTHORS. This software is provided under the terms of the 4 | # license in the file LICENSE. 5 | 6 | from pathlib import Path 7 | import numpy as np 8 | from hlb.parsers.offset import OffsetFile 9 | 10 | 11 | def test_load_off(diffTestDir): 12 | off_path = Path(diffTestDir) / "CleanExtracted" / "flow_snapshot.off" 13 | off = OffsetFile(off_path) 14 | assert off.NumberOfRanks == 2 15 | assert off.Data.shape == (3,) 16 | -------------------------------------------------------------------------------- /python-tools/tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py38,py39,py310,py311 3 | isolated_build = true 4 | 5 | [gh-actions] 6 | python = 7 | 3.8: py38 8 | 3.9: py39 9 | 3.10: py310 10 | 3.11: py311 11 | 12 | [testenv] 13 | deps = -rtest-requirements.txt 14 | commands = 15 | pytest 16 | passenv = HEMELB_TESTS_DIR 17 | --------------------------------------------------------------------------------