├── .gitignore ├── Apps ├── CMakeLists.txt └── SoapFilm3D │ ├── CMakeLists.txt │ ├── Colormap.cpp │ ├── Colormap.h │ ├── Force.cpp │ ├── Force.h │ ├── LinearBendingForce.cpp │ ├── LinearBendingForce.h │ ├── LinearizedImplicitEuler.cpp │ ├── LinearizedImplicitEuler.h │ ├── MathDefs.h │ ├── MeshIO.cpp │ ├── MeshIO.h │ ├── PR.frag │ ├── PR.vert │ ├── PRRenderer.cpp │ ├── PRRenderer.h │ ├── SceneStepper.cpp │ ├── SceneStepper.h │ ├── Scenes.cpp │ ├── Scenes.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Sim.cpp │ ├── Sim.h │ ├── SimOptions.cpp │ ├── SimOptions.h │ ├── SimpleGravityForce.cpp │ ├── SimpleGravityForce.h │ ├── SpringForce.cpp │ ├── SpringForce.h │ ├── VS3D.cpp │ ├── VS3D.h │ ├── VS3DExplicit.cpp │ ├── VS3DImplicit.cpp │ ├── VertexAreaForce.cpp │ ├── VertexAreaForce.h │ ├── eigenheaders.cpp │ ├── eigenheaders.h │ ├── env.frag │ ├── env.vert │ ├── fmmtl │ ├── fmmtl │ │ ├── Direct.hpp │ │ ├── Expansion.hpp │ │ ├── FMMOptions.hpp │ │ ├── Kernel.hpp │ │ ├── KernelMatrix.hpp │ │ ├── KernelMatrixPlan.hpp │ │ ├── config.hpp │ │ ├── context │ │ │ └── Context.hpp │ │ ├── dispatch │ │ │ ├── BatchFar.hpp │ │ │ ├── BatchNear.hpp │ │ │ ├── Dispatchers.hpp │ │ │ ├── INITL.hpp │ │ │ ├── INITM.hpp │ │ │ ├── L2L.hpp │ │ │ ├── L2T.hpp │ │ │ ├── M2L.hpp │ │ │ ├── M2M.hpp │ │ │ ├── M2T.hpp │ │ │ ├── MAC.hpp │ │ │ ├── S2L.hpp │ │ │ ├── S2M.hpp │ │ │ ├── S2P.hpp │ │ │ ├── S2T.hpp │ │ │ ├── S2T │ │ │ │ ├── S2T_Blocked_CSR.cu │ │ │ │ ├── S2T_Compressed.cpp │ │ │ │ ├── S2T_Compressed.cu │ │ │ │ └── S2T_Compressed.hpp │ │ │ └── T2P.hpp │ │ ├── executor │ │ │ ├── EvalLists.hpp │ │ │ ├── EvalTraverse.hpp │ │ │ ├── Evaluator.hpp │ │ │ └── make_executor.hpp │ │ ├── meta │ │ │ ├── dimension.hpp │ │ │ ├── for_each.hpp │ │ │ ├── func_traits.hpp │ │ │ ├── functional.hpp │ │ │ ├── integer_range.hpp │ │ │ ├── integer_sequence.hpp │ │ │ ├── kernel_traits.hpp │ │ │ ├── math.hpp │ │ │ └── tree_traits.hpp │ │ ├── numeric │ │ │ ├── Complex.hpp │ │ │ ├── Vec.hpp │ │ │ ├── bits.hpp │ │ │ ├── flens.hpp │ │ │ ├── mtl.hpp │ │ │ ├── norm.hpp │ │ │ └── random.hpp │ │ ├── traversal │ │ │ ├── Downward.hpp │ │ │ ├── DualTraversal.hpp │ │ │ ├── SingleTraversal.hpp │ │ │ └── Upward.hpp │ │ ├── tree │ │ │ ├── BallTree.hpp │ │ │ ├── BoundingBox.hpp │ │ │ ├── BoundingSphere.hpp │ │ │ ├── KDTree.hpp │ │ │ ├── MortonCoder.hpp │ │ │ ├── NDTree.hpp │ │ │ ├── TreeData.hpp │ │ │ ├── TreeRange.hpp │ │ │ └── util │ │ │ │ └── CountedProxyIterator.hpp │ │ └── util │ │ │ ├── CallStack.hpp │ │ │ ├── Clock.hpp │ │ │ └── Logger.hpp │ └── kernel │ │ ├── Barycentric.kern │ │ ├── BarycentricTaylor.hpp │ │ ├── BiotSavart.kern.cpp │ │ ├── BiotSpherical.hpp │ │ ├── ExpKernel.kern │ │ ├── Gaussian.kern │ │ ├── Helmholtz.kern │ │ ├── KernelSkeleton.kern │ │ ├── Laplace.kern │ │ ├── LaplaceSpherical.hpp │ │ ├── README.md │ │ ├── RMSpherical.hpp │ │ ├── Stokes.kern │ │ ├── UnitKernel.kern │ │ ├── Util │ │ ├── GradedPolynomial.hpp │ │ └── SphericalMultipole3D.hpp │ │ ├── Yukawa.kern │ │ └── YukawaCartesian.hpp │ ├── main.cpp │ ├── stb_image.h │ └── textures │ └── beach.h ├── CMakeLists.txt ├── LICENSE ├── LosTopos ├── CMakeLists.txt ├── LosTopos3D │ ├── Makefile │ ├── Makefile.example_defs │ ├── Makefile.inc │ ├── accelerationgrid.cpp │ ├── accelerationgrid.h │ ├── broadphase.h │ ├── broadphasegrid.cpp │ ├── broadphasegrid.h │ ├── collisionpipeline.cpp │ ├── collisionpipeline.h │ ├── cpp-file-template.txt │ ├── dynamicsurface.cpp │ ├── dynamicsurface.h │ ├── edgecollapser.cpp │ ├── edgecollapser.h │ ├── edgeflipper.cpp │ ├── edgeflipper.h │ ├── edgesplitter.cpp │ ├── edgesplitter.h │ ├── facesplitter.cpp │ ├── facesplitter.h │ ├── h-file-template.txt │ ├── impactzonesolver.cpp │ ├── impactzonesolver.h │ ├── iomesh.cpp │ ├── iomesh.h │ ├── meshcutter.cpp │ ├── meshcutter.h │ ├── meshmerger.cpp │ ├── meshmerger.h │ ├── meshpincher.cpp │ ├── meshpincher.h │ ├── meshrenderer.cpp │ ├── meshrenderer.h │ ├── meshsmoother.cpp │ ├── meshsmoother.h │ ├── meshsnapper.cpp │ ├── meshsnapper.h │ ├── nondestructivetrimesh.cpp │ ├── nondestructivetrimesh.h │ ├── options.h │ ├── readme.txt │ ├── subdivisionscheme.cpp │ ├── subdivisionscheme.h │ ├── surftrack.cpp │ ├── surftrack.h │ ├── t1transition.cpp │ ├── t1transition.h │ ├── trianglequality.cpp │ └── trianglequality.h └── common │ ├── array1.h │ ├── array2.h │ ├── array2_utils.h │ ├── array3.h │ ├── array3_utils.h │ ├── bfstream.cpp │ ├── bfstream.h │ ├── ccd_defs.h │ ├── ccd_wrapper.cpp │ ├── ccd_wrapper.h │ ├── collisionqueries.cpp │ ├── collisionqueries.h │ ├── commonoptions.h │ ├── cubic_ccd_wrapper.cpp │ ├── gluvi.cpp │ ├── gluvi.h │ ├── grid3.h │ ├── hashtable.h │ ├── lexer.h │ ├── marching_tiles_hires.cpp │ ├── marching_tiles_hires.h │ ├── mat.h │ ├── newparser.h │ ├── newsparse │ ├── dense_matrix.cpp │ ├── dense_matrix.h │ ├── krylov_solvers.cpp │ ├── krylov_solvers.h │ ├── linear_operator.h │ ├── sparse_matrix.cpp │ └── sparse_matrix.h │ ├── predicates.cpp │ ├── predicates.h │ ├── root_parity_ccd_wrapper.cpp │ ├── runstats.cpp │ ├── runstats.h │ ├── tunicate │ ├── expansion.cpp │ ├── expansion.h │ ├── fenv_include.h │ ├── intersection.cpp │ ├── interval.cpp │ ├── interval.h │ ├── intervalbase.h │ ├── neg.cpp │ ├── neg.h │ ├── orientation.cpp │ ├── rootparitycollisiontest.cpp │ ├── rootparitycollisiontest.h │ ├── sos_intersection.cpp │ ├── sos_orientation.cpp │ └── tunicate.h │ ├── util.h │ ├── vec.h │ ├── vector_math.h │ ├── wallclocktime.cpp │ └── wallclocktime.h ├── assets ├── barrel.txt ├── bubblewand.txt ├── carousel.txt ├── constrainedsphere.txt ├── cube.txt ├── doublebubble-load.txt ├── doublebubble.txt ├── foam.txt ├── foaminit.txt ├── octahedron.txt ├── peanutbubble.txt ├── pullingfoam.txt ├── quadjunction.txt ├── sheet.txt ├── sphere-load.txt ├── sphere.txt ├── straw.txt ├── tet.txt ├── triplejunction.txt ├── twobubbles.txt └── tworingspinching.txt ├── bin └── win64_bin.zip ├── cmake ├── FindEigen3.cmake ├── FindGLEW.cmake └── common.cmake ├── include └── eigen │ ├── Eigen │ ├── Cholesky │ ├── CholmodSupport │ ├── Core │ ├── Dense │ ├── Eigen │ ├── Eigenvalues │ ├── Geometry │ ├── Householder │ ├── IterativeLinearSolvers │ ├── Jacobi │ ├── LU │ ├── MetisSupport │ ├── OrderingMethods │ ├── PaStiXSupport │ ├── PardisoSupport │ ├── QR │ ├── QtAlignedMalloc │ ├── SPQRSupport │ ├── SVD │ ├── Sparse │ ├── SparseCholesky │ ├── SparseCore │ ├── SparseLU │ ├── SparseQR │ ├── StdDeque │ ├── StdList │ ├── StdVector │ ├── SuperLUSupport │ ├── UmfPackSupport │ └── src │ │ ├── Cholesky │ │ ├── LDLT.h │ │ ├── LLT.h │ │ └── LLT_LAPACKE.h │ │ ├── CholmodSupport │ │ └── CholmodSupport.h │ │ ├── Core │ │ ├── Array.h │ │ ├── ArrayBase.h │ │ ├── ArrayWrapper.h │ │ ├── Assign.h │ │ ├── AssignEvaluator.h │ │ ├── Assign_MKL.h │ │ ├── BandMatrix.h │ │ ├── Block.h │ │ ├── BooleanRedux.h │ │ ├── CommaInitializer.h │ │ ├── ConditionEstimator.h │ │ ├── CoreEvaluators.h │ │ ├── CoreIterators.h │ │ ├── CwiseBinaryOp.h │ │ ├── CwiseNullaryOp.h │ │ ├── CwiseTernaryOp.h │ │ ├── CwiseUnaryOp.h │ │ ├── CwiseUnaryView.h │ │ ├── DenseBase.h │ │ ├── DenseCoeffsBase.h │ │ ├── DenseStorage.h │ │ ├── Diagonal.h │ │ ├── DiagonalMatrix.h │ │ ├── DiagonalProduct.h │ │ ├── Dot.h │ │ ├── EigenBase.h │ │ ├── ForceAlignedAccess.h │ │ ├── Fuzzy.h │ │ ├── GeneralProduct.h │ │ ├── GenericPacketMath.h │ │ ├── GlobalFunctions.h │ │ ├── IO.h │ │ ├── Inverse.h │ │ ├── Map.h │ │ ├── MapBase.h │ │ ├── MathFunctions.h │ │ ├── MathFunctionsImpl.h │ │ ├── Matrix.h │ │ ├── MatrixBase.h │ │ ├── NestByValue.h │ │ ├── NoAlias.h │ │ ├── NumTraits.h │ │ ├── PermutationMatrix.h │ │ ├── PlainObjectBase.h │ │ ├── Product.h │ │ ├── ProductEvaluators.h │ │ ├── Random.h │ │ ├── Redux.h │ │ ├── Ref.h │ │ ├── Replicate.h │ │ ├── ReturnByValue.h │ │ ├── Reverse.h │ │ ├── Select.h │ │ ├── SelfAdjointView.h │ │ ├── SelfCwiseBinaryOp.h │ │ ├── Solve.h │ │ ├── SolveTriangular.h │ │ ├── SolverBase.h │ │ ├── StableNorm.h │ │ ├── Stride.h │ │ ├── Swap.h │ │ ├── Transpose.h │ │ ├── Transpositions.h │ │ ├── TriangularMatrix.h │ │ ├── VectorBlock.h │ │ ├── VectorwiseOp.h │ │ ├── Visitor.h │ │ ├── arch │ │ │ ├── AVX │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ └── TypeCasting.h │ │ │ ├── AVX512 │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ │ ├── AltiVec │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ │ ├── CUDA │ │ │ │ ├── Complex.h │ │ │ │ ├── Half.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ ├── PacketMathHalf.h │ │ │ │ └── TypeCasting.h │ │ │ ├── Default │ │ │ │ └── Settings.h │ │ │ ├── NEON │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ │ ├── SSE │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ └── TypeCasting.h │ │ │ └── ZVector │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ ├── functors │ │ │ ├── AssignmentFunctors.h │ │ │ ├── BinaryFunctors.h │ │ │ ├── NullaryFunctors.h │ │ │ ├── StlFunctors.h │ │ │ ├── TernaryFunctors.h │ │ │ └── UnaryFunctors.h │ │ ├── products │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ ├── GeneralMatrixMatrix.h │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ ├── GeneralMatrixMatrixTriangular_BLAS.h │ │ │ ├── GeneralMatrixMatrix_BLAS.h │ │ │ ├── GeneralMatrixVector.h │ │ │ ├── GeneralMatrixVector_BLAS.h │ │ │ ├── Parallelizer.h │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ ├── SelfadjointMatrixMatrix_BLAS.h │ │ │ ├── SelfadjointMatrixVector.h │ │ │ ├── SelfadjointMatrixVector_BLAS.h │ │ │ ├── SelfadjointProduct.h │ │ │ ├── SelfadjointRank2Update.h │ │ │ ├── TriangularMatrixMatrix.h │ │ │ ├── TriangularMatrixMatrix_BLAS.h │ │ │ ├── TriangularMatrixVector.h │ │ │ ├── TriangularMatrixVector_BLAS.h │ │ │ ├── TriangularSolverMatrix.h │ │ │ ├── TriangularSolverMatrix_BLAS.h │ │ │ └── TriangularSolverVector.h │ │ └── util │ │ │ ├── BlasUtil.h │ │ │ ├── Constants.h │ │ │ ├── DisableStupidWarnings.h │ │ │ ├── ForwardDeclarations.h │ │ │ ├── MKL_support.h │ │ │ ├── Macros.h │ │ │ ├── Memory.h │ │ │ ├── Meta.h │ │ │ ├── NonMPL2.h │ │ │ ├── ReenableStupidWarnings.h │ │ │ ├── StaticAssert.h │ │ │ └── XprHelper.h │ │ ├── Eigenvalues │ │ ├── ComplexEigenSolver.h │ │ ├── ComplexSchur.h │ │ ├── ComplexSchur_LAPACKE.h │ │ ├── EigenSolver.h │ │ ├── GeneralizedEigenSolver.h │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ ├── HessenbergDecomposition.h │ │ ├── MatrixBaseEigenvalues.h │ │ ├── RealQZ.h │ │ ├── RealSchur.h │ │ ├── RealSchur_LAPACKE.h │ │ ├── SelfAdjointEigenSolver.h │ │ ├── SelfAdjointEigenSolver_LAPACKE.h │ │ └── Tridiagonalization.h │ │ ├── Geometry │ │ ├── AlignedBox.h │ │ ├── AngleAxis.h │ │ ├── EulerAngles.h │ │ ├── Homogeneous.h │ │ ├── Hyperplane.h │ │ ├── OrthoMethods.h │ │ ├── ParametrizedLine.h │ │ ├── Quaternion.h │ │ ├── Rotation2D.h │ │ ├── RotationBase.h │ │ ├── Scaling.h │ │ ├── Transform.h │ │ ├── Translation.h │ │ ├── Umeyama.h │ │ └── arch │ │ │ └── Geometry_SSE.h │ │ ├── Householder │ │ ├── BlockHouseholder.h │ │ ├── Householder.h │ │ └── HouseholderSequence.h │ │ ├── IterativeLinearSolvers │ │ ├── BasicPreconditioners.h │ │ ├── BiCGSTAB.h │ │ ├── ConjugateGradient.h │ │ ├── IncompleteCholesky.h │ │ ├── IncompleteLUT.h │ │ ├── IterativeSolverBase.h │ │ ├── LeastSquareConjugateGradient.h │ │ └── SolveWithGuess.h │ │ ├── Jacobi │ │ └── Jacobi.h │ │ ├── LU │ │ ├── Determinant.h │ │ ├── FullPivLU.h │ │ ├── InverseImpl.h │ │ ├── PartialPivLU.h │ │ ├── PartialPivLU_LAPACKE.h │ │ └── arch │ │ │ └── Inverse_SSE.h │ │ ├── MetisSupport │ │ └── MetisSupport.h │ │ ├── OrderingMethods │ │ ├── Amd.h │ │ ├── Eigen_Colamd.h │ │ └── Ordering.h │ │ ├── PaStiXSupport │ │ └── PaStiXSupport.h │ │ ├── PardisoSupport │ │ └── PardisoSupport.h │ │ ├── QR │ │ ├── ColPivHouseholderQR.h │ │ ├── ColPivHouseholderQR_LAPACKE.h │ │ ├── CompleteOrthogonalDecomposition.h │ │ ├── FullPivHouseholderQR.h │ │ ├── HouseholderQR.h │ │ └── HouseholderQR_LAPACKE.h │ │ ├── SPQRSupport │ │ └── SuiteSparseQRSupport.h │ │ ├── SVD │ │ ├── BDCSVD.h │ │ ├── JacobiSVD.h │ │ ├── JacobiSVD_LAPACKE.h │ │ ├── SVDBase.h │ │ └── UpperBidiagonalization.h │ │ ├── SparseCholesky │ │ ├── SimplicialCholesky.h │ │ └── SimplicialCholesky_impl.h │ │ ├── SparseCore │ │ ├── AmbiVector.h │ │ ├── CompressedStorage.h │ │ ├── ConservativeSparseSparseProduct.h │ │ ├── MappedSparseMatrix.h │ │ ├── SparseAssign.h │ │ ├── SparseBlock.h │ │ ├── SparseColEtree.h │ │ ├── SparseCompressedBase.h │ │ ├── SparseCwiseBinaryOp.h │ │ ├── SparseCwiseUnaryOp.h │ │ ├── SparseDenseProduct.h │ │ ├── SparseDiagonalProduct.h │ │ ├── SparseDot.h │ │ ├── SparseFuzzy.h │ │ ├── SparseMap.h │ │ ├── SparseMatrix.h │ │ ├── SparseMatrixBase.h │ │ ├── SparsePermutation.h │ │ ├── SparseProduct.h │ │ ├── SparseRedux.h │ │ ├── SparseRef.h │ │ ├── SparseSelfAdjointView.h │ │ ├── SparseSolverBase.h │ │ ├── SparseSparseProductWithPruning.h │ │ ├── SparseTranspose.h │ │ ├── SparseTriangularView.h │ │ ├── SparseUtil.h │ │ ├── SparseVector.h │ │ ├── SparseView.h │ │ └── TriangularSolver.h │ │ ├── SparseLU │ │ ├── SparseLU.h │ │ ├── SparseLUImpl.h │ │ ├── SparseLU_Memory.h │ │ ├── SparseLU_Structs.h │ │ ├── SparseLU_SupernodalMatrix.h │ │ ├── SparseLU_Utils.h │ │ ├── SparseLU_column_bmod.h │ │ ├── SparseLU_column_dfs.h │ │ ├── SparseLU_copy_to_ucol.h │ │ ├── SparseLU_gemm_kernel.h │ │ ├── SparseLU_heap_relax_snode.h │ │ ├── SparseLU_kernel_bmod.h │ │ ├── SparseLU_panel_bmod.h │ │ ├── SparseLU_panel_dfs.h │ │ ├── SparseLU_pivotL.h │ │ ├── SparseLU_pruneL.h │ │ └── SparseLU_relax_snode.h │ │ ├── SparseQR │ │ └── SparseQR.h │ │ ├── StlSupport │ │ ├── StdDeque.h │ │ ├── StdList.h │ │ ├── StdVector.h │ │ └── details.h │ │ ├── SuperLUSupport │ │ └── SuperLUSupport.h │ │ ├── UmfPackSupport │ │ └── UmfPackSupport.h │ │ ├── misc │ │ ├── Image.h │ │ ├── Kernel.h │ │ ├── RealSvd2x2.h │ │ ├── blas.h │ │ ├── lapack.h │ │ ├── lapacke.h │ │ └── lapacke_mangling.h │ │ └── plugins │ │ ├── ArrayCwiseBinaryOps.h │ │ ├── ArrayCwiseUnaryOps.h │ │ ├── BlockMethods.h │ │ ├── CommonCwiseBinaryOps.h │ │ ├── CommonCwiseUnaryOps.h │ │ ├── MatrixCwiseBinaryOps.h │ │ └── MatrixCwiseUnaryOps.h │ ├── signature_of_eigen3_matrix_library │ └── unsupported │ └── Eigen │ ├── AdolcForward │ ├── AlignedVector3 │ ├── ArpackSupport │ ├── AutoDiff │ ├── BVH │ ├── CXX11 │ ├── Tensor │ ├── TensorSymmetry │ ├── ThreadPool │ └── src │ │ ├── Tensor │ │ ├── Tensor.h │ │ ├── TensorArgMax.h │ │ ├── TensorAssign.h │ │ ├── TensorBase.h │ │ ├── TensorBroadcasting.h │ │ ├── TensorChipping.h │ │ ├── TensorConcatenation.h │ │ ├── TensorContraction.h │ │ ├── TensorContractionBlocking.h │ │ ├── TensorContractionCuda.h │ │ ├── TensorContractionMapper.h │ │ ├── TensorContractionThreadPool.h │ │ ├── TensorConversion.h │ │ ├── TensorConvolution.h │ │ ├── TensorCostModel.h │ │ ├── TensorCustomOp.h │ │ ├── TensorDevice.h │ │ ├── TensorDeviceCuda.h │ │ ├── TensorDeviceDefault.h │ │ ├── TensorDeviceSycl.h │ │ ├── TensorDeviceThreadPool.h │ │ ├── TensorDimensionList.h │ │ ├── TensorDimensions.h │ │ ├── TensorEvalTo.h │ │ ├── TensorEvaluator.h │ │ ├── TensorExecutor.h │ │ ├── TensorExpr.h │ │ ├── TensorFFT.h │ │ ├── TensorFixedSize.h │ │ ├── TensorForcedEval.h │ │ ├── TensorForwardDeclarations.h │ │ ├── TensorFunctors.h │ │ ├── TensorGenerator.h │ │ ├── TensorGlobalFunctions.h │ │ ├── TensorIO.h │ │ ├── TensorImagePatch.h │ │ ├── TensorIndexList.h │ │ ├── TensorInflation.h │ │ ├── TensorInitializer.h │ │ ├── TensorIntDiv.h │ │ ├── TensorLayoutSwap.h │ │ ├── TensorMacros.h │ │ ├── TensorMap.h │ │ ├── TensorMeta.h │ │ ├── TensorMorphing.h │ │ ├── TensorPadding.h │ │ ├── TensorPatch.h │ │ ├── TensorRandom.h │ │ ├── TensorReduction.h │ │ ├── TensorReductionCuda.h │ │ ├── TensorReductionSycl.h │ │ ├── TensorRef.h │ │ ├── TensorReverse.h │ │ ├── TensorScan.h │ │ ├── TensorShuffling.h │ │ ├── TensorStorage.h │ │ ├── TensorStriding.h │ │ ├── TensorSycl.h │ │ ├── TensorSyclConvertToDeviceExpression.h │ │ ├── TensorSyclExprConstructor.h │ │ ├── TensorSyclExtractAccessor.h │ │ ├── TensorSyclExtractFunctors.h │ │ ├── TensorSyclLeafCount.h │ │ ├── TensorSyclPlaceHolderExpr.h │ │ ├── TensorSyclRun.h │ │ ├── TensorSyclTuple.h │ │ ├── TensorTraits.h │ │ ├── TensorUInt128.h │ │ └── TensorVolumePatch.h │ │ ├── TensorSymmetry │ │ ├── DynamicSymmetry.h │ │ ├── StaticSymmetry.h │ │ ├── Symmetry.h │ │ └── util │ │ │ └── TemplateGroupTheory.h │ │ ├── ThreadPool │ │ ├── EventCount.h │ │ ├── NonBlockingThreadPool.h │ │ ├── RunQueue.h │ │ ├── SimpleThreadPool.h │ │ ├── ThreadEnvironment.h │ │ ├── ThreadLocal.h │ │ ├── ThreadPoolInterface.h │ │ └── ThreadYield.h │ │ └── util │ │ ├── CXX11Meta.h │ │ ├── CXX11Workarounds.h │ │ ├── EmulateArray.h │ │ ├── EmulateCXX11Meta.h │ │ └── MaxSizeVector.h │ ├── EulerAngles │ ├── FFT │ ├── IterativeSolvers │ ├── KroneckerProduct │ ├── LevenbergMarquardt │ ├── MPRealSupport │ ├── MatrixFunctions │ ├── MoreVectorization │ ├── NonLinearOptimization │ ├── NumericalDiff │ ├── OpenGLSupport │ ├── Polynomials │ ├── Skyline │ ├── SparseExtra │ ├── SpecialFunctions │ ├── Splines │ └── src │ ├── AutoDiff │ ├── AutoDiffJacobian.h │ ├── AutoDiffScalar.h │ └── AutoDiffVector.h │ ├── BVH │ ├── BVAlgorithms.h │ └── KdBVH.h │ ├── Eigenvalues │ └── ArpackSelfAdjointEigenSolver.h │ ├── EulerAngles │ ├── EulerAngles.h │ └── EulerSystem.h │ ├── FFT │ ├── ei_fftw_impl.h │ └── ei_kissfft_impl.h │ ├── IterativeSolvers │ ├── ConstrainedConjGrad.h │ ├── DGMRES.h │ ├── GMRES.h │ ├── IncompleteLU.h │ ├── IterationController.h │ ├── MINRES.h │ └── Scaling.h │ ├── KroneckerProduct │ └── KroneckerTensorProduct.h │ ├── LevenbergMarquardt │ ├── LMcovar.h │ ├── LMonestep.h │ ├── LMpar.h │ ├── LMqrsolv.h │ └── LevenbergMarquardt.h │ ├── MatrixFunctions │ ├── MatrixExponential.h │ ├── MatrixFunction.h │ ├── MatrixLogarithm.h │ ├── MatrixPower.h │ ├── MatrixSquareRoot.h │ └── StemFunction.h │ ├── MoreVectorization │ └── MathFunctions.h │ ├── NonLinearOptimization │ ├── HybridNonLinearSolver.h │ ├── LevenbergMarquardt.h │ ├── chkder.h │ ├── covar.h │ ├── dogleg.h │ ├── fdjac1.h │ ├── lmpar.h │ ├── qrsolv.h │ ├── r1mpyq.h │ ├── r1updt.h │ └── rwupdt.h │ ├── NumericalDiff │ └── NumericalDiff.h │ ├── Polynomials │ ├── Companion.h │ ├── PolynomialSolver.h │ └── PolynomialUtils.h │ ├── Skyline │ ├── SkylineInplaceLU.h │ ├── SkylineMatrix.h │ ├── SkylineMatrixBase.h │ ├── SkylineProduct.h │ ├── SkylineStorage.h │ └── SkylineUtil.h │ ├── SparseExtra │ ├── BlockOfDynamicSparseMatrix.h │ ├── BlockSparseMatrix.h │ ├── DynamicSparseMatrix.h │ ├── MarketIO.h │ ├── MatrixMarketIterator.h │ └── RandomSetter.h │ ├── SpecialFunctions │ ├── SpecialFunctionsArrayAPI.h │ ├── SpecialFunctionsFunctors.h │ ├── SpecialFunctionsHalf.h │ ├── SpecialFunctionsImpl.h │ ├── SpecialFunctionsPacketMath.h │ └── arch │ │ └── CUDA │ │ └── CudaSpecialFunctions.h │ └── Splines │ ├── Spline.h │ ├── SplineFitting.h │ └── SplineFwd.h └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | */frame*.* 2 | build*/* 3 | *.mat 4 | pngs/* 5 | *.bin 6 | .DS_Store 7 | *.off 8 | -------------------------------------------------------------------------------- /Apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory (SoapFilm3D) 2 | 3 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | append_files (Headers "h" .) 2 | append_files (Sources "cpp" .) 3 | 4 | set(Boost_USE_STATIC_LIBS OFF) 5 | set(Boost_USE_MULTITHREADED ON) 6 | set(Boost_USE_STATIC_RUNTIME OFF) 7 | find_package(Boost 1.45.0) 8 | 9 | if(Boost_FOUND) 10 | include_directories(${Boost_INCLUDE_DIRS}) 11 | set (DEFAULT_LIBRARIES ${DEFAULT_LIBRARIES} ${Boost_LIBRARIES}) 12 | endif() 13 | 14 | find_package(OpenMP) 15 | if (OPENMP_FOUND) 16 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 17 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 18 | set (DEFAULT_LIBRARIES ${DEFAULT_LIBRARIES} ${OpenMP_CXX_LIBRARIES}) 19 | set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") 20 | endif() 21 | 22 | # Locate GLUT 23 | find_package (GLUT REQUIRED glut) 24 | if (GLUT_FOUND) 25 | include_directories (${GLUT_INCLUDE_DIR}) 26 | set (DEFAULT_LIBRARIES ${DEFAULT_LIBRARIES} ${GLUT_glut_LIBRARY}) 27 | else (GLUT_FOUND) 28 | message (SEND_ERROR "Unable to locate GLUT") 29 | endif (GLUT_FOUND) 30 | 31 | find_package(GLEW REQUIRED) 32 | if (GLEW_FOUND) 33 | include_directories(${GLEW_INCLUDE_DIRS}) 34 | set (DEFAULT_LIBRARIES ${DEFAULT_LIBRARIES} ${GLEW_LIBRARIES}) 35 | else (GLEW_FOUND) 36 | message (SEND_ERROR "Unable to locate GLEW") 37 | endif() 38 | 39 | option(NO_SHADER "Build Without Shader" OFF) 40 | 41 | if(NO_SHADER) 42 | add_definitions(-DNO_SHADER) 43 | endif() 44 | 45 | include_directories (${EIGEN_INCLUDE_DIR}) 46 | 47 | add_executable (SoapFilm3D ${Headers} ${Sources}) 48 | target_link_libraries (SoapFilm3D LosTopos ${DEFAULT_LIBRARIES}) 49 | 50 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/Force.cpp: -------------------------------------------------------------------------------- 1 | #include "Force.h" 2 | 3 | Force::~Force() {} 4 | 5 | void Force::preCompute(const VectorXs& x, const VectorXs& v, const VectorXs& m, 6 | const scalar& dt) {} -------------------------------------------------------------------------------- /Apps/SoapFilm3D/Force.h: -------------------------------------------------------------------------------- 1 | #ifndef __FORCE_H__ 2 | #define __FORCE_H__ 3 | 4 | #include 5 | 6 | #include "MathDefs.h" 7 | 8 | class Force { 9 | public: 10 | virtual ~Force(); 11 | 12 | virtual void addEnergyToTotal(const VectorXs& x, const VectorXs& v, 13 | const VectorXs& m, scalar& E) = 0; 14 | 15 | virtual void addGradEToTotal(const VectorXs& x, const VectorXs& v, 16 | const VectorXs& m, VectorXs& gradE) = 0; 17 | 18 | virtual void addHessXToTotal(const VectorXs& x, const VectorXs& v, 19 | const VectorXs& m, TripletXs& hessE) = 0; 20 | 21 | virtual void addHessVToTotal(const VectorXs& x, const VectorXs& v, 22 | const VectorXs& m, TripletXs& hessE) = 0; 23 | 24 | virtual Force* createNewCopy() = 0; 25 | 26 | virtual void preCompute(const VectorXs& x, const VectorXs& v, 27 | const VectorXs& m, const scalar& dt); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/LinearBendingForce.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINEAR_BENDING_FORCE_H__ 2 | #define __LINEAR_BENDING_FORCE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include "Force.h" 8 | 9 | class LinearBendingForce : public Force { 10 | public: 11 | LinearBendingForce(int idx1, int idx2, int idx3, const scalar& alpha, 12 | const scalar& beta, const Vector2s& theta0, 13 | const scalar& eb1n, const scalar& eb2n); 14 | 15 | virtual ~LinearBendingForce(); 16 | 17 | virtual void addEnergyToTotal(const VectorXs& x, const VectorXs& v, 18 | const VectorXs& m, scalar& E); 19 | 20 | virtual void addGradEToTotal(const VectorXs& x, const VectorXs& v, 21 | const VectorXs& m, VectorXs& gradE); 22 | 23 | virtual void addHessXToTotal(const VectorXs& x, const VectorXs& v, 24 | const VectorXs& m, TripletXs& hessE); 25 | 26 | virtual void addHessVToTotal(const VectorXs& x, const VectorXs& v, 27 | const VectorXs& m, TripletXs& hessE); 28 | 29 | virtual Force* createNewCopy(); 30 | 31 | virtual void preCompute(const VectorXs& x, const VectorXs& v, 32 | const VectorXs& m, const scalar& dt); 33 | 34 | private: 35 | int m_idx1; 36 | int m_idx2; 37 | int m_idx3; 38 | 39 | Matrix3s m_R; // rotation matrix 40 | 41 | scalar m_alpha; // stiffness coefficient 42 | scalar m_beta; // damping coefficient 43 | Vector2s m_theta0; // rest angle 44 | scalar m_eb1n; // norm of e1 bar 45 | scalar m_eb2n; // norm of e2 bar 46 | 47 | Vector3s m_x1; 48 | Vector3s m_x2; 49 | Vector3s m_x3; 50 | 51 | Vector3s m_L0; 52 | 53 | Vector3s m_RL0; 54 | 55 | scalar m_c1; 56 | scalar m_c2; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/LinearizedImplicitEuler.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINEARIZED_IMPLICIT_EULER__ 2 | #define __LINEARIZED_IMPLICIT_EULER__ 3 | 4 | #include 5 | #include 6 | 7 | #include "SceneStepper.h" 8 | 9 | class LinearizedImplicitEuler : public SceneStepper { 10 | public: 11 | LinearizedImplicitEuler(); 12 | 13 | virtual ~LinearizedImplicitEuler(); 14 | 15 | virtual bool stepScene(VS3D& scene, scalar dt); 16 | 17 | virtual std::string getName() const; 18 | 19 | private: 20 | void zeroFixedDoFs(const VS3D& scene, VectorXs& vec); 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/MeshIO.h: -------------------------------------------------------------------------------- 1 | // 2 | // MeshIO.h 3 | // 4 | // Christopher Batty, Fang Da 2014 5 | // 6 | // 7 | 8 | #ifndef __MeshIO__ 9 | #define __MeshIO__ 10 | 11 | #include 12 | #include 13 | 14 | #include "VS3D.h" 15 | #include "surftrack.h" 16 | 17 | class MeshIO { 18 | public: 19 | static bool save(VS3D& vs, const std::string& filename, bool binary = true); 20 | static bool load(VS3D& vs, const std::string& filename, bool binary = true); 21 | 22 | static bool loadIntoRaw(std::vector& vs, 23 | std::vector& fs, 24 | std::vector& ls, 25 | const std::string& filename, bool binary = true); 26 | 27 | static bool saveOBJ(VS3D& vs, const std::string& filename); 28 | }; 29 | 30 | #endif /* defined(__MeshIO__) */ 31 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/PR.frag: -------------------------------------------------------------------------------- 1 | // 2 | // PR.frag 3 | 4 | // precision mediump float; 5 | 6 | uniform sampler2D u_tex_depth; 7 | uniform samplerCube u_tex_env; 8 | 9 | uniform mat4 u_mat_mvp; 10 | uniform mat4 u_mat_mv; 11 | 12 | uniform vec3 u_light_direction; 13 | uniform vec4 u_light_diffuse; 14 | uniform vec4 u_light_ambient; 15 | uniform vec4 u_light_specular; 16 | uniform float u_light_specularity; 17 | uniform vec3 u_camera_pos; 18 | uniform float u_ssao_coef; 19 | 20 | uniform vec3 u_ssao_samples[128]; 21 | 22 | varying vec4 v_position_world; 23 | // varying vec4 v_position_clip; 24 | varying vec3 v_normal; 25 | 26 | void main() { 27 | vec3 normal = normalize(v_normal); 28 | 29 | // phong shading 30 | vec4 shading_diffuse = 31 | u_light_diffuse * clamp(dot(normal, -u_light_direction), 0.0, 1.0); 32 | 33 | vec3 viewvec = normalize(u_camera_pos - v_position_world.xyz); 34 | vec3 lightvec = -u_light_direction; 35 | vec3 halfway = normalize(viewvec + lightvec); 36 | vec4 shading_specular = 37 | u_light_specular * 38 | pow(clamp(dot(halfway, normal), 0.0, 1.0), u_light_specularity); 39 | 40 | vec4 shading_ambient = vec4(0.3, 0.3, 0.3, 0.3); 41 | 42 | // env map reflection 43 | vec3 reflectiondir = reflect(-viewvec, normal); 44 | vec4 reflection = textureCube(u_tex_env, reflectiondir); 45 | 46 | // fresnel effect 47 | float angle = abs(dot(viewvec, normal)); 48 | float alpha = 0.3 + 0.9 * pow(1.0 - angle, 2.0); 49 | 50 | // gl_FragColor = (shading_diffuse * 0.6 + shading_specular * 0.5 + 51 | // shading_ambient) * 0.3 + reflection * 0.7;; 52 | gl_FragColor = vec4(reflection.xyz * 1.5, alpha); 53 | // gl_FragColor = vec4(alpha, 0.0, 0.0, 1.0); 54 | } 55 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/PR.vert: -------------------------------------------------------------------------------- 1 | // 2 | // PR.vert 3 | 4 | // precision mediump float; 5 | 6 | attribute vec4 a_position; 7 | attribute vec3 a_normal; 8 | 9 | uniform mat4 u_mat_mvp; 10 | uniform mat4 u_mat_mv; 11 | 12 | varying vec4 v_position_world; 13 | // varying vec4 v_position_clip; 14 | varying vec3 v_normal; 15 | 16 | void main() { 17 | v_position_world = a_position; 18 | v_normal = a_normal; 19 | 20 | gl_Position = u_mat_mvp * a_position; 21 | // v_position_clip = gl_Position / gl_Position.w; 22 | } 23 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/PRRenderer.h: -------------------------------------------------------------------------------- 1 | // 2 | // PRRenderer.h 3 | // MultiTracker 4 | // 5 | // Created by Fang Da on 1/15/15. 6 | // 7 | // 8 | 9 | #ifndef __MultiTracker__PRRenderer__ 10 | #define __MultiTracker__PRRenderer__ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "VS3D.h" 17 | #ifdef __APPLE__ 18 | #include 19 | #include 20 | #include 21 | #else 22 | #ifdef _MSC_VER 23 | #define NOMINMAX 24 | #include 25 | #include 26 | #else 27 | #include 28 | #endif 29 | #include 30 | #include 31 | #include 32 | 33 | #endif 34 | #include "Shader.h" 35 | 36 | class PRRenderer { 37 | public: 38 | PRRenderer(VS3D* vs); 39 | 40 | public: 41 | void render(); 42 | 43 | protected: 44 | LosTopos::NonDestructiveTriMesh& mesh() { return m_vs->mesh(); } 45 | 46 | bool create_cube_map(GLuint& tex); 47 | bool load_cube_map_side(GLuint tex, GLenum side, const unsigned char* content, 48 | unsigned int content_size); 49 | 50 | protected: 51 | VS3D* m_vs; 52 | Shader m_shader_bubble; 53 | Shader m_shader_env; 54 | GLuint m_tex_env; 55 | }; 56 | 57 | #endif /* defined(__MultiTracker__PRRenderer__) */ 58 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/SceneStepper.cpp: -------------------------------------------------------------------------------- 1 | #include "SceneStepper.h" 2 | 3 | SceneStepper::~SceneStepper() {} 4 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/SceneStepper.h: -------------------------------------------------------------------------------- 1 | #ifndef __SCENE_STEPPER__ 2 | #define __SCENE_STEPPER__ 3 | 4 | #include "MathDefs.h" 5 | 6 | class VS3D; 7 | 8 | class SceneStepper { 9 | public: 10 | virtual ~SceneStepper(); 11 | 12 | virtual bool stepScene(VS3D& scene, scalar dt) = 0; 13 | 14 | virtual std::string getName() const = 0; 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/Sim.h: -------------------------------------------------------------------------------- 1 | // 2 | // Sim.h 3 | // 4 | // Fang Da 2014 5 | // 6 | // 7 | 8 | #ifndef __Sim__ 9 | #define __Sim__ 10 | 11 | #include 12 | #include 13 | 14 | #include "PRRenderer.h" 15 | #include "Scenes.h" 16 | #include "VS3D.h" 17 | 18 | class Sim { 19 | friend class Scenes; 20 | 21 | public: 22 | Sim(bool verbose); 23 | ~Sim(); 24 | 25 | VS3D* vs() { return m_vs; } 26 | 27 | public: 28 | bool init(const std::string& option_file, bool save_outputs, bool headless); 29 | 30 | public: 31 | void step(); 32 | void stepOutput(bool headless); 33 | bool isFinished() const { return m_finished; } 34 | 35 | double dt() const { return m_dt; } 36 | double time() const { return m_time; } 37 | 38 | bool load(int inc = 1); 39 | 40 | public: 41 | enum RenderMode { 42 | RM_TRANSPARENT, 43 | RM_NONMANIFOLD, 44 | RM_PR, 45 | 46 | RM_COUNT 47 | }; 48 | 49 | static const int SM_VERTEX = 0x01; 50 | static const int SM_EDGE = 0x02; 51 | static const int SM_FACE = 0x04; 52 | void render(RenderMode rm, const Vec2d& mousepos, 53 | int selection_mask = SM_VERTEX | SM_EDGE | SM_FACE); 54 | 55 | void showPrimitiveInfo(); 56 | 57 | protected: 58 | bool m_verbose; 59 | 60 | std::string m_scene; 61 | std::string m_output_directory; 62 | std::string m_load_directory; 63 | 64 | VS3D* m_vs; 65 | 66 | double m_dt; 67 | double m_time; 68 | int m_frameid; 69 | bool m_finished; 70 | 71 | int m_nearest_vertex; 72 | int m_nearest_edge; 73 | int m_nearest_face; 74 | 75 | PRRenderer* m_prrenderer; 76 | }; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/SimOptions.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimOptions.h 3 | // 4 | // Christopher Batty, Fang Da 2014 5 | // 6 | // 7 | 8 | #ifndef __SimOptions__ 9 | #define __SimOptions__ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | class Options { 16 | public: 17 | enum Type { 18 | STRING, 19 | INTEGER, 20 | DOUBLE, 21 | BOOLEAN, 22 | 23 | TYPE_COUNT 24 | }; 25 | 26 | public: 27 | // option data: key, value, value type 28 | static void addStringOption(const std::string& key, 29 | const std::string& default_value); 30 | static void addIntegerOption(const std::string& key, int defaut_value); 31 | static void addDoubleOption(const std::string& key, double default_value); 32 | static void addBooleanOption(const std::string& key, bool default_value); 33 | 34 | static bool parseOptionFile(const std::string& file, bool verbose = false); 35 | 36 | static const std::string& strValue(const std::string& key); 37 | static int intValue(const std::string& key); 38 | static double doubleValue(const std::string& key); 39 | static bool boolValue(const std::string& key); 40 | 41 | protected: 42 | class Option { 43 | public: 44 | std::string key; 45 | Type type; 46 | 47 | std::string str_value; 48 | int int_value; 49 | double double_value; 50 | bool bool_value; 51 | }; 52 | 53 | static std::map s_options; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/SimpleGravityForce.cpp: -------------------------------------------------------------------------------- 1 | #include "SimpleGravityForce.h" 2 | 3 | SimpleGravityForce::SimpleGravityForce(const Vector3s& gravity) 4 | : Force(), m_gravity(gravity) { 5 | assert((m_gravity.array() == m_gravity.array()).all()); 6 | assert((m_gravity.array() != std::numeric_limits::infinity()).all()); 7 | } 8 | 9 | SimpleGravityForce::~SimpleGravityForce() {} 10 | 11 | void SimpleGravityForce::addEnergyToTotal(const VectorXs& x, const VectorXs& v, 12 | const VectorXs& m, scalar& E) { 13 | assert(x.size() == v.size()); 14 | assert(x.size() == m.size()); 15 | assert(x.size() % 3 == 0); 16 | 17 | // Assume 0 potential is at origin 18 | for (int i = 0; i < x.size() / 3; ++i) 19 | E -= m(3 * i) * m_gravity.dot(x.segment<3>(3 * i)); 20 | } 21 | 22 | void SimpleGravityForce::addGradEToTotal(const VectorXs& x, const VectorXs& v, 23 | const VectorXs& m, VectorXs& gradE) { 24 | assert(x.size() == v.size()); 25 | assert(x.size() == m.size()); 26 | assert(x.size() == gradE.size()); 27 | assert(x.size() % 3 == 0); 28 | 29 | for (int i = 0; i < x.size() / 3; ++i) 30 | gradE.segment<3>(3 * i) -= m(3 * i) * m_gravity; 31 | } 32 | 33 | void SimpleGravityForce::addHessXToTotal(const VectorXs& x, const VectorXs& v, 34 | const VectorXs& m, TripletXs& hessE) { 35 | assert(x.size() == v.size()); 36 | assert(x.size() == m.size()); 37 | assert(x.size() % 3 == 0); 38 | // Nothing to do. 39 | } 40 | 41 | void SimpleGravityForce::addHessVToTotal(const VectorXs& x, const VectorXs& v, 42 | const VectorXs& m, TripletXs& hessE) { 43 | assert(x.size() == v.size()); 44 | assert(x.size() == m.size()); 45 | assert(x.size() % 3 == 0); 46 | // Nothing to do. 47 | } 48 | 49 | Force* SimpleGravityForce::createNewCopy() { 50 | return new SimpleGravityForce(*this); 51 | } 52 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/SimpleGravityForce.h: -------------------------------------------------------------------------------- 1 | #ifndef __SIMPLE_GRAVITY_FORCE_H__ 2 | #define __SIMPLE_GRAVITY_FORCE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include "Force.h" 8 | 9 | class SimpleGravityForce : public Force { 10 | public: 11 | SimpleGravityForce(const Vector3s& gravity); 12 | 13 | virtual ~SimpleGravityForce(); 14 | 15 | virtual void addEnergyToTotal(const VectorXs& x, const VectorXs& v, 16 | const VectorXs& m, scalar& E); 17 | 18 | virtual void addGradEToTotal(const VectorXs& x, const VectorXs& v, 19 | const VectorXs& m, VectorXs& gradE); 20 | 21 | virtual void addHessXToTotal(const VectorXs& x, const VectorXs& v, 22 | const VectorXs& m, TripletXs& hessE); 23 | 24 | virtual void addHessVToTotal(const VectorXs& x, const VectorXs& v, 25 | const VectorXs& m, TripletXs& hessE); 26 | 27 | virtual Force* createNewCopy(); 28 | 29 | private: 30 | Vector3s m_gravity; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/SpringForce.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPRING_FORCE_H__ 2 | #define __SPRING_FORCE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include "Force.h" 8 | 9 | class SpringForce : public Force { 10 | public: 11 | SpringForce(const std::pair& endpoints, const scalar& k, 12 | const scalar& l0, const scalar& b = 0.0); 13 | 14 | virtual ~SpringForce(); 15 | 16 | virtual void addEnergyToTotal(const VectorXs& x, const VectorXs& v, 17 | const VectorXs& m, scalar& E); 18 | 19 | virtual void addGradEToTotal(const VectorXs& x, const VectorXs& v, 20 | const VectorXs& m, VectorXs& gradE); 21 | 22 | virtual void addHessXToTotal(const VectorXs& x, const VectorXs& v, 23 | const VectorXs& m, TripletXs& hessE); 24 | 25 | virtual void addHessVToTotal(const VectorXs& x, const VectorXs& v, 26 | const VectorXs& m, TripletXs& hessE); 27 | 28 | virtual Force* createNewCopy(); 29 | 30 | private: 31 | std::pair m_endpoints; 32 | scalar m_k; 33 | scalar m_l0; 34 | scalar m_b; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/VertexAreaForce.h: -------------------------------------------------------------------------------- 1 | #ifndef __VERTEX_AREA_FORCE_H__ 2 | #define __VERTEX_AREA_FORCE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include "Force.h" 8 | 9 | class VS3D; 10 | 11 | class VertexAreaForce : public Force { 12 | public: 13 | VertexAreaForce(VS3D* parent, const scalar& k); 14 | 15 | virtual ~VertexAreaForce(); 16 | 17 | virtual void addEnergyToTotal(const VectorXs& x, const VectorXs& v, 18 | const VectorXs& m, scalar& E); 19 | 20 | virtual void addGradEToTotal(const VectorXs& x, const VectorXs& v, 21 | const VectorXs& m, VectorXs& gradE); 22 | 23 | virtual void addHessXToTotal(const VectorXs& x, const VectorXs& v, 24 | const VectorXs& m, TripletXs& hessE); 25 | 26 | virtual void addHessVToTotal(const VectorXs& x, const VectorXs& v, 27 | const VectorXs& m, TripletXs& hessE); 28 | 29 | virtual Force* createNewCopy(); 30 | 31 | private: 32 | VS3D* m_parent; 33 | scalar m_stiffness; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/eigenheaders.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // eigenheaders.cpp 3 | // MultiTracker 4 | // 5 | // Created by Fang Da on 10/27/14. 6 | // 7 | // 8 | 9 | #include "eigenheaders.h" 10 | 11 | Vec3d vc(const LosTopos::Vec3d& v) { return Vec3d(v[0], v[1], v[2]); } 12 | 13 | LosTopos::Vec3d vc(const Vec3d& v) { return LosTopos::Vec3d(v[0], v[1], v[2]); } 14 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/eigenheaders.h: -------------------------------------------------------------------------------- 1 | // 2 | // eigenheaders.h 3 | // MultiTracker 4 | // 5 | // Created by Fang Da on 10/24/14. 6 | // 7 | // 8 | 9 | #ifndef MultiTracker_eigenheaders_h 10 | #define MultiTracker_eigenheaders_h 11 | 12 | #include 13 | #include 14 | 15 | #include "surftrack.h" 16 | 17 | typedef Eigen::Matrix Mat4d; 18 | typedef Eigen::Matrix Mat3d; 19 | typedef Eigen::Matrix MatXd; 20 | typedef Eigen::Matrix Vec4d; 21 | typedef Eigen::Matrix Vec3d; 22 | typedef Eigen::Matrix Vec2d; 23 | typedef Eigen::Matrix VecXd; 24 | 25 | typedef Eigen::Matrix Vec3i; 26 | typedef Eigen::Matrix Vec2i; 27 | 28 | Vec3d vc(const LosTopos::Vec3d& v); 29 | LosTopos::Vec3d vc(const Vec3d& v); 30 | 31 | class Vec2iComp { 32 | public: 33 | bool operator()(const Vec2i& v1, const Vec2i& v2) const { 34 | return v1[0] < v2[0] || (v1[0] == v2[0] && v1[1] < v2[1]); 35 | } 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/env.frag: -------------------------------------------------------------------------------- 1 | // 2 | // env.frag 3 | 4 | // precision mediump float; 5 | 6 | uniform samplerCube u_tex_env; 7 | 8 | uniform mat4 u_mat_mvp; 9 | uniform vec3 u_camera_pos; 10 | 11 | varying vec4 v_position_world; 12 | 13 | void main() { 14 | vec3 viewvec = v_position_world.xyz / v_position_world.w - u_camera_pos; 15 | gl_FragColor = textureCube(u_tex_env, viewvec); 16 | } 17 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/env.vert: -------------------------------------------------------------------------------- 1 | // 2 | // env.vert 3 | 4 | // precision mediump float; 5 | 6 | attribute vec4 a_position; 7 | 8 | uniform mat4 u_mat_mvp; 9 | 10 | varying vec4 v_position_world; 11 | 12 | void main() { 13 | v_position_world = a_position; 14 | 15 | gl_Position = u_mat_mvp * a_position; 16 | } 17 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/Kernel.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** @file Kernel 3 | * 4 | * CRTP base classes for Kernels. 5 | * This allows the future extension of Kernels with methods that 6 | * need not be implemented within the Kernel. 7 | * Additionally, the traits system could be incorporated here to give the 8 | * library improved access and insight to these classes. 9 | * 10 | * At the moment, these may not be fully necessary and are subject to change. 11 | */ 12 | 13 | #include "fmmtl/config.hpp" 14 | 15 | #include "fmmtl/dispatch/S2T/S2T_Compressed.hpp" 16 | 17 | namespace fmmtl { 18 | 19 | 20 | template 21 | struct Kernel { 22 | // TODO: Do the template instantiations for linking automatically...? 23 | // TODO: Vectorized and/or GPU evaluations for Kernels? 24 | }; 25 | 26 | // Template instantiations for external compilation and linking 27 | // TODO: Remove? 28 | #define FMMTL_KERNEL_EXTRAS(kernel) template class S2T_Compressed 29 | 30 | } // end namespace fmmtl 31 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Kludge for nvcc with g++-4.6 and boost 4 | #if defined(__CUDACC__) 5 | # define BOOST_NOINLINE __attribute__ ((noinline)) 6 | #endif 7 | // Whole suite of system configuration flags 8 | #include 9 | #include 10 | 11 | #if defined(__CUDACC__) 12 | # define FMMTL_WITH_CUDA 13 | #endif 14 | 15 | // FMMTL_INLINE 16 | #if defined(__CUDACC__) // Compiling with nvcc 17 | # define FMMTL_INLINE __host__ __device__ inline 18 | #else // Not compiling with nvcc 19 | # define FMMTL_INLINE inline 20 | #endif 21 | 22 | #if defined(FMMTL_WITH_CUDA) // Enable CUDA/Thrust accleration 23 | # include 24 | # if (THRUST_VERSION < 100700) 25 | # error Need Thrust v1.7. Please upgrade to CUDA 5.5. 26 | # endif 27 | #endif 28 | 29 | // Enable performance options in NDEBUG mode 30 | #if defined(FMMTL_NDEBUG) || defined(NDEBUG) 31 | # define FMMTL_DISABLE_ASSERTS 32 | # define FMMTL_DISABLE_CUDA_CHECKS 33 | #endif 34 | 35 | // Disable performance options in DEBUG mode 36 | #if defined(FMMTL_DEBUG) 37 | # undef FMMTL_DISABLE_ASSERTS 38 | # undef FMMTL_DISABLE_CUDA_CHECKS 39 | #endif 40 | 41 | // FMMTL_ASSERT 42 | #undef FMMTL_ASSERT 43 | #if defined(FMMTL_DISABLE_ASSERTS) 44 | # define FMMTL_ASSERT(expr) ((void)0) 45 | #else 46 | # include 47 | # define FMMTL_ASSERT(expr) assert(expr) 48 | #endif 49 | // FMMTL_STATIC_ASSERT (for C++03 regions) 50 | #include 51 | #define FMMTL_STATIC_ASSERT BOOST_STATIC_ASSERT_MSG 52 | 53 | // FMMTL_CUDA_CHECK 54 | #undef FMMTL_CUDA_CHECK 55 | #if !defined(FMMTL_WITH_CUDA) || defined(FMMTL_DISABLE_CUDA_CHECKS) 56 | # define FMMTL_CUDA_CHECK ((void)0) 57 | #else 58 | # include 59 | # include 60 | inline void cuda_check(const char* file, int line) { 61 | cudaError_t error = cudaDeviceSynchronize(); 62 | if (error != cudaSuccess) { 63 | std::cerr << "CUDA assert:" 64 | << " " << cudaGetErrorString(error) 65 | << " " << file 66 | << ":" << line 67 | << std::endl;; 68 | exit(error); 69 | } 70 | } 71 | # define FMMTL_CUDA_CHECK cuda_check(__FILE__, __LINE__) 72 | #endif 73 | 74 | // Load OpenMP support if available 75 | #if defined(_OPENMP) 76 | # include 77 | #else 78 | typedef int omp_int_t; 79 | inline omp_int_t omp_get_thread_num() { return 0;} 80 | inline omp_int_t omp_get_max_threads() { return 1;} 81 | #endif 82 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/dispatch/Dispatchers.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "INITM.hpp" 4 | #include "INITL.hpp" 5 | 6 | #include "S2T.hpp" 7 | #include "S2M.hpp" 8 | #include "S2L.hpp" 9 | #include "M2T.hpp" 10 | #include "M2M.hpp" 11 | #include "M2L.hpp" 12 | #include "L2T.hpp" 13 | #include "L2L.hpp" 14 | 15 | #include "MAC.hpp" 16 | 17 | #include "BatchFar.hpp" 18 | #include "BatchNear.hpp" 19 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/dispatch/MAC.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** @file MAC.hpp 3 | * @brief Dispatch methods for the Multipole Acceptance Criteria 4 | */ 5 | 6 | #include 7 | 8 | #include "fmmtl/util/Logger.hpp" 9 | #include "fmmtl/meta/kernel_traits.hpp" 10 | 11 | class MAC { 12 | /** If no other MAC dispatcher matches */ 13 | template 14 | inline static 15 | typename std::enable_if::has_dynamic_MAC, bool>::type 16 | eval_mac(const Context& c, 17 | const typename Context::source_box_type& sbox, 18 | const typename Context::target_box_type& tbox) { 19 | return c.mac(sbox,tbox); 20 | } 21 | 22 | template 23 | inline static 24 | typename std::enable_if::has_dynamic_MAC, bool>::type 25 | eval_mac(const Context& c, 26 | const typename Context::source_box_type& sbox, 27 | const typename Context::target_box_type& tbox) { 28 | return c.mac(sbox,tbox) && c.expansion().MAC(c.multipole(sbox), c.local(tbox)); 29 | } 30 | 31 | public: 32 | 33 | /** Unwrap data from Context and dispatch to the MAC evaluator 34 | */ 35 | template 36 | inline static bool eval(Context& c, 37 | const typename Context::source_box_type& sbox, 38 | const typename Context::target_box_type& tbox) 39 | { 40 | #if defined(FMMTL_DEBUG) 41 | std::cout << "MAC:" 42 | << "\n " << sbox 43 | << "\n " << tbox << std::endl; 44 | #endif 45 | FMMTL_LOG("MAC"); 46 | 47 | return MAC::eval_mac(c, sbox, tbox); 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/dispatch/S2P.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** @file S2P.hpp 3 | * @brief Dispatch methods for the S2P stage 4 | * 5 | */ 6 | 7 | #include 8 | 9 | #include "fmmtl/util/Logger.hpp" 10 | #include "fmmtl/meta/kernel_traits.hpp" 11 | 12 | /** Default behavior is no-op, but check for convertibility at compile-time */ 13 | template ::has_S2P> 14 | struct S2P_Functor; 15 | 16 | /** No S2P operator, default to no-op */ 17 | template 18 | struct S2P_Functor { 19 | S2P_Functor(const E&) {} 20 | inline const typename ExpansionTraits::source_type& 21 | operator()(const typename ExpansionTraits::source_type& source) const { 22 | // No S2P operator, make sure the types are convertible 23 | FMMTL_STATIC_ASSERT( 24 | std::is_convertible::source_type, 25 | typename ExpansionTraits::point_type>::value, 26 | "source_type is not convertible to point_type and no S2P provided!"); 27 | 28 | return source; 29 | } 30 | }; 31 | 32 | template 33 | struct S2P_Functor { 34 | S2P_Functor(const E& e) : e_(e) {} 35 | inline typename ExpansionTraits::point_type 36 | operator()(const typename ExpansionTraits::source_type& source) const { 37 | return e_.S2P(source); 38 | } 39 | private: 40 | const E& e_; 41 | }; 42 | 43 | template 44 | inline S2P_Functor S2P(const Expansion& e) { 45 | return S2P_Functor(e); 46 | } 47 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/dispatch/S2T/S2T_Compressed.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "fmmtl/dispatch/S2T/S2T_Compressed.hpp" 6 | 7 | template 8 | S2T_Compressed::S2T_Compressed() { 9 | } 10 | 11 | template 12 | S2T_Compressed::S2T_Compressed( 13 | std::vector >&, 14 | std::vector&, 15 | std::vector >&, 16 | const std::vector&, 17 | const std::vector&) { 18 | } 19 | 20 | template 21 | S2T_Compressed::~S2T_Compressed() { 22 | // TODO: delete 23 | } 24 | 25 | template 26 | void S2T_Compressed::execute( 27 | const Kernel&, 28 | const std::vector&, 29 | std::vector&) { 30 | std::cerr << "ERROR: Calling unimplemented S2T_compressed CPU" << std::endl; 31 | } 32 | 33 | template 34 | void S2T_Compressed::execute( 35 | const Kernel&, 36 | const std::vector&, 37 | const std::vector&, 38 | const std::vector&, 39 | std::vector&) { 40 | std::cerr << "ERROR: Calling unimplemented S2T_compressed CPU" << std::endl; 41 | } 42 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/dispatch/T2P.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** @file T2P.hpp 3 | * @brief Dispatch methods for the T2P stage 4 | * 5 | */ 6 | 7 | #include 8 | 9 | #include "fmmtl/util/Logger.hpp" 10 | #include "fmmtl/meta/kernel_traits.hpp" 11 | 12 | /** Default behavior is no-op, but check for convertibility at compile-time */ 13 | template ::has_T2P> 14 | struct T2P_Functor; 15 | 16 | /** No T2P operator, default to no-op */ 17 | template 18 | struct T2P_Functor { 19 | T2P_Functor(const E&) {} 20 | inline const typename ExpansionTraits::target_type& 21 | operator()(const typename ExpansionTraits::target_type& target) const { 22 | // No T2P operator, make sure the types are convertible 23 | FMMTL_STATIC_ASSERT( 24 | std::is_convertible::target_type, 25 | typename ExpansionTraits::point_type>::value, 26 | "target_type is not convertible to point_type and no T2P provided!"); 27 | 28 | return target; 29 | } 30 | }; 31 | 32 | template 33 | struct T2P_Functor { 34 | T2P_Functor(const E& e) : e_(e) {} 35 | inline typename ExpansionTraits::point_type 36 | operator()(const typename ExpansionTraits::target_type& target) const { 37 | return e_.T2P(target); 38 | } 39 | private: 40 | const E& e_; 41 | }; 42 | 43 | template 44 | inline T2P_Functor T2P(const Expansion& e) { 45 | return T2P_Functor(e); 46 | } 47 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/executor/Evaluator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // Don't think this needs to be virtual... 6 | template 7 | struct EvaluatorBase { 8 | virtual ~EvaluatorBase() {}; 9 | virtual void execute(Context&) = 0; 10 | }; 11 | 12 | 13 | template 14 | class EvaluatorCollection 15 | : public EvaluatorBase { 16 | typedef Context context_type; 17 | 18 | //! Evaluator algorithms to apply 19 | std::vector*> evals_; 20 | 21 | public: 22 | 23 | virtual ~EvaluatorCollection() { 24 | for (auto eval : evals_) 25 | delete eval; 26 | } 27 | 28 | void insert(EvaluatorBase* eval) { 29 | if (eval) 30 | evals_.push_back(eval); 31 | } 32 | 33 | void execute(context_type& context) const { 34 | for (auto eval : evals_) 35 | eval->execute(context); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/executor/make_executor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fmmtl/executor/EvalLists.hpp" 4 | #include "fmmtl/executor/EvalTraverse.hpp" 5 | 6 | #include "fmmtl/meta/kernel_traits.hpp" 7 | 8 | template 9 | EvaluatorBase* make_evaluator(Context& c, Options& opts) { 10 | // Determine the type of Evaluator 11 | // Statically from the type of Options 12 | // Dynamically from the Options input 13 | 14 | // For now 15 | if (ExpansionTraits::has_dynamic_MAC) 16 | return make_eval_traverse(c, opts); 17 | else 18 | return make_eval_lists(c, opts); 19 | } 20 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/meta/dimension.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace fmmtl { 4 | 5 | template 6 | struct dimension; 7 | 8 | template <> 9 | struct dimension { 10 | const static std::size_t value = 1; 11 | }; 12 | 13 | template <> 14 | struct dimension { 15 | const static std::size_t value = 1; 16 | }; 17 | 18 | } // end namepsace fmmtl 19 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/meta/func_traits.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* @class : HAS_TYPEDEF 4 | * @brief : This macro may be used to check if a class has a public typedef 5 | * @param NAME : Name of struct this macro creates. 6 | * @param TYPEDEF : Name of typedef to test for. 7 | * @note This macro is C++03 compatible 8 | */ 9 | #define HAS_TYPEDEF(NAME, TYPEDEF) \ 10 | template \ 11 | struct NAME { \ 12 | template static char chk(U::TYPEDEF*); \ 13 | template static long chk(...); \ 14 | static const bool value = sizeof(chk(0)) == sizeof(char); \ 15 | } 16 | 17 | /* @class : HAS_MEM_FUNC 18 | * @brief : This macro may be used to check if a class has a public 19 | * const member function with particular signature. 20 | * @param NAME : Name of struct this macro creates. 21 | * @param RETURN_TYPE : Return type of the member function to test for. 22 | * @param FUNC : Name of member function to test for. 23 | * @param (...) : The argument types of the member function to test for. 24 | * These complete the signature of the member funtion. 25 | * @note This macro is C++03 compatible 26 | */ 27 | #define HAS_MEM_FUNC(NAME, RETURN_TYPE, FUNC, ...) \ 28 | template \ 29 | struct NAME { \ 30 | typedef RETURN_TYPE (CLASS::*A)(__VA_ARGS__) const; \ 31 | template struct type_check; \ 32 | template static char chk(type_check*); \ 33 | template static long chk(...); \ 34 | static bool const value = sizeof(chk(0)) == sizeof(char); \ 35 | } 36 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/meta/functional.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace fmmtl { 4 | 5 | // Identity function object 6 | struct identity { 7 | template 8 | constexpr auto operator()(T&& v) const noexcept 9 | -> decltype(std::forward(v)) { 10 | return std::forward(v); 11 | } 12 | }; 13 | 14 | // Null function object 15 | struct nullop { 16 | template 17 | constexpr void operator()(T&&) const noexcept {} 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/meta/integer_range.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** Index range generation 4 | * TODO: Use C++14 std::integer_sequence 5 | */ 6 | template 7 | struct integer_sequence {}; 8 | template 9 | using index_sequence = integer_sequence; 10 | 11 | template 12 | struct generate_integer_sequence { 13 | using type = typename generate_integer_sequence::type; 14 | }; 15 | template 16 | struct generate_integer_sequence { 17 | using type = integer_sequence; 18 | }; 19 | 20 | template 21 | using make_integer_sequence = typename generate_integer_sequence::type; 22 | template 23 | using make_index_sequence = make_integer_sequence; 24 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/meta/math.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** @file math.hpp 3 | * A collection of constexpr math operations. 4 | */ 5 | 6 | namespace fmmtl { 7 | 8 | // Greatest common divisor 9 | template 10 | constexpr T gcd(const T& x, const T& y) { 11 | return ((x%y) == 0) ? y : gcd(y,x%y); 12 | } 13 | 14 | // Sum 15 | template 16 | constexpr const T& sum(const T& n) { 17 | return n; 18 | } 19 | template 20 | constexpr T sum(const T& n, More... ns) { 21 | return n + sum(ns...); 22 | } 23 | 24 | // Product 25 | template 26 | constexpr const T& product(const T& n) { 27 | return n; 28 | } 29 | template 30 | constexpr T product(const T& n, More... ns) { 31 | return n * product(ns...); 32 | } 33 | 34 | // Factorial 35 | // n! = n * (n-1) * (n-2) * ... * 1 36 | constexpr double factorial(std::size_t n) { 37 | return (n <= 1) ? 1 : n * factorial(n-1); 38 | }; 39 | 40 | // Combinatorial Permutation 41 | // (n)_k = n! / (n-k)! = n * (n-1) * (n-2) * ... * (n-k+1) 42 | constexpr double permutation(std::size_t n, std::size_t k) { 43 | return (k == 0) ? 1 : n * permutation(n-1,k-1); 44 | }; 45 | 46 | // Combinatorial Combination -- Binomial Coefficient 47 | // n choose k = n! / (k! (n-k)!) 48 | constexpr double combination_impl(std::size_t n, std::size_t k) { 49 | return (k == 0) ? 1 : n * combination_impl(n-1,k-1) / k; 50 | } 51 | constexpr double combination(std::size_t n, std::size_t k) { 52 | return (n/2 > k) ? combination_impl(n,n-k) : combination_impl(n,k); 53 | }; 54 | 55 | } // end namespace fmmtl 56 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/meta/tree_traits.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | struct TreeTraits { 5 | typedef Tree tree_type; 6 | typedef typename tree_type::box_type box_type; 7 | typedef typename tree_type::body_type body_type; 8 | typedef typename tree_type::box_iterator box_iterator; 9 | typedef typename tree_type::body_iterator body_iterator; 10 | }; 11 | 12 | template 14 | struct TreePairTraits { 15 | typedef TreeTraits source_traits; 16 | //! Source tree type 17 | typedef typename source_traits::tree_type source_tree_type; 18 | //! Source tree box type 19 | typedef typename source_traits::box_type source_box_type; 20 | //! Source tree box iterator 21 | typedef typename source_traits::box_iterator source_box_iterator; 22 | //! Source tree body type 23 | typedef typename source_traits::body_type source_body_type; 24 | //! Source tree body iterator 25 | typedef typename source_traits::body_iterator source_body_iterator; 26 | 27 | typedef TreeTraits target_traits; 28 | //! Target tree type 29 | typedef typename target_traits::tree_type target_tree_type; 30 | //! Target tree box type 31 | typedef typename target_traits::box_type target_box_type; 32 | //! Target tree box iterator 33 | typedef typename target_traits::box_iterator target_box_iterator; 34 | //! Target tree body type 35 | typedef typename target_traits::body_type target_body_type; 36 | //! Target tree body iterator 37 | typedef typename target_traits::body_iterator target_body_iterator; 38 | }; 39 | 40 | 41 | #define FMMTL_IMPORT_TREEPAIR_TRAITS(T1, T2) \ 42 | typedef typename TreePairTraits::source_box_type source_box_type; \ 43 | typedef typename TreePairTraits::source_box_iterator source_box_iterator; \ 44 | typedef typename TreePairTraits::source_body_type source_body_type; \ 45 | typedef typename TreePairTraits::source_body_iterator source_body_iterator; \ 46 | typedef typename TreePairTraits::target_box_type target_box_type; \ 47 | typedef typename TreePairTraits::target_box_iterator target_box_iterator; \ 48 | typedef typename TreePairTraits::target_body_type target_body_type; \ 49 | typedef typename TreePairTraits::target_body_iterator target_body_iterator 50 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/numeric/flens.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ALWAYS_USE_CXXLAPACK 4 | # define ALWAYS_USE_CXXLAPACK 5 | #endif 6 | 7 | #include 8 | 9 | ////////////////////////// 10 | // Custom type adaptors // 11 | ////////////////////////// 12 | 13 | // TODO: Full MTL4-like type options/construction 14 | 15 | namespace flens { 16 | 17 | template 18 | using matrix = GeMatrix > >; 19 | 20 | template 21 | using vector = DenseVector > >; 22 | 23 | } 24 | 25 | ////////////////////////////// 26 | // Custom function adaptors // 27 | ////////////////////////////// 28 | 29 | template 30 | auto num_rows(T&& t) 31 | -> decltype(t.numRows()) { 32 | return t.numRows(); 33 | } 34 | 35 | template 36 | auto num_cols(T&& t) 37 | -> decltype(t.numCols()) { 38 | return t.numCols(); 39 | } 40 | 41 | 42 | template 43 | auto frobenius_norm(T&& t) 44 | -> decltype(flens::blas::asum1(t)) { 45 | return flens::blas::asum1(t); 46 | } 47 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/numeric/mtl.hpp: -------------------------------------------------------------------------------- 1 | 2 | #define MTL_WITH_AUTO 3 | #define MTL_WITH_DEFAULTIMPL 4 | #define MTL_WITH_INITLIST 5 | #define MTL_WITH_MOVE 6 | #define MTL_WITH_RANGEDFOR 7 | #define MTL_WITH_STATICASSERT 8 | #define MTL_WITH_TEMPLATE_ALIAS 9 | #define MTL_WITH_VARIADIC_TEMPLATE 10 | #include 11 | 12 | // TODO: Adaptors with fmmtl norm, etc 13 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/traversal/Downward.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** @brief Process the boxes from top to bottom 4 | * concept Tree { 5 | * unsigned levels(); // Levels in the tree, root:0 6 | * box_iterator box_begin(unsigned level); // Iterator range to boxes of level 7 | * box_iterator box_end(unsigned level); 8 | * } 9 | * concept Evaluator { 10 | * void operator()(typename Tree::box_type& b); // Process box b 11 | * } 12 | */ 13 | struct DownwardPass { 14 | template 15 | inline static void eval(Tree& tree, Evaluator& eval) { 16 | // For the highest level down to the lowest level 17 | for (unsigned l = 0; l < tree.levels(); ++l) { 18 | // For all boxes at this level 19 | auto b_end = tree.box_end(l); 20 | for (auto bit = tree.box_begin(l); bit != b_end; ++bit) { 21 | auto box = *bit; 22 | eval(box); 23 | } 24 | } 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/traversal/SingleTraversal.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** @file SingleTraversal 3 | * @brief Generic single-tree traversals for finding boxes 4 | * that satisfy some criteria. 5 | */ 6 | 7 | #include "fmmtl/tree/TreeRange.hpp" 8 | 9 | namespace fmmtl { 10 | 11 | struct DefaultVisit { 12 | template 13 | ChildRange operator()(const Box& b) const { 14 | return {b}; 15 | } 16 | }; 17 | 18 | 19 | /** @brief Traverse a tree 20 | * 21 | * // Whether the box has any children and can be traversed 22 | * concept Box { 23 | * bool is_leaf() const; 24 | * } 25 | * 26 | * // Whether the box should be considered for traversal 27 | * const Prune { 28 | * bool operator()(Box); 29 | * } 30 | * 31 | * // No longer able to recurse, evaluate box 32 | * const Base { 33 | * void operator()(Box); 34 | * } 35 | * 36 | * // Iterable range of child boxes 37 | * // Defaults to [box.child_begin(), box.child_end()) 38 | * const Visit { 39 | * BoxRange operator()(Box); // Iterable range of child boxes 40 | * } 41 | */ 42 | template 46 | void traverse(const Box& b, 47 | const Prune& prune, 48 | const Base& base_case, 49 | const Visit& visit_order = Visit()) { 50 | if (prune(b)) 51 | return; 52 | 53 | if (b.is_leaf()) { 54 | base_case(b); 55 | } else { 56 | for (const Box& child : visit_order(b)) 57 | traverse(child, prune, base_case, visit_order); 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/traversal/Upward.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fmmtl/dispatch/Dispatchers.hpp" 4 | 5 | 6 | /** @brief Process the boxes from bottom to top 7 | * concept Tree { 8 | * unsigned levels(); // Levels in the tree, root:0 9 | * box_iterator box_begin(unsigned level); // Iterator range to boxes of level 10 | * box_iterator box_end(unsigned level); 11 | * } 12 | * concept Evaluator { 13 | * void operator()(typename Tree::box_type& b); // Process box b 14 | * } 15 | */ 16 | struct UpwardPass { 17 | template 18 | inline static void eval(Tree& tree, Evaluator& eval) { 19 | // For the lowest level up to the highest level 20 | for (int l = tree.levels()-1; l >= 0; --l) { 21 | // For all boxes at this level 22 | auto b_end = tree.box_end(l); 23 | for (auto bit = tree.box_begin(l); bit != b_end; ++bit) { 24 | auto box = *bit; 25 | eval(box); 26 | } 27 | } 28 | } 29 | }; 30 | 31 | /** Helper for computing the multipole for a box and all sub-boxes 32 | */ 33 | struct ComputeM { 34 | template 35 | inline static void eval(Context& c, 36 | const typename Context::source_box_type& sbox) { 37 | INITM::eval(c, sbox); 38 | 39 | if (sbox.is_leaf()) { 40 | // Compute the multipole from the box's sources 41 | S2M::eval(c, sbox); 42 | } else { 43 | auto c_end = sbox.child_end(); 44 | for (auto cit = sbox.child_begin(); cit != c_end; ++cit) { 45 | typename Context::source_box_type child = *cit; 46 | 47 | // Recursively initialize the multipole 48 | ComputeM::eval(c, child); 49 | // Accumulate the child's multipole into sbox 50 | M2M::eval(c, child, sbox); 51 | } 52 | } 53 | } 54 | }; 55 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/tree/BoundingSphere.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "fmmtl/numeric/norm.hpp" 5 | #include "fmmtl/meta/dimension.hpp" 6 | 7 | namespace fmmtl { 8 | 9 | template 10 | class BoundingSphere { 11 | public: 12 | typedef POINT point_type; 13 | 14 | // Constructor 15 | BoundingSphere(const point_type& center, double radius_sq) 16 | : center_(center), radius_sq_(radius_sq) {} 17 | 18 | const point_type& center() const { 19 | return center_; 20 | } 21 | 22 | double radius() const { 23 | return std::sqrt(radius_sq_); 24 | } 25 | 26 | double radius_sq() const { 27 | return radius_sq_; 28 | } 29 | 30 | bool constains(const point_type& p) const { 31 | return norm_2_sq(p - center()) < radius_sq(); 32 | } 33 | 34 | private: 35 | point_type center_; 36 | double radius_sq_; 37 | }; // end class BoundingSphere 38 | 39 | 40 | template 41 | inline std::ostream& operator<<(std::ostream& s, const BoundingSphere

& b) { 42 | const unsigned dim = b.center().size(); 43 | s << "[Center: " << b.center()[0]; 44 | for (unsigned i = 1; i != dim; ++i) 45 | s << ", " << b.center()[i]; 46 | s << " ; Radius: " << b.radius(); 47 | return s << "]"; 48 | } 49 | 50 | } //end namespace fmmtl 51 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/tree/TreeRange.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** Helper utilities for range-based for loops with trees 3 | */ 4 | 5 | namespace fmmtl { 6 | 7 | template 8 | struct BoxRange { 9 | const T& t; 10 | auto begin() -> decltype(t.box_begin()) { 11 | return t.box_begin(); 12 | } 13 | auto end() -> decltype(t.box_end()) { 14 | return t.box_end(); 15 | } 16 | }; 17 | 18 | template 19 | BoxRange boxes(const T& t) { 20 | return {t}; 21 | } 22 | 23 | 24 | template 25 | struct BoxLevelRange { 26 | unsigned L; 27 | const T& t; 28 | auto begin() -> decltype(t.box_begin(L)) { 29 | return t.box_begin(L); 30 | } 31 | auto end() -> decltype(t.box_end(L)) { 32 | return t.box_end(L); 33 | } 34 | }; 35 | 36 | template 37 | BoxLevelRange boxes(unsigned L, const T& t) { 38 | return {L,t}; 39 | } 40 | 41 | 42 | template 43 | struct ChildRange { 44 | const T& t; 45 | auto begin() -> decltype(t.child_begin()) { 46 | return t.child_begin(); 47 | } 48 | auto end() -> decltype(t.child_end()) { 49 | return t.child_end(); 50 | } 51 | }; 52 | 53 | template 54 | ChildRange children(const T& t) { 55 | return {t}; 56 | } 57 | 58 | 59 | template 60 | struct BodyRange { 61 | const T& t; 62 | auto begin() -> decltype(t.body_begin()) { 63 | return t.body_begin(); 64 | } 65 | auto end() -> decltype(t.body_end()) { 66 | return t.body_end(); 67 | } 68 | }; 69 | 70 | template 71 | BodyRange bodies(const T& t) { 72 | return {t}; 73 | } 74 | 75 | 76 | 77 | } // end namespace fmmtl 78 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/tree/util/CountedProxyIterator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace fmmtl { 7 | 8 | /** CountedProxyIterator 9 | * @brief A random-access iterator for indexed proxy objects. 10 | * A counted iterator over a type construted with an index-pointer pair. 11 | * @tparam T The value object that supports construction: T(I, Friend*) 12 | * @tparam Friend The friend class and pointer type 13 | * @tparam I The index type 14 | * 15 | * Note: Since this dereferences to a value rather than a reference, 16 | * it does not fully satisfy the random-access-iterator concept. Thus, 17 | * this should not be implemented with boost::transform_iterator. 18 | */ 19 | template 20 | struct CountedProxyIterator 21 | : boost::iterator_adaptor, // Derived 22 | boost::counting_iterator, // BaseType 23 | T, // Value 24 | std::random_access_iterator_tag, // Category 25 | T> // Reference 26 | { 27 | typedef I size_type; 28 | //! Construct an invalid iterator 29 | CountedProxyIterator() {} 30 | //! The index of this iterator 31 | size_type index() const { 32 | return *(this->base()); 33 | } 34 | private: 35 | Friend* p_; 36 | friend Friend; 37 | CountedProxyIterator(I idx, Friend* p) 38 | : CountedProxyIterator::iterator_adaptor(boost::counting_iterator(idx)), 39 | p_(p) { 40 | } 41 | friend class boost::iterator_core_access; 42 | T dereference() const { 43 | return T(index(), p_); 44 | } 45 | }; 46 | 47 | } // end namespace fmmtl 48 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/fmmtl/util/CallStack.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fmmtl/config.hpp" 4 | 5 | #ifndef FMMTL_RELEASE 6 | 7 | #include 8 | #include 9 | 10 | namespace fmmtl { 11 | 12 | std::stack callStack; 13 | 14 | void PushCallStack(const std::string& s) { 15 | #ifdef FMMTL_WITH_OPENMP 16 | if (omp_get_thread_num() != 0) 17 | return; 18 | #endif 19 | callStack.push(s); 20 | } 21 | 22 | void PopCallStack() { 23 | #ifdef FMMTL_WITH_OPENMP 24 | if (omp_get_thread_num() != 0) 25 | return; 26 | #endif 27 | callStack.pop(); 28 | } 29 | 30 | void DumpCallStack(std::ostream& os) { 31 | #ifdef FMMTL_WITH_OPENMP 32 | if( omp_get_thread_num() != 0 ) 33 | return; 34 | #endif 35 | std::ostringstream msg; 36 | while (!callStack.empty()) { 37 | msg << "[" << callStack.size() << "]: " << callStack.top() 38 | << "\n"; 39 | callStack.pop(); 40 | } 41 | os << msg.str(); 42 | os.flush(); 43 | } 44 | 45 | struct CallStackEntry { 46 | CallStackEntry(const std::string& s) { 47 | if (!std::uncaught_exception()) 48 | PushCallStack(s); 49 | } 50 | ~CallStackEntry() { 51 | if (!std::uncaught_exception()) 52 | PopCallStack(); 53 | } 54 | }; 55 | 56 | } // end namespace fmmtl 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/kernel/Barycentric.kern: -------------------------------------------------------------------------------- 1 | #ifndef FMMTL_BARYCENTRIC_KERN 2 | #define FMMTL_BARYCENTRIC_KERN 3 | 4 | #include "fmmtl/Kernel.hpp" 5 | 6 | #include "fmmtl/numeric/Vec.hpp" 7 | 8 | struct Barycentric 9 | : public fmmtl::Kernel { 10 | typedef Vec<1,double> source_type; 11 | typedef double charge_type; 12 | typedef Vec<1,double> target_type; 13 | typedef double result_type; 14 | typedef double kernel_value_type; 15 | 16 | /** Kernel evaluation 17 | * K(t,s) = 1 / R where |R| > 0 18 | * 0 else 19 | * where R = s-t 20 | */ 21 | FMMTL_INLINE 22 | kernel_value_type operator()(const target_type& t, 23 | const source_type& s) const { 24 | return (t[0] == s[0] ? 0 : 1.0 / (t[0] - s[0])); 25 | } 26 | FMMTL_INLINE 27 | kernel_value_type transpose(const kernel_value_type& kts) const { 28 | return -kts; 29 | } 30 | }; 31 | FMMTL_KERNEL_EXTRAS(Barycentric); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/kernel/BiotSavart.kern.cpp: -------------------------------------------------------------------------------- 1 | #ifndef FMMTL_BIOTSAVART_KERN 2 | #define FMMTL_BIOTSAVART_KERN 3 | //#define FMMTL_KERNEL 4 | 5 | #include "fmmtl/Kernel.hpp" 6 | 7 | #include "fmmtl/numeric/Vec.hpp" 8 | 9 | struct BiotSavart 10 | : public fmmtl::Kernel { 11 | typedef Vec<3,double> source_type; 12 | typedef Vec<3,double> target_type; 13 | typedef Vec<3,double> charge_type; 14 | typedef Vec<3,double> result_type; 15 | 16 | struct kernel_value_type { 17 | Vec<3,double> v; 18 | FMMTL_INLINE 19 | kernel_value_type(const Vec<3,double>& _v) : v(_v) {} 20 | 21 | FMMTL_INLINE 22 | result_type operator*(const charge_type& c) const { 23 | return cross(v, c); 24 | } 25 | }; 26 | 27 | FMMTL_INLINE 28 | kernel_value_type operator()(const target_type& t, 29 | const source_type& s) const { 30 | Vec<3,double> dist = s - t; // Vector from target to source 31 | double R2 = norm_2_sq(dist); // R^2 32 | double invR2 = 1.0 / R2; // 1 / R^2 33 | if (R2 < 1e-20) invR2 = 0; // Exclude self interaction 34 | dist *= invR2 * std::sqrt(invR2); 35 | return kernel_value_type(dist); 36 | } 37 | 38 | FMMTL_INLINE 39 | kernel_value_type transpose(const kernel_value_type& kts) const { 40 | return kernel_value_type(-kts.v); 41 | } 42 | }; 43 | FMMTL_KERNEL_EXTRAS(BiotSavart); 44 | 45 | 46 | struct RosenheadMoore 47 | : public fmmtl::Kernel { 48 | typedef Vec<3,double> source_type; 49 | typedef Vec<3,double> target_type; 50 | typedef Vec<3,double> charge_type; 51 | typedef Vec<3,double> result_type; 52 | 53 | struct kernel_value_type { 54 | Vec<3,double> v; 55 | FMMTL_INLINE 56 | kernel_value_type(const Vec<3,double>& _v) : v(_v) {} 57 | 58 | FMMTL_INLINE 59 | result_type operator*(const charge_type& c) const { 60 | return cross(v, c); 61 | } 62 | }; 63 | 64 | double aSq; 65 | 66 | FMMTL_INLINE 67 | RosenheadMoore(double _a = 1) : aSq(_a * _a) {} 68 | 69 | FMMTL_INLINE 70 | kernel_value_type operator()(const target_type& t, 71 | const source_type& s) const { 72 | Vec<3,double> dist = s - t; // Vector from target to source 73 | double R2 = aSq + norm_2_sq(dist); 74 | dist /= R2 * std::sqrt(R2); 75 | return kernel_value_type(dist); 76 | } 77 | 78 | FMMTL_INLINE 79 | kernel_value_type transpose(const kernel_value_type& kts) const { 80 | return kernel_value_type(-kts.v); 81 | } 82 | }; 83 | FMMTL_KERNEL_EXTRAS(RosenheadMoore); 84 | 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/kernel/Gaussian.kern: -------------------------------------------------------------------------------- 1 | #ifndef FMMTL_GAUSSIAN_KERN 2 | #define FMMTL_GAUSSIAN_KERN 3 | /** @file Gaussian 4 | * @brief Implements the Gaussian kernel defined by 5 | * K(t,s) = exp(-||t - s||^2 / h^2) 6 | * 7 | */ 8 | 9 | #include "fmmtl/Kernel.hpp" 10 | 11 | // Use a library-defined Vector class that supports multiple architectures 12 | #include "fmmtl/numeric/Vec.hpp" 13 | 14 | template 15 | struct Gaussian 16 | : public fmmtl::Kernel > 17 | { 18 | typedef Vec source_type; 19 | typedef double charge_type; 20 | typedef Vec target_type; 21 | typedef double result_type; 22 | typedef double kernel_value_type; 23 | 24 | double inv_h_; 25 | double inv_h_sq_; 26 | 27 | FMMTL_INLINE 28 | Gaussian(double h = 1) 29 | : inv_h_(1/h), inv_h_sq_(inv_h_*inv_h_) { 30 | } 31 | 32 | /** Kernel evaluation */ 33 | FMMTL_INLINE 34 | kernel_value_type operator()(const target_type& t, 35 | const source_type& s) const { 36 | return exp(-inv_h_sq_ * norm_2_sq(t-s)); 37 | } 38 | /** Fast transpose */ 39 | FMMTL_INLINE 40 | kernel_value_type transpose(const kernel_value_type& kts) const { 41 | return kts; 42 | } 43 | }; 44 | // XXX: Need to fix the build system... 45 | FMMTL_KERNEL_EXTRAS(Gaussian<1>); 46 | FMMTL_KERNEL_EXTRAS(Gaussian<2>); 47 | FMMTL_KERNEL_EXTRAS(Gaussian<3>); 48 | FMMTL_KERNEL_EXTRAS(Gaussian<4>); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/kernel/Laplace.kern: -------------------------------------------------------------------------------- 1 | #ifndef FMMTL_LAPLACE_KERN 2 | #define FMMTL_LAPLACE_KERN 3 | 4 | #include "fmmtl/Kernel.hpp" 5 | 6 | #include "fmmtl/numeric/Vec.hpp" 7 | 8 | struct LaplacePotential 9 | : public fmmtl::Kernel { 10 | typedef Vec<3,double> source_type; 11 | typedef double charge_type; 12 | typedef Vec<3,double> target_type; 13 | typedef double result_type; 14 | typedef double kernel_value_type; 15 | 16 | /** Kernel evaluation 17 | * K(t,s) = 1 / R if R > 0 18 | * 0 else 19 | * where R = |s-t|_2 20 | */ 21 | FMMTL_INLINE 22 | kernel_value_type operator()(const target_type& t, 23 | const source_type& s) const { 24 | double R2 = norm_2_sq(s - t); // R^2 25 | double invR2; // 1 / R^2 26 | if (R2 > 0) invR2 = 1.0 / R2; // Exclude self interaction 27 | else invR2 = 0.0; 28 | return std::sqrt(invR2); // Potential 29 | } 30 | FMMTL_INLINE 31 | kernel_value_type transpose(const kernel_value_type& kts) const { 32 | return kts; 33 | } 34 | }; 35 | FMMTL_KERNEL_EXTRAS(LaplacePotential); 36 | 37 | struct LaplaceKernel 38 | : public fmmtl::Kernel { 39 | typedef Vec<3,double> source_type; 40 | typedef double charge_type; 41 | typedef Vec<3,double> target_type; 42 | typedef Vec<4,double> result_type; 43 | typedef Vec<4,double> kernel_value_type; 44 | 45 | /** Kernel evaluation 46 | * K(t,s) = {1/R, (s-t)/R^3} if R > 0 47 | * {0,0,0,0} else 48 | * where R = |s-t|_2 49 | */ 50 | FMMTL_INLINE 51 | kernel_value_type operator()(const target_type& t, 52 | const source_type& s) const { 53 | Vec<3,double> dist = s - t; // Vector from target to source 54 | double R2 = norm_2_sq(dist); // R^2 55 | double invR2; // 1 / R^2 56 | if (R2 > 0) invR2 = 1.0 / R2; // Exclude self interaction 57 | else invR2 = 0.0; 58 | double invR = std::sqrt(invR2); // Potential 59 | dist *= invR2 * invR; // Force 60 | return kernel_value_type(invR, dist[0], dist[1], dist[2]); 61 | } 62 | FMMTL_INLINE 63 | kernel_value_type transpose(const kernel_value_type& kts) const { 64 | return kernel_value_type(kts[0], -kts[1], -kts[2], -kts[3]); 65 | } 66 | }; 67 | FMMTL_KERNEL_EXTRAS(LaplaceKernel); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/kernel/README.md: -------------------------------------------------------------------------------- 1 | This is a readme file for kernels... 2 | -------------------------------------------------------------------------------- /Apps/SoapFilm3D/fmmtl/kernel/Stokes.kern: -------------------------------------------------------------------------------- 1 | #ifndef FMMTL_STOKES_KERN 2 | #define FMMTL_STOKES_KERN 3 | 4 | #include "fmmtl/Kernel.hpp" 5 | 6 | #include "fmmtl/numeric/Vec.hpp" 7 | 8 | /** Stokeslet Green's function: 9 | * 10 | * In index notation: 11 | * S_ij(t,s) = delta_ij / |s-t| + (s-t)_i (s-t)_j / |s-t|^3 12 | * In matrix form: 13 | * S(t,s) = I / |s-t| + (s-t) (s-t)^T / |s-t|^3 14 | */ 15 | struct Stokeslet 16 | : public fmmtl::Kernel { 17 | typedef Vec<3,double> source_type; 18 | typedef Vec<3,double> charge_type; 19 | typedef Vec<3,double> target_type; 20 | typedef Vec<3,double> result_type; 21 | 22 | /** A compressed struct to represent the rank-1 3x3 stokeslet matrix */ 23 | struct kernel_value_type { 24 | Vec<3,double> r; 25 | 26 | FMMTL_INLINE 27 | kernel_value_type(const Vec<3,double>& _r) : r(_r) {} 28 | 29 | FMMTL_INLINE 30 | result_type operator*(const charge_type& c) const { 31 | double invR2 = 1.0 / norm_2_sq(r); 32 | if (invR2 > 1e20) invR2 = 0; 33 | double invR = std::sqrt(invR2); 34 | double rcInvR3 = inner_prod(r,c) * invR * invR2; 35 | 36 | return result_type(invR*c[0] + rcInvR3*r[0], 37 | invR*c[1] + rcInvR3*r[1], 38 | invR*c[2] + rcInvR3*r[2]); 39 | } 40 | }; 41 | 42 | FMMTL_INLINE 43 | kernel_value_type operator()(const target_type& t, 44 | const source_type& s) const { 45 | return kernel_value_type(s-t); 46 | } 47 | 48 | FMMTL_INLINE 49 | kernel_value_type transpose(const kernel_value_type& kts) const { 50 | return kernel_value_type(-kts.r); 51 | } 52 | }; 53 | FMMTL_KERNEL_EXTRAS(Stokeslet); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.1) 2 | 3 | project (SoapFilm3D) 4 | set (CMAKE_CXX_STANDARD 11) 5 | 6 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") 7 | 8 | if (NOT CMAKE_BUILD_TYPE) 9 | set (CMAKE_BUILD_TYPE Release CACHE STRING 10 | "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." 11 | FORCE) 12 | endif (NOT CMAKE_BUILD_TYPE) 13 | 14 | # add directory with macros 15 | set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) 16 | 17 | # add cmake file 18 | include (common) 19 | 20 | # set options 21 | 22 | if (CMAKE_BUILD_TYPE MATCHES Debug) 23 | add_definitions (-DDEBUG) 24 | endif (CMAKE_BUILD_TYPE MATCHES Debug) 25 | 26 | # Eigen library is required 27 | find_package (Eigen3 REQUIRED) 28 | include_directories (${EIGEN3_INCLUDE_DIR}) 29 | 30 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/LosTopos/LosTopos3D) 31 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/LosTopos/common) 32 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/LosTopos/common/newsparse) 33 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/LosTopos/common/tunicate) 34 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Apps/SoapFilm3D/fmmtl) 35 | 36 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 37 | 38 | add_subdirectory (LosTopos) 39 | 40 | add_subdirectory (Apps) 41 | 42 | -------------------------------------------------------------------------------- /LosTopos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DUSE_FORTRAN_BLAS) 2 | 3 | set (Directories 4 | . 5 | common 6 | common/tunicate 7 | common/newsparse 8 | LosTopos3D 9 | ) 10 | 11 | append_files (Headers "h" ${Directories}) 12 | append_files (Sources "cpp" ${Directories}) 13 | 14 | find_package (OpenGL REQUIRED) 15 | include_directories (${OPENGL_INCLUDE_DIR}) 16 | 17 | find_package (GLUT REQUIRED glut) 18 | include_directories (${GLUT_INCLUDE_DIR}) 19 | 20 | find_package (Eigen3 REQUIRED) 21 | include_directories (${EIGEN3_INCLUDE_DIR}) 22 | 23 | add_library(LosTopos STATIC ${Headers} ${Sources}) 24 | target_link_libraries (LosTopos ${DEFAULT_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_glut_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) 25 | 26 | 27 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/Makefile: -------------------------------------------------------------------------------- 1 | # -------------------- 2 | # 3 | # Makefile for El Topo. 4 | # 5 | # Create a file called Makefile.local_defs before running make. See Makefile.example_defs for suggestions. 6 | # 7 | # -------------------- 8 | 9 | # This is for GNU make; other versions of make may not run correctly. 10 | 11 | # Local machine settings 12 | include Makefile.local_defs 13 | 14 | # -------------------- 15 | # El Topo library 16 | # -------------------- 17 | 18 | LIBRARY = libeltopo 19 | include Makefile.inc 20 | 21 | # how to compile each file 22 | .SUFFIXES: 23 | obj/%.o: 24 | $(CC) -c $(RELEASE_FLAGS) $(INCLUDE_PATH) -o $@ $< 25 | obj_debug/%.o: 26 | $(CC) -c $(DEBUG_FLAGS) $(INCLUDE_PATH) -o $@ $< 27 | 28 | .PHONY: release 29 | release: $(LIBRARY)_release.a 30 | 31 | .PHONY: debug 32 | debug: $(LIBRARY)_debug.a 33 | 34 | # cleaning up 35 | .PHONY: clean 36 | clean: 37 | -rm -f obj/*.o obj/depend $(LIBRARY)_debug.a obj_debug/*.o obj_debug/depend $(LIBRARY)_release.a *core 38 | 39 | # dependencies are automatically generated 40 | .PHONY: depend 41 | depend: 42 | -mkdir obj 43 | -rm -f obj/depend 44 | $(foreach srcfile,$(LIB_SRC),$(DEPEND) -MM $(srcfile) -MT $(patsubst %.cpp,obj/%.o,$(notdir $(srcfile))) $(INCLUDE_PATH) >> obj/depend;) 45 | -mkdir obj_debug 46 | -rm -f obj_debug/depend 47 | $(foreach srcfile,$(LIB_SRC),$(DEPEND) -MM $(srcfile) -MT $(patsubst %.cpp,obj_debug/%.o,$(notdir $(srcfile))) $(INCLUDE_PATH) >> obj_debug/depend;) 48 | 49 | -include obj/depend 50 | -include obj_debug/depend 51 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/Makefile.example_defs: -------------------------------------------------------------------------------- 1 | # 2 | # This for use with Makefile 3 | # 4 | # NOTE: Rename this file to "Makefile.local_defs" after specifying your machine settings 5 | # 6 | 7 | INCLUDE_PATH = -I. -I../common -I../common/newsparse -I../common/meshes -I../common/tunicate 8 | 9 | # local machine settings 10 | 11 | # For example, on Linux on a PC this will likely work: 12 | 13 | DEPEND = g++ -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DNO_GUI -m32 14 | CC = g++ -Wall -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DNO_GUI -fPIC -m32 15 | RELEASE_FLAGS = -O3 -funroll-loops 16 | DEBUG_FLAGS = -g 17 | LINK = g++ 18 | 19 | # sub in your local lapack and blas paths here: 20 | LINK_LIBS = -lGL -lGLU -lglut -llapack -lblas 21 | 22 | # On Mac OS X (on a G5), this probably will work: 23 | 24 | #DEPEND = g++ -DNO_GUI 25 | #CC = g++ -Wall -DNO_GUI -fPIC 26 | #RELEASE_FLAGS = -fast # add -mcpu=7450 for a G4, or -mcpu=750 for a G3 since -fast enables 970(G5) instructions by default 27 | #DEBUG_FLAGS = -g 28 | #LINK = g++ 29 | #LINK_LIBS = -framework OpenGL -framework GLUT -framework vecLib 30 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/Makefile.inc: -------------------------------------------------------------------------------- 1 | 2 | # Source files 3 | LIB_SRC = accelerationgrid.cpp broadphasegrid.cpp collisionpipeline.cpp \ 4 | dynamicsurface.cpp edgecollapser.cpp edgeflipper.cpp edgesplitter.cpp \ 5 | eltopo.cpp impactzonesolver.cpp meshmerger.cpp meshpincher.cpp meshsmoother.cpp \ 6 | meshrenderer.cpp nondestructivetrimesh.cpp subdivisionscheme.cpp surftrack.cpp \ 7 | trianglequality.cpp \ 8 | 9 | # Common 10 | LIB_SRC += ../common/collisionqueries.cpp ../common/wallclocktime.cpp \ 11 | ../common/newsparse/sparse_matrix.cpp \ 12 | ../common/newsparse/krylov_solvers.cpp \ 13 | 14 | LIB_SRC += ../common/tunicate/expansion.cpp ../common/tunicate/intersection.cpp ../common/tunicate/neg.cpp \ 15 | ../common/tunicate/orientation.cpp 16 | 17 | LIB_SRC += ../common/ccd_wrapper.cpp ../common/cubic_ccd_wrapper.cpp ../common/collisionqueries.cpp 18 | 19 | LIB_SRC += ../common/lexer.cpp ../common/newparser.cpp 20 | 21 | # object files 22 | LIB_RELEASE_OBJ = $(patsubst %.cpp,obj/%.o,$(notdir $(LIB_SRC))) 23 | LIB_DEBUG_OBJ = $(patsubst %.cpp,obj_debug/%.o,$(notdir $(LIB_SRC))) 24 | 25 | # Build the library 26 | $(LIBRARY)_release.a: $(LIB_RELEASE_OBJ) 27 | ar r $@ $(LIB_RELEASE_OBJ) 28 | ranlib $@ 29 | 30 | $(LIBRARY)_debug.a: $(LIB_DEBUG_OBJ) 31 | ar r $@ $(LIB_DEBUG_OBJ) 32 | ranlib $@ 33 | 34 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/cpp-file-template.txt: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------- 2 | // 3 | // file.cpp 4 | // 5 | // Description 6 | // 7 | // --------------------------------------------------------- 8 | 9 | // --------------------------------------------------------- 10 | // Includes 11 | // --------------------------------------------------------- 12 | 13 | // --------------------------------------------------------- 14 | // Global externs 15 | // --------------------------------------------------------- 16 | 17 | // --------------------------------------------------------- 18 | // Local constants, typedefs, macros 19 | // --------------------------------------------------------- 20 | 21 | // --------------------------------------------------------- 22 | // Static function definitions 23 | // --------------------------------------------------------- 24 | 25 | // --------------------------------------------------------- 26 | // Member function definitions 27 | // --------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/h-file-template.txt: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------- 2 | // 3 | // file.h 4 | // 5 | // Description 6 | // 7 | // --------------------------------------------------------- 8 | 9 | // --------------------------------------------------------- 10 | // Nested includes 11 | // --------------------------------------------------------- 12 | 13 | // --------------------------------------------------------- 14 | // Forwards and typedefs 15 | // --------------------------------------------------------- 16 | 17 | // --------------------------------------------------------- 18 | // Class definitions 19 | // --------------------------------------------------------- 20 | 21 | // --------------------------------------------------------- 22 | // Inline functions 23 | // --------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/meshpincher.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------- 2 | // 3 | // meshpincher.h 4 | // Tyson Brochu 2011 5 | // Christopher Batty, Fang Da 2014 6 | // 7 | // Identifies "singular vertices", defined as having more than one connected 8 | // triangle neighbourhoods, and splits the mesh surface at these vertices. 9 | // 10 | // --------------------------------------------------------- 11 | 12 | #ifndef LOSTOPOS_MESHPINCHER_H 13 | #define LOSTOPOS_MESHPINCHER_H 14 | 15 | // --------------------------------------------------------- 16 | // Nested includes 17 | // --------------------------------------------------------- 18 | 19 | #include 20 | #include 21 | 22 | // --------------------------------------------------------- 23 | // Forwards and typedefs 24 | // --------------------------------------------------------- 25 | 26 | namespace LosTopos { 27 | 28 | class SurfTrack; 29 | template 30 | struct Vec; 31 | typedef Vec<3, size_t> Vec3st; 32 | 33 | // --------------------------------------------------------- 34 | // Class definitions 35 | // --------------------------------------------------------- 36 | 37 | // --------------------------------------------------------- 38 | /// 39 | /// Mesh pincher object. Identifies "singular vertices", defined as having more 40 | /// than one connected triangle neighbourhoods, and splits the mesh surface at 41 | /// these vertices. 42 | /// 43 | // --------------------------------------------------------- 44 | 45 | class MeshPincher { 46 | public: 47 | /// Save some typing when dealing with vertex neighbourhoods 48 | /// 49 | typedef std::vector TriangleSet; 50 | 51 | /// Constructor 52 | /// 53 | MeshPincher(SurfTrack& surf) : m_surf(surf) {} 54 | 55 | /// Find vertices with disconnected neighbourhoods, and pull them apart 56 | /// 57 | void separate_singular_vertices(); 58 | 59 | private: 60 | /// The mesh this object operates on 61 | /// 62 | SurfTrack& m_surf; 63 | 64 | /// Partition the triangles incident to a vertex into connected components 65 | /// 66 | void partition_vertex_neighbourhood( 67 | size_t vertex_index, std::vector& connected_components); 68 | 69 | /// Duplicate a vertex and move the two copies away from each other slightly 70 | /// 71 | bool pull_apart_vertex(size_t vertex_index, 72 | const std::vector& connected_components); 73 | }; 74 | 75 | } // namespace LosTopos 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /LosTopos/LosTopos3D/options.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------- 2 | // 3 | // options.h 4 | // Tyson Brochu 2008 5 | // Christopher Batty, Fang Da 2014 6 | // 7 | // Constants and macro defines 8 | // 9 | // --------------------------------------------------------- 10 | 11 | #ifndef LOSTOPOS_OPTIONS_H 12 | #define LOSTOPOS_OPTIONS_H 13 | 14 | #include 15 | 16 | // --------------------------------------------------------- 17 | // Global constants 18 | // --------------------------------------------------------- 19 | 20 | namespace LosTopos { 21 | 22 | extern double G_EIGENVALUE_RANK_RATIO; // in surftrack.cpp 23 | 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /LosTopos/common/array2_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef ARRAY2_UTILS_H 2 | #define ARRAY2_UTILS_H 3 | 4 | #include "array2.h" 5 | #include "util.h" 6 | #include "vec.h" 7 | 8 | template 9 | T interpolate_value(const Vec<2, S>& point, const Array2 >& grid) { 10 | int i, j; 11 | S fx, fy; 12 | 13 | get_barycentric(point[0], i, fx, 0, grid.ni); 14 | get_barycentric(point[1], j, fy, 0, grid.nj); 15 | 16 | return bilerp(grid(i, j), grid(i + 1, j), grid(i, j + 1), grid(i + 1, j + 1), 17 | fx, fy); 18 | } 19 | 20 | template 21 | float interpolate_gradient(Vec<2, T>& gradient, const Vec<2, S>& point, 22 | const Array2 >& grid) { 23 | int i, j; 24 | S fx, fy; 25 | get_barycentric(point[0], i, fx, 0, grid.ni); 26 | get_barycentric(point[1], j, fy, 0, grid.nj); 27 | 28 | T v00 = grid(i, j); 29 | T v01 = grid(i, j + 1); 30 | T v10 = grid(i + 1, j); 31 | T v11 = grid(i + 1, j + 1); 32 | 33 | T ddy0 = (v01 - v00); 34 | T ddy1 = (v11 - v10); 35 | 36 | T ddx0 = (v10 - v00); 37 | T ddx1 = (v11 - v01); 38 | 39 | gradient[0] = lerp(ddx0, ddx1, fy); 40 | gradient[1] = lerp(ddy0, ddy1, fx); 41 | 42 | // may as well return value too 43 | return bilerp(v00, v10, v01, v11, fx, fy); 44 | } 45 | 46 | template 47 | void write_matlab_array(std::ostream& output, Array2 >& a, 48 | const char* variable_name, bool transpose = false) { 49 | output << variable_name << "=["; 50 | for (int j = 0; j < a.nj; ++j) { 51 | for (int i = 0; i < a.ni; ++i) { 52 | output << a(i, j) << " "; 53 | } 54 | output << ";"; 55 | } 56 | output << "]"; 57 | if (transpose) output << "'"; 58 | output << ";" << std::endl; 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /LosTopos/common/ccd_defs.h: -------------------------------------------------------------------------------- 1 | #ifndef CCD_DEFS_H 2 | #define CCD_DEFS_H 3 | 4 | // 5 | // Uncomment one of the following to select the continuous collision detection 6 | // method. 7 | // 8 | namespace LosTopos { 9 | 10 | //#define USE_CUBIC_SOLVER_CCD 11 | #define USE_ROOT_PARITY_CCD 12 | 13 | } // namespace LosTopos 14 | #endif 15 | -------------------------------------------------------------------------------- /LosTopos/common/collisionqueries.h: -------------------------------------------------------------------------------- 1 | #ifndef COLLISIONQUERIES_H 2 | #define COLLISIONQUERIES_H 3 | 4 | #include 5 | 6 | namespace LosTopos { 7 | // 2D 8 | // ==================================================================================================== 9 | 10 | void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, 11 | const Vec2d &x2, double &distance); 12 | 13 | void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, 14 | const Vec2d &x2, double &distance, double &s, 15 | Vec2d &normal, double normal_multiplier); 16 | 17 | // 3D 18 | // ==================================================================================================== 19 | 20 | void check_point_edge_proximity(bool update, const Vec3d &x0, const Vec3d &x1, 21 | const Vec3d &x2, double &distance); 22 | void check_point_edge_proximity(bool update, const Vec3d &x0, const Vec3d &x1, 23 | const Vec3d &x2, double &distance, double &s, 24 | Vec3d &normal, double normal_multiplier); 25 | 26 | void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, 27 | const Vec3d &x2, const Vec3d &x3, 28 | double &distance); 29 | void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, 30 | const Vec3d &x2, const Vec3d &x3, 31 | double &distance, double &s0, double &s2, 32 | Vec3d &normal); 33 | 34 | void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, 35 | const Vec3d &x2, const Vec3d &x3, 36 | double &distance); 37 | void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, 38 | const Vec3d &x2, const Vec3d &x3, 39 | double &distance, double &s1, double &s2, 40 | double &s3, Vec3d &normal); 41 | 42 | double signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, 43 | const Vec3d &x3); 44 | 45 | } // namespace LosTopos 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /LosTopos/common/commonoptions.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------- 2 | // 3 | // options.h 4 | // Tyson Brochu 2008 5 | // Christopher Batty, Fang Da 2014 6 | // 7 | // Constants and macro defines 8 | // 9 | // --------------------------------------------------------- 10 | 11 | #ifndef COMMONOPTIONS_H 12 | #define COMMONOPTIONS_H 13 | 14 | #include 15 | 16 | // --------------------------------------------------------- 17 | // Global constants 18 | // --------------------------------------------------------- 19 | 20 | const double UNINITIALIZED_DOUBLE = 0x0F; 21 | const double BIG_DOUBLE = 1e30; 22 | 23 | #ifdef _MSC_VER 24 | #include "BaseTsd.h" 25 | typedef SSIZE_T ssize_t; 26 | #endif 27 | 28 | const size_t UNINITIALIZED_SIZE_T = static_cast(~0); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /LosTopos/common/grid3.h: -------------------------------------------------------------------------------- 1 | #ifndef GRID3_H 2 | #define GRID3_H 3 | 4 | #include 5 | 6 | template 7 | struct Grid3 { 8 | Vec<3, T> origin; 9 | T dx, over_dx; 10 | }; 11 | 12 | typedef Grid3 Grid3f; 13 | typedef Grid3 Grid3d; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /LosTopos/common/lexer.h: -------------------------------------------------------------------------------- 1 | #ifndef LEXER_H 2 | #define LEXER_H 3 | 4 | #include 5 | #include 6 | 7 | enum TokenType { 8 | TOKEN_EOF, 9 | TOKEN_ERROR, 10 | TOKEN_IDENTIFIER, 11 | TOKEN_NUMBER, 12 | TOKEN_STRING, 13 | TOKEN_LEFT_PAREN, 14 | TOKEN_RIGHT_PAREN, 15 | TOKEN_LEFT_BRACKET, 16 | TOKEN_RIGHT_BRACKET 17 | }; 18 | 19 | struct Token { 20 | TokenType type; 21 | // typically only one of the following has a meaningful value 22 | double number_value; 23 | std::string string_value; 24 | 25 | Token() : type(TOKEN_ERROR), number_value(1e+30), string_value("ERROR") {} 26 | ~Token() { clear(); } 27 | 28 | Token(const Token& source); 29 | Token& operator=(const Token& source); 30 | 31 | void set(TokenType type_); 32 | void set(TokenType type_, const std::string& value); 33 | void set(TokenType type_, double value); 34 | void clear(); // free up string storage after finished with a TOKEN_ERROR or 35 | // TOKEN_IDENTIFIER 36 | }; 37 | 38 | std::ostream& operator<<(std::ostream& out, const Token& t); 39 | 40 | struct Lexer { 41 | std::istream& input; 42 | 43 | Lexer(std::istream& input_) : input(input_) {} 44 | 45 | void read(Token& tok); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /LosTopos/common/marching_tiles_hires.h: -------------------------------------------------------------------------------- 1 | #ifndef MARCHING_TILES_HIRES_H 2 | #define MARCHING_TILES_HIRES_H 3 | 4 | #include "array3.h" 5 | #include "hashtable.h" 6 | #include "vec.h" 7 | 8 | namespace LosTopos { 9 | struct MarchingTilesHiRes { 10 | LosTopos::Array1 tri; 11 | LosTopos::Array1 x; 12 | LosTopos::Array1 normal; 13 | LosTopos::Vec3d origin; 14 | double dx; 15 | const LosTopos::Array3d& phi; 16 | 17 | MarchingTilesHiRes(const LosTopos::Vec3d& origin_, double dx_, 18 | const LosTopos::Array3d& phi_) 19 | : tri(0), 20 | x(0), 21 | normal(0), 22 | origin(origin_), 23 | dx(dx_), 24 | phi(phi_), 25 | edge_cross() {} 26 | 27 | void contour(void); 28 | void improve_mesh(void); 29 | void estimate_normals(void); 30 | 31 | private: 32 | LosTopos::HashTable 33 | edge_cross; // stores vertices that have been created already at given 34 | // edge crossings 35 | 36 | double eval(double i, double j, 37 | double k); // interpolate if non-integer coordinates given 38 | void eval_gradient(double i, double j, double k, LosTopos::Vec3d& grad); 39 | void contour_tile(int i, int j, 40 | int k); // add triangles for contour in the given tile 41 | // (starting at grid point (4*i,4*j,4*k)) 42 | void contour_tet(const LosTopos::Vec3i& x0, const LosTopos::Vec3i& x1, 43 | const LosTopos::Vec3i& x2, const LosTopos::Vec3i& x3, 44 | double p0, double p1, double p2, double p3); 45 | int find_edge_cross(const LosTopos::Vec3i& x0, const LosTopos::Vec3i& x1, 46 | double p0, double p1); 47 | }; 48 | } // namespace LosTopos 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /LosTopos/common/newparser.h: -------------------------------------------------------------------------------- 1 | #ifndef NEWPARSER_H 2 | #define NEWPARSER_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | struct ParseTree { 12 | ParseTree() : branches(), numbers(), strings(), vectors() {} 13 | 14 | std::map branches; 15 | std::map numbers; 16 | std::map strings; 17 | std::map vectors; 18 | 19 | const ParseTree* get_branch(const std::string& name) const; 20 | bool get_number(const std::string& name, double& result) const; 21 | bool get_int(const std::string& name, int& result) const; 22 | bool get_string(const std::string& name, std::string& result) const; 23 | const LosTopos::Array1d* get_vector(const std::string& name) const; 24 | bool get_vec2d(const std::string& name, LosTopos::Vec2d& v) const; 25 | bool get_vec3d(const std::string& name, LosTopos::Vec3d& v) const; 26 | 27 | bool remove_first_matching_branch(const std::string& name); 28 | }; 29 | 30 | std::ostream& operator<<(std::ostream& out, const ParseTree& tree); 31 | 32 | // return true if no errors occur 33 | bool parse_stream(std::istream& input, ParseTree& tree); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /LosTopos/common/newsparse/dense_matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef DENSE_MATRIX_H 2 | #define DENSE_MATRIX_H 3 | 4 | #include 5 | 6 | //============================================================================ 7 | struct DenseMatrix : public LinearOperator { 8 | std::vector value; 9 | 10 | DenseMatrix(int m_ = 0) : LinearOperator(m_, m_), value(m_ * m_, 0) {} 11 | 12 | DenseMatrix(int m_, int n_) : LinearOperator(m_, n_), value(m_ * n_, 0) {} 13 | 14 | void clear(void); 15 | void set_zero(void); 16 | void resize(int m_, int n_); 17 | 18 | const double &operator()(int i, int j) const { 19 | assert(i >= 0 && i < m && j >= 0 && j < n); 20 | return value[i + j * m]; 21 | } 22 | 23 | double &operator()(int i, int j) { 24 | assert(i >= 0 && i < m && j >= 0 && j < n); 25 | return value[i + j * m]; 26 | } 27 | 28 | using LinearOperator::apply; 29 | using LinearOperator::apply_and_subtract; 30 | using LinearOperator::apply_transpose; 31 | using LinearOperator::apply_transpose_and_subtract; 32 | 33 | virtual void apply(const double *input_vector, double *output_vector) const; 34 | virtual void apply_and_subtract(const double *x, const double *y, 35 | double *z) const; 36 | virtual void apply_transpose(const double *input_vector, 37 | double *output_vector) const; 38 | virtual void apply_transpose_and_subtract(const double *x, const double *y, 39 | double *z) const; 40 | virtual void write_matlab(std::ostream &output, 41 | const char *variable_name) const; 42 | }; 43 | 44 | void transpose(const DenseMatrix &A, DenseMatrix &Atranspose); 45 | void multiply(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &C); 46 | void multiply_with_transpose(const DenseMatrix &A, DenseMatrix &ATA); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /LosTopos/common/runstats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * runstats.h 3 | * 4 | * Created by tyson on 21/04/11. 5 | * 6 | */ 7 | 8 | // Hold some runtime stats 9 | 10 | #ifndef RUNSTATS_H 11 | #define RUNSTATS_H 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace LosTopos { 20 | 21 | class RunStats { 22 | public: 23 | RunStats() 24 | : int_stats(), 25 | double_stats(), 26 | per_frame_int_stats(), 27 | per_frame_double_stats() {} 28 | 29 | typedef std::pair PerFrameInt; 30 | typedef std::pair PerFrameDouble; 31 | 32 | void set_int(std::string name, int64_t value); 33 | void add_to_int(std::string name, int64_t increment); 34 | int64_t get_int(std::string name); 35 | bool get_int(std::string name, int64_t& value); 36 | void update_min_int(std::string name, int64_t value); 37 | void update_max_int(std::string name, int64_t value); 38 | 39 | void set_double(std::string name, double value); 40 | void add_to_double(std::string name, double increment); 41 | double get_double(std::string name); 42 | bool get_double(std::string name, double& value); 43 | void update_min_double(std::string name, double value); 44 | void update_max_double(std::string name, double value); 45 | 46 | void add_per_frame_int(std::string name, int frame, int64_t value); 47 | bool get_per_frame_ints(std::string name, std::vector& sequence); 48 | 49 | void add_per_frame_double(std::string name, int frame, double value); 50 | bool get_per_frame_doubles(std::string name, 51 | std::vector& sequence); 52 | 53 | void write_to_file(const char* filename); 54 | 55 | void clear(); 56 | 57 | private: 58 | std::map int_stats; 59 | std::map double_stats; 60 | 61 | std::map > per_frame_int_stats; 62 | std::map > per_frame_double_stats; 63 | }; 64 | 65 | } // namespace LosTopos 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /LosTopos/common/tunicate/fenv_include.h: -------------------------------------------------------------------------------- 1 | #ifndef FENVINCLUDE_H 2 | #define FENVINCLUDE_H 3 | 4 | #ifndef _MSC_VER 5 | 6 | // if not Windows, include the standard fenv.v.h 7 | #include 8 | 9 | #else 10 | 11 | // on Windows, cook up the functions we need 12 | #include 13 | #include 14 | #include 15 | 16 | //#pragma fenv_access(on) 17 | 18 | // define the functions we need. I hate Microsoft! Just implement C99 already, 19 | // c'mon. 20 | #define FE_DOWNWARD _RC_DOWN 21 | #define FE_UPWARD _RC_UP 22 | #define FE_TONEAREST _RC_NEAR 23 | #define FE_TOWARDZERO _RC_CHOP 24 | 25 | #include 26 | 27 | inline int fegetround() { 28 | unsigned int result; 29 | errno_t err = _controlfp_s(&result, 0, 0); 30 | result = result & _MCW_RC; 31 | return (int)result; 32 | } 33 | 34 | inline void fesetround(unsigned int choice) { 35 | unsigned int result; 36 | int err = _controlfp_s(&result, choice, _MCW_RC); 37 | } 38 | 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /LosTopos/common/tunicate/interval.cpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------- 2 | // 3 | // interval.cpp 4 | // Tyson Brochu 2011 5 | // 6 | // Function definitions for switching rounding modes. 7 | // 8 | // --------------------------------------------------------- 9 | 10 | #include 11 | 12 | int Interval::s_previous_rounding_mode = ~0; 13 | -------------------------------------------------------------------------------- /LosTopos/common/tunicate/neg.cpp: -------------------------------------------------------------------------------- 1 | // Released into the public domain by Robert Bridson, 2009. 2 | 3 | #include 4 | 5 | //============================================================================== 6 | // Try to force the compiler to add a negative instead of subtracting. 7 | // (i.e. write a+neg(b) since a+(-b) is erroneously simplified to a-b) 8 | // Aggressive (and well-intentioned but *wrong*) inter-procedural analysis 9 | // performed by the compiler at link time could defeat this; you might have 10 | // to struggle with your compiler. 11 | 12 | double neg(double x) { return -x; } 13 | -------------------------------------------------------------------------------- /LosTopos/common/tunicate/neg.h: -------------------------------------------------------------------------------- 1 | #ifndef NEG_H 2 | #define NEG_H 3 | 4 | // Released into the public domain by Robert Bridson, 2009. 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | double neg(double x); 11 | 12 | #ifdef __cplusplus 13 | } // end of extern "C" block 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /LosTopos/common/vector_math.h: -------------------------------------------------------------------------------- 1 | #ifndef VECTOR_MATH_H 2 | #define VECTOR_MATH_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | template 10 | T sum(std::vector& data) { 11 | T result = 0; 12 | for (unsigned int i = 0; i < data.size(); ++i) result += data[i]; 13 | return result; 14 | } 15 | 16 | template 17 | void copy(const std::vector& src, std::vector& dest) { 18 | std::copy(src.begin(), src.end(), dest.begin()); 19 | } 20 | 21 | template 22 | T dot(const std::vector& a, const std::vector& b) { 23 | return Eigen::Map>(a.data(), 24 | a.size()) 25 | .dot(Eigen::Map>(b.data(), 26 | a.size())); 27 | } 28 | 29 | template 30 | void scale(T factor, std::vector& data) { 31 | Eigen::Map>(data.data(), data.size()) *= 32 | factor; 33 | } 34 | 35 | template 36 | void add_scaled(T alpha, const std::vector& x, 37 | std::vector& y) { // y = y + alpha*x 38 | Eigen::Map>(y.data(), x.size()) += 39 | Eigen::Map>(x.data(), 40 | x.size()) * 41 | alpha; 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /LosTopos/common/wallclocktime.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifdef _MSC_VER 4 | 5 | #include 6 | 7 | namespace LosTopos { 8 | static unsigned __int64 timer_frequency; 9 | static unsigned __int64 base_time; 10 | 11 | void set_time_base(void) { 12 | QueryPerformanceFrequency((LARGE_INTEGER*)&timer_frequency); 13 | QueryPerformanceCounter((LARGE_INTEGER*)&base_time); 14 | } 15 | 16 | double get_time_in_seconds(void) { 17 | unsigned __int64 newtime; 18 | QueryPerformanceCounter((LARGE_INTEGER*)&newtime); 19 | return (double)(newtime - base_time) / (double)timer_frequency; 20 | } 21 | } // namespace LosTopos 22 | #else 23 | 24 | #include 25 | #include 26 | 27 | namespace LosTopos { 28 | 29 | static long base_seconds = 0; 30 | 31 | void set_time_base(void) { 32 | struct timeval tv; 33 | struct timezone tz; 34 | gettimeofday(&tv, &tz); 35 | base_seconds = tv.tv_sec; 36 | } 37 | 38 | double get_time_in_seconds(void) { 39 | struct timeval tv; 40 | struct timezone tz; 41 | gettimeofday(&tv, &tz); 42 | return 0.000001 * tv.tv_usec + (tv.tv_sec - base_seconds); 43 | } 44 | } // namespace LosTopos 45 | #endif 46 | -------------------------------------------------------------------------------- /LosTopos/common/wallclocktime.h: -------------------------------------------------------------------------------- 1 | #ifndef WALLCLOCKTIME_H 2 | #define WALLCLOCKTIME_H 3 | 4 | namespace LosTopos { 5 | 6 | void set_time_base(void); 7 | double get_time_in_seconds(void); 8 | 9 | } // namespace LosTopos 10 | #endif 11 | -------------------------------------------------------------------------------- /assets/barrel.txt: -------------------------------------------------------------------------------- 1 | scene barrel 2 | time-step 0.01 3 | simulation-time 10.0 4 | implicit-integration 0 5 | smoothing-coef 0 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 0 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 1 22 | 23 | mesh-size-n 24 24 | mesh-size-m 10 25 | -------------------------------------------------------------------------------- /assets/bubblewand.txt: -------------------------------------------------------------------------------- 1 | scene bubblewand 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 1 6 | damping-coef 1 7 | sigma 0.2 8 | 9 | remeshing-resolution 0.25 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 12 25 | -------------------------------------------------------------------------------- /assets/carousel.txt: -------------------------------------------------------------------------------- 1 | scene carousel 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | sigma 1 8 | 9 | remeshing-resolution 0.4 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 24 25 | mesh-size-m 30 26 | -------------------------------------------------------------------------------- /assets/constrainedsphere.txt: -------------------------------------------------------------------------------- 1 | scene constrainedsphere 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 3 24 | -------------------------------------------------------------------------------- /assets/cube.txt: -------------------------------------------------------------------------------- 1 | scene cube 2 | time-step 0.01 3 | simulation-time 100.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | fmmtl 1 8 | 9 | remeshing-resolution 0.1 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 2 25 | -------------------------------------------------------------------------------- /assets/doublebubble-load.txt: -------------------------------------------------------------------------------- 1 | scene load 2 | load-dir dbg_db48_mvd_gs_imnm_mpsubdiv_pwsmooth_smoothing1.0 3 | time-step 0.01 4 | simulation-time 1000.0 5 | implicit-integration 0 6 | smoothing-coef 0 7 | damping-coef 1 8 | 9 | remeshing-resolution 0 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 1 23 | 24 | mesh-size-n 24 25 | mesh-size-m 24 26 | -------------------------------------------------------------------------------- /assets/doublebubble.txt: -------------------------------------------------------------------------------- 1 | scene doublebubble 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 24 24 | mesh-size-m 24 25 | -------------------------------------------------------------------------------- /assets/foam.txt: -------------------------------------------------------------------------------- 1 | scene foam 2 | load-dir foamnormalflowed 3 | time-step 0.01 4 | simulation-time 1000.0 5 | implicit-integration 0 6 | smoothing-coef 10 7 | damping-coef 1 8 | 9 | remeshing-resolution 0.1 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 1 25 | mesh-size-m 10 -------------------------------------------------------------------------------- /assets/foaminit.txt: -------------------------------------------------------------------------------- 1 | scene foaminit 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 0.001 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 1 24 | mesh-size-m 10 -------------------------------------------------------------------------------- /assets/octahedron.txt: -------------------------------------------------------------------------------- 1 | scene octahedron 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 5 6 | damping-coef 1 7 | 8 | remeshing-resolution 0.1 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 0 24 | -------------------------------------------------------------------------------- /assets/peanutbubble.txt: -------------------------------------------------------------------------------- 1 | scene peanutbubble 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | 8 | remeshing-resolution 0.05 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 24 24 | mesh-size-m 30 25 | -------------------------------------------------------------------------------- /assets/pullingfoam.txt: -------------------------------------------------------------------------------- 1 | scene pullingfoam 2 | load-dir foaminit 3 | time-step 0.01 4 | simulation-time 1000.0 5 | implicit-integration 0 6 | smoothing-coef 10 7 | damping-coef 1 8 | 9 | remeshing-resolution 0.08 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.5 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 1 25 | mesh-size-m 10 -------------------------------------------------------------------------------- /assets/quadjunction.txt: -------------------------------------------------------------------------------- 1 | scene quadjunction 2 | time-step 0.01 3 | simulation-time 100.0 4 | implicit-integration 0 5 | smoothing-coef 1 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 0 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 1 22 | 23 | mesh-size-n 2 24 | -------------------------------------------------------------------------------- /assets/sheet.txt: -------------------------------------------------------------------------------- 1 | scene sheet 2 | time-step 0.001 3 | simulation-time 10.0 4 | implicit-integration 0 5 | smoothing-coef 1 6 | damping-coef 1 7 | sigma 1.0 8 | bending 150.0 9 | stretching 5000.0 10 | gravity 9.8 11 | radius 0.003 12 | 13 | remeshing-resolution 0.25 14 | remeshing-iterations 2 15 | 16 | lostopos-collision-epsilon-fraction 1e-4 17 | lostopos-merge-proximity-epsilon-fraction 0.1 18 | lostopos-perform-smoothing 0 19 | lostopos-max-volume-change-fraction 1e-2 20 | lostopos-min-triangle-angle 3 21 | lostopos-max-triangle-angle 177 22 | lostopos-large-triangle-angle-to-split 160 23 | lostopos-min-triangle-area-fraction 0.02 24 | lostopos-t1-transition-enabled 1 25 | lostopos-t1-pull-apart-distance-fraction 0.1 26 | lostopos-smooth-subdivision 0 27 | 28 | mesh-size-n 2 29 | -------------------------------------------------------------------------------- /assets/sphere-load.txt: -------------------------------------------------------------------------------- 1 | scene load 2 | load-dir dbg_sph2_rpc 3 | time-step 0.01 4 | simulation-time 1000.0 5 | implicit-integration 0 6 | smoothing-coef 0 7 | damping-coef 1 8 | 9 | remeshing-resolution 0 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 2 25 | -------------------------------------------------------------------------------- /assets/sphere.txt: -------------------------------------------------------------------------------- 1 | scene sphere 2 | time-step 0.01 3 | simulation-time 100.0 4 | implicit-integration 1 5 | pbd-implicit 0 6 | smoothing-coef 0 7 | damping-coef 1 8 | 9 | remeshing-resolution 0 10 | remeshing-iterations 0 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 2 25 | -------------------------------------------------------------------------------- /assets/straw.txt: -------------------------------------------------------------------------------- 1 | scene straw 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | sigma 1 8 | 9 | remeshing-resolution 0.25 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 24 25 | -------------------------------------------------------------------------------- /assets/tet.txt: -------------------------------------------------------------------------------- 1 | scene tet 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 3 24 | -------------------------------------------------------------------------------- /assets/triplejunction.txt: -------------------------------------------------------------------------------- 1 | scene triplejunction 2 | time-step 0.01 3 | simulation-time 10.0 4 | implicit-integration 0 5 | smoothing-coef 0 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 0 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 1 22 | 23 | mesh-size-n 2 24 | -------------------------------------------------------------------------------- /assets/twobubbles.txt: -------------------------------------------------------------------------------- 1 | scene twobubbles 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 10 6 | damping-coef 1 7 | 8 | remeshing-resolution 0 9 | remeshing-iterations 1 10 | 11 | lostopos-collision-epsilon-fraction 1e-4 12 | lostopos-merge-proximity-epsilon-fraction 0.1 13 | lostopos-perform-smoothing 0 14 | lostopos-max-volume-change-fraction 1e-2 15 | lostopos-min-triangle-angle 3 16 | lostopos-max-triangle-angle 177 17 | lostopos-large-triangle-angle-to-split 160 18 | lostopos-min-triangle-area-fraction 0.02 19 | lostopos-t1-transition-enabled 1 20 | lostopos-t1-pull-apart-distance-fraction 0.1 21 | lostopos-smooth-subdivision 0 22 | 23 | mesh-size-n 2 24 | -------------------------------------------------------------------------------- /assets/tworingspinching.txt: -------------------------------------------------------------------------------- 1 | scene tworingspinching 2 | time-step 0.01 3 | simulation-time 1000.0 4 | implicit-integration 0 5 | smoothing-coef 8 6 | damping-coef 1 7 | sigma 1 8 | 9 | remeshing-resolution 0.15 10 | remeshing-iterations 1 11 | 12 | lostopos-collision-epsilon-fraction 1e-4 13 | lostopos-merge-proximity-epsilon-fraction 0.1 14 | lostopos-perform-smoothing 0 15 | lostopos-max-volume-change-fraction 1e-2 16 | lostopos-min-triangle-angle 3 17 | lostopos-max-triangle-angle 177 18 | lostopos-large-triangle-angle-to-split 160 19 | lostopos-min-triangle-area-fraction 0.02 20 | lostopos-t1-transition-enabled 1 21 | lostopos-t1-pull-apart-distance-fraction 0.1 22 | lostopos-smooth-subdivision 0 23 | 24 | mesh-size-n 24 25 | -------------------------------------------------------------------------------- /bin/win64_bin.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raymondyfei/SoapFilm3D/2b4cd9cdc635c3bcdfb5c870489542835afe065b/bin/win64_bin.zip -------------------------------------------------------------------------------- /cmake/common.cmake: -------------------------------------------------------------------------------- 1 | # don't build in the source directory 2 | if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") 3 | message (SEND_ERROR "Do not build in the source directory.") 4 | message (FATAL_ERROR "Remove the created \"CMakeCache.txt\" file and the \"CMakeFiles\" directory, then create a build directory and call \"${CMAKE_COMMAND} \".") 5 | endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") 6 | 7 | # finds all files with a given extension 8 | macro (append_files files ext) 9 | foreach (dir ${ARGN}) 10 | file (GLOB _files "${dir}/*.${ext}") 11 | list (APPEND ${files} ${_files}) 12 | endforeach (dir) 13 | endmacro (append_files) 14 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Cholesky_Module Cholesky module 16 | * 17 | * 18 | * 19 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 20 | * Those decompositions are also accessible via the following methods: 21 | * - MatrixBase::llt() 22 | * - MatrixBase::ldlt() 23 | * - SelfAdjointView::llt() 24 | * - SelfAdjointView::ldlt() 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | */ 30 | 31 | #include "src/Cholesky/LLT.h" 32 | #include "src/Cholesky/LDLT.h" 33 | #ifdef EIGEN_USE_LAPACKE 34 | #include "src/misc/lapacke.h" 35 | #include "src/Cholesky/LLT_LAPACKE.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_CHOLESKY_MODULE_H 41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 42 | -------------------------------------------------------------------------------- /include/eigen/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup CholmodSupport_Module CholmodSupport module 21 | * 22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 23 | * It provides the two following main factorization classes: 24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 26 | * 27 | * For the sake of completeness, this module also propose the two following classes: 28 | * - class CholmodSimplicialLLT 29 | * - class CholmodSimplicialLDLT 30 | * Note that these classes does not bring any particular advantage compared to the built-in 31 | * SimplicialLLT and SimplicialLDLT factorization classes. 32 | * 33 | * \code 34 | * #include 35 | * \endcode 36 | * 37 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 38 | * The dependencies depend on how cholmod has been compiled. 39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 40 | * 41 | */ 42 | 43 | #include "src/CholmodSupport/CholmodSupport.h" 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 48 | 49 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_EIGENVALUES_MODULE_H 9 | #define EIGEN_EIGENVALUES_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Cholesky" 16 | #include "Jacobi" 17 | #include "Householder" 18 | #include "LU" 19 | #include "Geometry" 20 | 21 | /** \defgroup Eigenvalues_Module Eigenvalues module 22 | * 23 | * 24 | * 25 | * This module mainly provides various eigenvalue solvers. 26 | * This module also provides some MatrixBase methods, including: 27 | * - MatrixBase::eigenvalues(), 28 | * - MatrixBase::operatorNorm() 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/Eigenvalues/Tridiagonalization.h" 37 | #include "src/Eigenvalues/RealSchur.h" 38 | #include "src/Eigenvalues/EigenSolver.h" 39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 41 | #include "src/Eigenvalues/HessenbergDecomposition.h" 42 | #include "src/Eigenvalues/ComplexSchur.h" 43 | #include "src/Eigenvalues/ComplexEigenSolver.h" 44 | #include "src/Eigenvalues/RealQZ.h" 45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 47 | #ifdef EIGEN_USE_LAPACKE 48 | #include "src/misc/lapacke.h" 49 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 50 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 51 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 52 | #endif 53 | 54 | #include "src/Core/util/ReenableStupidWarnings.h" 55 | 56 | #endif // EIGEN_EIGENVALUES_MODULE_H 57 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 58 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_GEOMETRY_MODULE_H 9 | #define EIGEN_GEOMETRY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SVD" 16 | #include "LU" 17 | #include 18 | 19 | /** \defgroup Geometry_Module Geometry module 20 | * 21 | * This module provides support for: 22 | * - fixed-size homogeneous transformations 23 | * - translation, scaling, 2D and 3D rotations 24 | * - \link Quaternion quaternions \endlink 25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) 26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) 27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink 28 | * - \link AlignedBox axis aligned bounding boxes \endlink 29 | * - \link umeyama least-square transformation fitting \endlink 30 | * 31 | * \code 32 | * #include 33 | * \endcode 34 | */ 35 | 36 | #include "src/Geometry/OrthoMethods.h" 37 | #include "src/Geometry/EulerAngles.h" 38 | 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | // Use the SSE optimized version whenever possible. At the moment the 53 | // SSE version doesn't compile when AVX is enabled 54 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 55 | #include "src/Geometry/arch/Geometry_SSE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_GEOMETRY_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | 63 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 31 | -------------------------------------------------------------------------------- /include/eigen/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** 17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 18 | * 19 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 20 | * Those solvers are accessible via the following classes: 21 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 22 | * - LeastSquaresConjugateGradient for rectangular least-square problems, 23 | * - BiCGSTAB for general square matrices. 24 | * 25 | * These iterative solvers are associated with some preconditioners: 26 | * - IdentityPreconditioner - not really useful 27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. 28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding 29 | * 30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 49 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | 34 | -------------------------------------------------------------------------------- /include/eigen/Eigen/LU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_LU_MODULE_H 9 | #define EIGEN_LU_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup LU_Module LU module 16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 17 | * This module defines the following MatrixBase methods: 18 | * - MatrixBase::inverse() 19 | * - MatrixBase::determinant() 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/misc/Kernel.h" 27 | #include "src/misc/Image.h" 28 | #include "src/LU/FullPivLU.h" 29 | #include "src/LU/PartialPivLU.h" 30 | #ifdef EIGEN_USE_LAPACKE 31 | #include "src/misc/lapacke.h" 32 | #include "src/LU/PartialPivLU_LAPACKE.h" 33 | #endif 34 | #include "src/LU/Determinant.h" 35 | #include "src/LU/InverseImpl.h" 36 | 37 | // Use the SSE optimized version whenever possible. At the moment the 38 | // SSE version doesn't compile when AVX is enabled 39 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 40 | #include "src/LU/arch/Inverse_SSE.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_LU_MODULE_H 46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 47 | -------------------------------------------------------------------------------- /include/eigen/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /include/eigen/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 9 | #define EIGEN_PASTIXSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | #ifdef complex 21 | #undef complex 22 | #endif 23 | 24 | /** \ingroup Support_modules 25 | * \defgroup PaStiXSupport_Module PaStiXSupport module 26 | * 27 | * This module provides an interface to the PaSTiX library. 28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 29 | * It provides the two following main factorization classes: 30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | * 38 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. 39 | * The dependencies depend on how PaSTiX has been compiled. 40 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 41 | * 42 | */ 43 | 44 | #include "src/PaStiXSupport/PaStiXSupport.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 49 | -------------------------------------------------------------------------------- /include/eigen/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /include/eigen/Eigen/QR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QR_MODULE_H 9 | #define EIGEN_QR_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Cholesky" 16 | #include "Jacobi" 17 | #include "Householder" 18 | 19 | /** \defgroup QR_Module QR module 20 | * 21 | * 22 | * 23 | * This module provides various QR decompositions 24 | * This module also provides some MatrixBase methods, including: 25 | * - MatrixBase::householderQr() 26 | * - MatrixBase::colPivHouseholderQr() 27 | * - MatrixBase::fullPivHouseholderQr() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/QR/HouseholderQR.h" 35 | #include "src/QR/FullPivHouseholderQR.h" 36 | #include "src/QR/ColPivHouseholderQR.h" 37 | #include "src/QR/CompleteOrthogonalDecomposition.h" 38 | #ifdef EIGEN_USE_LAPACKE 39 | #include "src/misc/lapacke.h" 40 | #include "src/QR/HouseholderQR_LAPACKE.h" 41 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 42 | #endif 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_QR_MODULE_H 47 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 48 | -------------------------------------------------------------------------------- /include/eigen/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(std::size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, std::size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 9 | #define EIGEN_SPQRSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SuiteSparseQR.hpp" 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup SPQRSupport_Module SuiteSparseQR module 19 | * 20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SVD: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SVD_MODULE_H 9 | #define EIGEN_SVD_MODULE_H 10 | 11 | #include "QR" 12 | #include "Householder" 13 | #include "Jacobi" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup SVD_Module SVD module 18 | * 19 | * 20 | * 21 | * This module provides SVD decomposition for matrices (both real and complex). 22 | * Two decomposition algorithms are provided: 23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. 24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. 25 | * These decompositions are accessible via the respective classes and following MatrixBase methods: 26 | * - MatrixBase::jacobiSvd() 27 | * - MatrixBase::bdcSvd() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/misc/RealSvd2x2.h" 35 | #include "src/SVD/UpperBidiagonalization.h" 36 | #include "src/SVD/SVDBase.h" 37 | #include "src/SVD/JacobiSVD.h" 38 | #include "src/SVD/BDCSVD.h" 39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 40 | #include "src/misc/lapacke.h" 41 | #include "src/SVD/JacobiSVD_LAPACKE.h" 42 | #endif 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_SVD_MODULE_H 47 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 48 | -------------------------------------------------------------------------------- /include/eigen/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #ifndef EIGEN_MPL2_ONLY 29 | #include "SparseCholesky" 30 | #endif 31 | #include "SparseLU" 32 | #include "SparseQR" 33 | #include "IterativeLinearSolvers" 34 | 35 | #endif // EIGEN_SPARSE_MODULE_H 36 | 37 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2013 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 11 | #define EIGEN_SPARSECHOLESKY_MODULE_H 12 | 13 | #include "SparseCore" 14 | #include "OrderingMethods" 15 | 16 | #include "src/Core/util/DisableStupidWarnings.h" 17 | 18 | /** 19 | * \defgroup SparseCholesky_Module SparseCholesky module 20 | * 21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 22 | * Those decompositions are accessible via the following classes: 23 | * - SimplicialLLt, 24 | * - SimplicialLDLt 25 | * 26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #ifdef EIGEN_MPL2_ONLY 34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode 35 | #endif 36 | 37 | #include "src/SparseCholesky/SimplicialCholesky.h" 38 | 39 | #ifndef EIGEN_MPL2_ONLY 40 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 46 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSECORE_MODULE_H 9 | #define EIGEN_SPARSECORE_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /** 22 | * \defgroup SparseCore_Module SparseCore module 23 | * 24 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 25 | * and operations. 26 | * 27 | * See the \ref TutorialSparse "Sparse tutorial" 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | * 33 | * This module depends on: Core. 34 | */ 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/SparseAssign.h" 39 | #include "src/SparseCore/CompressedStorage.h" 40 | #include "src/SparseCore/AmbiVector.h" 41 | #include "src/SparseCore/SparseCompressedBase.h" 42 | #include "src/SparseCore/SparseMatrix.h" 43 | #include "src/SparseCore/SparseMap.h" 44 | #include "src/SparseCore/MappedSparseMatrix.h" 45 | #include "src/SparseCore/SparseVector.h" 46 | #include "src/SparseCore/SparseRef.h" 47 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 48 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 49 | #include "src/SparseCore/SparseTranspose.h" 50 | #include "src/SparseCore/SparseBlock.h" 51 | #include "src/SparseCore/SparseDot.h" 52 | #include "src/SparseCore/SparseRedux.h" 53 | #include "src/SparseCore/SparseView.h" 54 | #include "src/SparseCore/SparseDiagonalProduct.h" 55 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 56 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 57 | #include "src/SparseCore/SparseProduct.h" 58 | #include "src/SparseCore/SparseDenseProduct.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/SparseTriangularView.h" 61 | #include "src/SparseCore/TriangularSolver.h" 62 | #include "src/SparseCore/SparsePermutation.h" 63 | #include "src/SparseCore/SparseFuzzy.h" 64 | #include "src/SparseCore/SparseSolverBase.h" 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSECORE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | // Ordering interface 24 | #include "OrderingMethods" 25 | 26 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 27 | 28 | #include "src/SparseLU/SparseLU_Structs.h" 29 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 30 | #include "src/SparseLU/SparseLUImpl.h" 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseLU/SparseLU_Memory.h" 33 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 34 | #include "src/SparseLU/SparseLU_relax_snode.h" 35 | #include "src/SparseLU/SparseLU_pivotL.h" 36 | #include "src/SparseLU/SparseLU_panel_dfs.h" 37 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 38 | #include "src/SparseLU/SparseLU_panel_bmod.h" 39 | #include "src/SparseLU/SparseLU_column_dfs.h" 40 | #include "src/SparseLU/SparseLU_column_bmod.h" 41 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 42 | #include "src/SparseLU/SparseLU_pruneL.h" 43 | #include "src/SparseLU/SparseLU_Utils.h" 44 | #include "src/SparseLU/SparseLU.h" 45 | 46 | #endif // EIGEN_SPARSELU_MODULE_H 47 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSEQR_MODULE_H 9 | #define EIGEN_SPARSEQR_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup SparseQR_Module SparseQR module 16 | * \brief Provides QR decomposition for sparse matrices 17 | * 18 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 19 | * The columns of the input matrix should be reordered to limit the fill-in during the 20 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 21 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 22 | * of built-in and external ordering methods. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | * 28 | * 29 | */ 30 | 31 | #include "OrderingMethods" 32 | #include "src/SparseCore/SparseColEtree.h" 33 | #include "src/SparseQR/SparseQR.h" 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/eigen/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /include/eigen/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /include/eigen/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /include/eigen/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 9 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #ifdef EMPTY 16 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 17 | #endif 18 | 19 | typedef int int_t; 20 | #include 21 | #include 22 | #include 23 | 24 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 25 | // so we remove it in favor of a SUPERLU_EMPTY token. 26 | // If EMPTY was already defined then we don't undef it. 27 | 28 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 29 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 30 | #elif defined(EMPTY) 31 | # undef EMPTY 32 | #endif 33 | 34 | #define SUPERLU_EMPTY (-1) 35 | 36 | namespace Eigen { struct SluMatrix; } 37 | 38 | /** \ingroup Support_modules 39 | * \defgroup SuperLUSupport_Module SuperLUSupport module 40 | * 41 | * This module provides an interface to the SuperLU library. 42 | * It provides the following factorization class: 43 | * - class SuperLU: a supernodal sequential LU factorization. 44 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 45 | * 46 | * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. 47 | * 48 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 49 | * 50 | * \code 51 | * #include 52 | * \endcode 53 | * 54 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 55 | * The dependencies depend on how superlu has been compiled. 56 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 57 | * 58 | */ 59 | 60 | #include "src/SuperLUSupport/SuperLUSupport.h" 61 | 62 | #include "src/Core/util/ReenableStupidWarnings.h" 63 | 64 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 65 | -------------------------------------------------------------------------------- /include/eigen/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 9 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup UmfPackSupport_Module UmfPackSupport module 21 | * 22 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 23 | * It provides the following factorization class: 24 | * - class UmfPackLU: a multifrontal sequential LU factorization. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 31 | * The dependencies depend on how umfpack has been compiled. 32 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/UmfPackSupport/UmfPackSupport.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 41 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/DiagonalProduct.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2007-2009 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SELFCWISEBINARYOP_H 11 | #define EIGEN_SELFCWISEBINARYOP_H 12 | 13 | namespace Eigen { 14 | 15 | // TODO generalize the scalar type of 'other' 16 | 17 | template 18 | EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 19 | { 20 | typedef typename Derived::PlainObject PlainObject; 21 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 22 | return derived(); 23 | } 24 | 25 | template 26 | EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 27 | { 28 | typedef typename Derived::PlainObject PlainObject; 29 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 30 | return derived(); 31 | } 32 | 33 | template 34 | EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 35 | { 36 | typedef typename Derived::PlainObject PlainObject; 37 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 38 | return derived(); 39 | } 40 | 41 | template 42 | EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 43 | { 44 | typedef typename Derived::PlainObject PlainObject; 45 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 46 | return derived(); 47 | } 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_SELFCWISEBINARYOP_H 52 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_AVX_H 11 | #define EIGEN_TYPE_CASTING_AVX_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // For now we use SSE to handle integers, so we can't use AVX instructions to cast 18 | // from int to float 19 | template <> 20 | struct type_casting_traits { 21 | enum { 22 | VectorizedCast = 0, 23 | SrcCoeffRatio = 1, 24 | TgtCoeffRatio = 1 25 | }; 26 | }; 27 | 28 | template <> 29 | struct type_casting_traits { 30 | enum { 31 | VectorizedCast = 0, 32 | SrcCoeffRatio = 1, 33 | TgtCoeffRatio = 1 34 | }; 35 | }; 36 | 37 | 38 | 39 | template<> EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { 40 | return _mm256_cvtps_epi32(a); 41 | } 42 | 43 | template<> EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { 44 | return _mm256_cvtepi32_ps(a); 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_TYPE_CASTING_AVX_H 52 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_SSE_H 11 | #define EIGEN_TYPE_CASTING_SSE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template <> 18 | struct type_casting_traits { 19 | enum { 20 | VectorizedCast = 1, 21 | SrcCoeffRatio = 1, 22 | TgtCoeffRatio = 1 23 | }; 24 | }; 25 | 26 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 27 | return _mm_cvttps_epi32(a); 28 | } 29 | 30 | 31 | template <> 32 | struct type_casting_traits { 33 | enum { 34 | VectorizedCast = 1, 35 | SrcCoeffRatio = 1, 36 | TgtCoeffRatio = 1 37 | }; 38 | }; 39 | 40 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 41 | return _mm_cvtepi32_ps(a); 42 | } 43 | 44 | 45 | template <> 46 | struct type_casting_traits { 47 | enum { 48 | VectorizedCast = 1, 49 | SrcCoeffRatio = 2, 50 | TgtCoeffRatio = 1 51 | }; 52 | }; 53 | 54 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet2d& a, const Packet2d& b) { 55 | return _mm_shuffle_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b), (1 << 2) | (1 << 6)); 56 | } 57 | 58 | template <> 59 | struct type_casting_traits { 60 | enum { 61 | VectorizedCast = 1, 62 | SrcCoeffRatio = 1, 63 | TgtCoeffRatio = 2 64 | }; 65 | }; 66 | 67 | template<> EIGEN_STRONG_INLINE Packet2d pcast(const Packet4f& a) { 68 | // Simply discard the second half of the input 69 | return _mm_cvtps_pd(a); 70 | } 71 | 72 | 73 | } // end namespace internal 74 | 75 | } // end namespace Eigen 76 | 77 | #endif // EIGEN_TYPE_CASTING_SSE_H 78 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/functors/TernaryFunctors.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TERNARY_FUNCTORS_H 11 | #define EIGEN_TERNARY_FUNCTORS_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | //---------- associative ternary functors ---------- 18 | 19 | 20 | 21 | } // end namespace internal 22 | 23 | } // end namespace Eigen 24 | 25 | #endif // EIGEN_TERNARY_FUNCTORS_H 26 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #elif defined __GNUC__ && __GNUC__>=6 12 | #pragma GCC diagnostic pop 13 | #endif 14 | 15 | #if defined __NVCC__ 16 | // Don't reenable the diagnostic messages, as it turns out these messages need 17 | // to be disabled at the point of the template instantiation (i.e the user code) 18 | // otherwise they'll be triggered by nvcc. 19 | // #pragma diag_default code_is_unreachable 20 | // #pragma diag_default initialization_not_reachable 21 | // #pragma diag_default 2651 22 | // #pragma diag_default 2653 23 | #endif 24 | 25 | #endif 26 | 27 | #endif // EIGEN_WARNINGS_DISABLED 28 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MAPPED_SPARSEMATRIX_H 11 | #define EIGEN_MAPPED_SPARSEMATRIX_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated Use Map > 16 | * \class MappedSparseMatrix 17 | * 18 | * \brief Sparse matrix 19 | * 20 | * \param _Scalar the scalar type, i.e. the type of the coefficients 21 | * 22 | * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. 23 | * 24 | */ 25 | namespace internal { 26 | template 27 | struct traits > : traits > 28 | {}; 29 | } // end namespace internal 30 | 31 | template 32 | class MappedSparseMatrix 33 | : public Map > 34 | { 35 | typedef Map > Base; 36 | 37 | public: 38 | 39 | typedef typename Base::StorageIndex StorageIndex; 40 | typedef typename Base::Scalar Scalar; 41 | 42 | inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) 43 | : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) 44 | {} 45 | 46 | /** Empty destructor */ 47 | inline ~MappedSparseMatrix() {} 48 | }; 49 | 50 | namespace internal { 51 | 52 | template 53 | struct evaluator > 54 | : evaluator > > 55 | { 56 | typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType; 57 | typedef evaluator > Base; 58 | 59 | evaluator() : Base() {} 60 | explicit evaluator(const XprType &mat) : Base(mat) {} 61 | }; 62 | 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_MAPPED_SPARSEMATRIX_H 68 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | internal::evaluator thisEval(derived()); 22 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 24 | res += iter.value(); 25 | return res; 26 | } 27 | 28 | template 29 | typename internal::traits >::Scalar 30 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | if(this->isCompressed()) 34 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 35 | else 36 | return Base::sum(); 37 | } 38 | 39 | template 40 | typename internal::traits >::Scalar 41 | SparseVector<_Scalar,_Options,_Index>::sum() const 42 | { 43 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 44 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SPARSEREDUX_H 50 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | StorageIndex nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/misc/RealSvd2x2.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Benoit Jacob 5 | // Copyright (C) 2013-2016 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_REALSVD2X2_H 12 | #define EIGEN_REALSVD2X2_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 20 | JacobiRotation *j_left, 21 | JacobiRotation *j_right) 22 | { 23 | using std::sqrt; 24 | using std::abs; 25 | Matrix m; 26 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 27 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 28 | JacobiRotation rot1; 29 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 30 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 31 | 32 | if(abs(d) < (std::numeric_limits::min)()) 33 | { 34 | rot1.s() = RealScalar(0); 35 | rot1.c() = RealScalar(1); 36 | } 37 | else 38 | { 39 | // If d!=0, then t/d cannot overflow because the magnitude of the 40 | // entries forming d are not too small compared to the ones forming t. 41 | RealScalar u = t / d; 42 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 43 | rot1.s() = RealScalar(1) / tmp; 44 | rot1.c() = u / tmp; 45 | } 46 | m.applyOnTheLeft(0,1,rot1); 47 | j_right->makeJacobi(m,0,1); 48 | *j_left = rot1 * j_right->transpose(); 49 | } 50 | 51 | } // end namespace internal 52 | 53 | } // end namespace Eigen 54 | 55 | #endif // EIGEN_REALSVD2X2_H 56 | -------------------------------------------------------------------------------- /include/eigen/Eigen/src/misc/lapacke_mangling.h: -------------------------------------------------------------------------------- 1 | #ifndef LAPACK_HEADER_INCLUDED 2 | #define LAPACK_HEADER_INCLUDED 3 | 4 | #ifndef LAPACK_GLOBAL 5 | #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) 6 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 7 | #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) 8 | #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME 9 | #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) 10 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname 11 | #else 12 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 13 | #endif 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /include/eigen/signature_of_eigen3_matrix_library: -------------------------------------------------------------------------------- 1 | This file is just there as a signature to help identify directories containing Eigen3. When writing a script looking for Eigen3, just look for this file. This is especially useful to help disambiguate with Eigen2... 2 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/ArpackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_ARPACKSUPPORT_MODULE_H 10 | #define EIGEN_ARPACKSUPPORT_MODULE_H 11 | 12 | #include 13 | 14 | #include 15 | 16 | /** \defgroup ArpackSupport_Module Arpack support module 17 | * 18 | * This module provides a wrapper to Arpack, a library for sparse eigenvalue decomposition. 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include 26 | #include "src/Eigenvalues/ArpackSelfAdjointEigenSolver.h" 27 | 28 | #include 29 | 30 | #endif // EIGEN_ARPACKSUPPORT_MODULE_H 31 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 32 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/AutoDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_AUTODIFF_MODULE 11 | #define EIGEN_AUTODIFF_MODULE 12 | 13 | namespace Eigen { 14 | 15 | /** 16 | * \defgroup AutoDiff_Module Auto Diff module 17 | * 18 | * This module features forward automatic differentation via a simple 19 | * templated scalar type wrapper AutoDiffScalar. 20 | * 21 | * Warning : this should NOT be confused with numerical differentiation, which 22 | * is a different method and has its own module in Eigen : \ref NumericalDiff_Module. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | //@{ 29 | 30 | } 31 | 32 | #include "src/AutoDiff/AutoDiffScalar.h" 33 | // #include "src/AutoDiff/AutoDiffVector.h" 34 | #include "src/AutoDiff/AutoDiffJacobian.h" 35 | 36 | namespace Eigen { 37 | //@} 38 | } 39 | 40 | #endif // EIGEN_AUTODIFF_MODULE 41 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/TensorSymmetry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2013 Christian Seiler 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_TENSORSYMMETRY_MODULE 11 | #define EIGEN_CXX11_TENSORSYMMETRY_MODULE 12 | 13 | #include 14 | 15 | #include 16 | 17 | #include "src/util/CXX11Meta.h" 18 | 19 | /** \defgroup CXX11_TensorSymmetry_Module Tensor Symmetry Module 20 | * 21 | * This module provides a classes that allow for the definition of 22 | * symmetries w.r.t. tensor indices. 23 | * 24 | * Including this module will implicitly include the Tensor module. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | */ 30 | 31 | #include "src/TensorSymmetry/util/TemplateGroupTheory.h" 32 | #include "src/TensorSymmetry/Symmetry.h" 33 | #include "src/TensorSymmetry/StaticSymmetry.h" 34 | #include "src/TensorSymmetry/DynamicSymmetry.h" 35 | 36 | #include 37 | 38 | #endif // EIGEN_CXX11_TENSORSYMMETRY_MODULE 39 | 40 | /* 41 | * kate: space-indent on; indent-width 2; mixedindent off; indent-mode cstyle; 42 | */ 43 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/ThreadPool: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_MODULE 11 | #define EIGEN_CXX11_THREADPOOL_MODULE 12 | 13 | #include "../../../Eigen/Core" 14 | 15 | #include 16 | 17 | /** \defgroup CXX11_ThreadPool_Module C++11 ThreadPool Module 18 | * 19 | * This module provides 2 threadpool implementations 20 | * - a simple reference implementation 21 | * - a faster non blocking implementation 22 | * 23 | * This module requires C++11. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | 31 | // The code depends on CXX11, so only include the module if the 32 | // compiler supports it. 33 | #if __cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "src/util/CXX11Meta.h" 49 | #include "src/util/MaxSizeVector.h" 50 | 51 | #include "src/ThreadPool/ThreadLocal.h" 52 | #include "src/ThreadPool/ThreadYield.h" 53 | #include "src/ThreadPool/EventCount.h" 54 | #include "src/ThreadPool/RunQueue.h" 55 | #include "src/ThreadPool/ThreadPoolInterface.h" 56 | #include "src/ThreadPool/ThreadEnvironment.h" 57 | #include "src/ThreadPool/SimpleThreadPool.h" 58 | #include "src/ThreadPool/NonBlockingThreadPool.h" 59 | 60 | #endif 61 | 62 | #include 63 | 64 | #endif // EIGEN_CXX11_THREADPOOL_MODULE 65 | 66 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H 12 | 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | enum { 18 | ShardByRow = 0, 19 | ShardByCol = 1 20 | }; 21 | 22 | 23 | // Default Blocking Strategy 24 | template 25 | class TensorContractionBlocking { 26 | public: 27 | 28 | typedef typename LhsMapper::Scalar LhsScalar; 29 | typedef typename RhsMapper::Scalar RhsScalar; 30 | 31 | EIGEN_DEVICE_FUNC TensorContractionBlocking(Index k, Index m, Index n, Index num_threads = 1) : 32 | kc_(k), mc_(m), nc_(n) 33 | { 34 | if (ShardingType == ShardByCol) { 35 | computeProductBlockingSizes(kc_, mc_, nc_, num_threads); 36 | } 37 | else { 38 | computeProductBlockingSizes(kc_, nc_, mc_, num_threads); 39 | } 40 | } 41 | 42 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index kc() const { return kc_; } 43 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index mc() const { return mc_; } 44 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index nc() const { return nc_; } 45 | 46 | private: 47 | Index kc_; 48 | Index mc_; 49 | Index nc_; 50 | }; 51 | 52 | 53 | } // end namespace internal 54 | } // end namespace Eigen 55 | 56 | #endif // EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H 57 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | /** \cpp11 \returns an expression of the coefficient-wise betainc(\a x, \a a, \a b) to the given tensors. 16 | * 17 | * This function computes the regularized incomplete beta function (integral). 18 | * 19 | */ 20 | template 21 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const 22 | TensorCwiseTernaryOp, 23 | const ADerived, const BDerived, const XDerived> 24 | betainc(const ADerived& a, const BDerived& b, const XDerived& x) { 25 | return TensorCwiseTernaryOp< 26 | internal::scalar_betainc_op, const ADerived, 27 | const BDerived, const XDerived>( 28 | a, b, x, internal::scalar_betainc_op()); 29 | } 30 | 31 | } // end namespace Eigen 32 | 33 | #endif // EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 34 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H 12 | 13 | 14 | /** use this macro in sfinae selection in templated functions 15 | * 16 | * template::value , int >::type = 0 18 | * > 19 | * void foo(){} 20 | * 21 | * becomes => 22 | * 23 | * template::value ) 25 | * > 26 | * void foo(){} 27 | */ 28 | 29 | // SFINAE requires variadic templates 30 | #ifndef __CUDACC__ 31 | #if EIGEN_HAS_VARIADIC_TEMPLATES 32 | // SFINAE doesn't work for gcc <= 4.7 33 | #ifdef EIGEN_COMP_GNUC 34 | #if EIGEN_GNUC_AT_LEAST(4,8) 35 | #define EIGEN_HAS_SFINAE 36 | #endif 37 | #else 38 | #define EIGEN_HAS_SFINAE 39 | #endif 40 | #endif 41 | #endif 42 | 43 | #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \ 44 | typename internal::enable_if< ( __condition__ ) , int >::type = 0 45 | 46 | 47 | #if EIGEN_HAS_CONSTEXPR 48 | #define EIGEN_CONSTEXPR constexpr 49 | #else 50 | #define EIGEN_CONSTEXPR 51 | #endif 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 12 | 13 | namespace Eigen { 14 | 15 | struct StlThreadEnvironment { 16 | struct Task { 17 | std::function f; 18 | }; 19 | 20 | // EnvThread constructor must start the thread, 21 | // destructor must join the thread. 22 | class EnvThread { 23 | public: 24 | EnvThread(std::function f) : thr_(std::move(f)) {} 25 | ~EnvThread() { thr_.join(); } 26 | 27 | private: 28 | std::thread thr_; 29 | }; 30 | 31 | EnvThread* CreateThread(std::function f) { return new EnvThread(std::move(f)); } 32 | Task CreateTask(std::function f) { return Task{std::move(f)}; } 33 | void ExecuteTask(const Task& t) { t.f(); } 34 | }; 35 | 36 | } // namespace Eigen 37 | 38 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 39 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 12 | 13 | // Try to come up with a portable implementation of thread local variables 14 | #if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) 15 | #define EIGEN_THREAD_LOCAL static __thread 16 | #elif EIGEN_COMP_CLANG 17 | #define EIGEN_THREAD_LOCAL static __thread 18 | #else 19 | #define EIGEN_THREAD_LOCAL static thread_local 20 | #endif 21 | 22 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 23 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 12 | 13 | namespace Eigen { 14 | 15 | // This defines an interface that ThreadPoolDevice can take to use 16 | // custom thread pools underneath. 17 | class ThreadPoolInterface { 18 | public: 19 | virtual void Schedule(std::function fn) = 0; 20 | 21 | // Returns the number of threads in the pool. 22 | virtual int NumThreads() const = 0; 23 | 24 | // Returns a logical thread index between 0 and NumThreads() - 1 if called 25 | // from one of the threads in the pool. Returns -1 otherwise. 26 | virtual int CurrentThreadId() const = 0; 27 | 28 | virtual ~ThreadPoolInterface() {} 29 | }; 30 | 31 | } // namespace Eigen 32 | 33 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 34 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 12 | 13 | // Try to come up with a portable way to yield 14 | #if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) 15 | #define EIGEN_THREAD_YIELD() sched_yield() 16 | #else 17 | #define EIGEN_THREAD_YIELD() std::this_thread::yield() 18 | #endif 19 | 20 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 21 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/EulerAngles: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Tal Hadad 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_EULERANGLES_MODULE_H 11 | #define EIGEN_EULERANGLES_MODULE_H 12 | 13 | 14 | #include "Eigen/Core" 15 | #include "Eigen/Geometry" 16 | 17 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 18 | 19 | namespace Eigen { 20 | 21 | /** 22 | * \defgroup EulerAngles_Module EulerAngles module 23 | * \brief This module provides generic euler angles rotation. 24 | * 25 | * Euler angles are a way to represent 3D rotation. 26 | * 27 | * In order to use this module in your code, include this header: 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * See \ref EulerAngles for more information. 33 | * 34 | */ 35 | 36 | } 37 | 38 | #include "src/EulerAngles/EulerSystem.h" 39 | #include "src/EulerAngles/EulerAngles.h" 40 | 41 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_EULERANGLES_MODULE_H 44 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/IterativeSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_ITERATIVE_SOLVERS_MODULE_H 11 | #define EIGEN_ITERATIVE_SOLVERS_MODULE_H 12 | 13 | #include 14 | 15 | /** 16 | * \defgroup IterativeSolvers_Module Iterative solvers module 17 | * This module aims to provide various iterative linear and non linear solver algorithms. 18 | * It currently provides: 19 | * - a constrained conjugate gradient 20 | * - a Householder GMRES implementation 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | //@{ 26 | 27 | #ifndef EIGEN_MPL2_ONLY 28 | #include "src/IterativeSolvers/IterationController.h" 29 | #include "src/IterativeSolvers/ConstrainedConjGrad.h" 30 | #endif 31 | 32 | #include "src/IterativeSolvers/IncompleteLU.h" 33 | #include "../../Eigen/Jacobi" 34 | #include "../../Eigen/Householder" 35 | #include "src/IterativeSolvers/GMRES.h" 36 | #include "src/IterativeSolvers/DGMRES.h" 37 | //#include "src/IterativeSolvers/SSORPreconditioner.h" 38 | #include "src/IterativeSolvers/MINRES.h" 39 | 40 | //@} 41 | 42 | #endif // EIGEN_ITERATIVE_SOLVERS_MODULE_H 43 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/KroneckerProduct: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_KRONECKER_PRODUCT_MODULE_H 10 | #define EIGEN_KRONECKER_PRODUCT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 15 | 16 | #include "../../Eigen/src/SparseCore/SparseUtil.h" 17 | 18 | namespace Eigen { 19 | 20 | /** 21 | * \defgroup KroneckerProduct_Module KroneckerProduct module 22 | * 23 | * This module contains an experimental Kronecker product implementation. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | } // namespace Eigen 31 | 32 | #include "src/KroneckerProduct/KroneckerTensorProduct.h" 33 | 34 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H 37 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/LevenbergMarquardt: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_LEVENBERGMARQUARDT_MODULE 11 | #define EIGEN_LEVENBERGMARQUARDT_MODULE 12 | 13 | // #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | /** 23 | * \defgroup LevenbergMarquardt_Module Levenberg-Marquardt module 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | * 29 | * 30 | */ 31 | 32 | #include "Eigen/SparseCore" 33 | #ifndef EIGEN_PARSED_BY_DOXYGEN 34 | 35 | #include "src/LevenbergMarquardt/LMqrsolv.h" 36 | #include "src/LevenbergMarquardt/LMcovar.h" 37 | #include "src/LevenbergMarquardt/LMpar.h" 38 | 39 | #endif 40 | 41 | #include "src/LevenbergMarquardt/LevenbergMarquardt.h" 42 | #include "src/LevenbergMarquardt/LMonestep.h" 43 | 44 | 45 | #endif // EIGEN_LEVENBERGMARQUARDT_MODULE 46 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/MoreVectorization: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_MOREVECTORIZATION_MODULE_H 10 | #define EIGEN_MOREVECTORIZATION_MODULE_H 11 | 12 | #include 13 | 14 | namespace Eigen { 15 | 16 | /** 17 | * \defgroup MoreVectorization More vectorization module 18 | */ 19 | 20 | } 21 | 22 | #include "src/MoreVectorization/MathFunctions.h" 23 | 24 | #endif // EIGEN_MOREVECTORIZATION_MODULE_H 25 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/NumericalDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_NUMERICALDIFF_MODULE 11 | #define EIGEN_NUMERICALDIFF_MODULE 12 | 13 | #include 14 | 15 | namespace Eigen { 16 | 17 | /** 18 | * \defgroup NumericalDiff_Module Numerical differentiation module 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | * 24 | * See http://en.wikipedia.org/wiki/Numerical_differentiation 25 | * 26 | * Warning : this should NOT be confused with automatic differentiation, which 27 | * is a different method and has its own module in Eigen : \ref 28 | * AutoDiff_Module. 29 | * 30 | * Currently only "Forward" and "Central" schemes are implemented. Those 31 | * are basic methods, and there exist some more elaborated way of 32 | * computing such approximates. They are implemented using both 33 | * proprietary and free software, and usually requires linking to an 34 | * external library. It is very easy for you to write a functor 35 | * using such software, and the purpose is quite orthogonal to what we 36 | * want to achieve with Eigen. 37 | * 38 | * This is why we will not provide wrappers for every great numerical 39 | * differentiation software that exist, but should rather stick with those 40 | * basic ones, that still are useful for testing. 41 | * 42 | * Also, the \ref NonLinearOptimization_Module needs this in order to 43 | * provide full features compatibility with the original (c)minpack 44 | * package. 45 | * 46 | */ 47 | } 48 | 49 | //@{ 50 | 51 | #include "src/NumericalDiff/NumericalDiff.h" 52 | 53 | //@} 54 | 55 | 56 | #endif // EIGEN_NUMERICALDIFF_MODULE 57 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/Skyline: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_SKYLINE_MODULE_H 10 | #define EIGEN_SKYLINE_MODULE_H 11 | 12 | 13 | #include "Eigen/Core" 14 | 15 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * \defgroup Skyline_Module Skyline module 24 | * 25 | * 26 | * 27 | * 28 | */ 29 | 30 | #include "src/Skyline/SkylineUtil.h" 31 | #include "src/Skyline/SkylineMatrixBase.h" 32 | #include "src/Skyline/SkylineStorage.h" 33 | #include "src/Skyline/SkylineMatrix.h" 34 | #include "src/Skyline/SkylineInplaceLU.h" 35 | #include "src/Skyline/SkylineProduct.h" 36 | 37 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_SKYLINE_MODULE_H 40 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/SparseExtra: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_EXTRA_MODULE_H 11 | #define EIGEN_SPARSE_EXTRA_MODULE_H 12 | 13 | #include "../../Eigen/Sparse" 14 | 15 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef EIGEN_GOOGLEHASH_SUPPORT 26 | #include 27 | #endif 28 | 29 | /** 30 | * \defgroup SparseExtra_Module SparseExtra module 31 | * 32 | * This module contains some experimental features extending the sparse module. 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | */ 38 | 39 | 40 | #include "src/SparseExtra/DynamicSparseMatrix.h" 41 | #include "src/SparseExtra/BlockOfDynamicSparseMatrix.h" 42 | #include "src/SparseExtra/RandomSetter.h" 43 | 44 | #include "src/SparseExtra/MarketIO.h" 45 | 46 | #if !defined(_WIN32) 47 | #include 48 | #include "src/SparseExtra/MatrixMarketIterator.h" 49 | #endif 50 | 51 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 52 | 53 | #endif // EIGEN_SPARSE_EXTRA_MODULE_H 54 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/SpecialFunctions: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPECIALFUNCTIONS_MODULE 11 | #define EIGEN_SPECIALFUNCTIONS_MODULE 12 | 13 | #include 14 | 15 | #include "../../Eigen/Core" 16 | 17 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 18 | 19 | namespace Eigen { 20 | 21 | /** 22 | * \defgroup SpecialFunctions_Module Special math functions module 23 | * 24 | * This module features additional coefficient-wise math functions available 25 | * within the numext:: namespace for the scalar version, and as method and/or free 26 | * functions of Array. Those include: 27 | * 28 | * - erf 29 | * - erfc 30 | * - lgamma 31 | * - igamma 32 | * - igammac 33 | * - digamma 34 | * - polygamma 35 | * - zeta 36 | * - betainc 37 | * 38 | * \code 39 | * #include 40 | * \endcode 41 | */ 42 | //@{ 43 | 44 | } 45 | 46 | #include "src/SpecialFunctions/SpecialFunctionsImpl.h" 47 | #include "src/SpecialFunctions/SpecialFunctionsPacketMath.h" 48 | #include "src/SpecialFunctions/SpecialFunctionsHalf.h" 49 | #include "src/SpecialFunctions/SpecialFunctionsFunctors.h" 50 | #include "src/SpecialFunctions/SpecialFunctionsArrayAPI.h" 51 | 52 | #if defined EIGEN_VECTORIZE_CUDA 53 | #include "src/SpecialFunctions/arch/CUDA/CudaSpecialFunctions.h" 54 | #endif 55 | 56 | namespace Eigen { 57 | //@} 58 | } 59 | 60 | 61 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 62 | 63 | #endif // EIGEN_SPECIALFUNCTIONS_MODULE 64 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/Splines: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 20010-2011 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPLINES_MODULE_H 11 | #define EIGEN_SPLINES_MODULE_H 12 | 13 | namespace Eigen 14 | { 15 | /** 16 | * \defgroup Splines_Module Spline and spline fitting module 17 | * 18 | * This module provides a simple multi-dimensional spline class while 19 | * offering most basic functionality to fit a spline to point sets. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | } 26 | 27 | #include "src/Splines/SplineFwd.h" 28 | #include "src/Splines/Spline.h" 29 | #include "src/Splines/SplineFitting.h" 30 | 31 | #endif // EIGEN_SPLINES_MODULE_H 32 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/src/NonLinearOptimization/chkder.h: -------------------------------------------------------------------------------- 1 | #define chkder_log10e 0.43429448190325182765 2 | #define chkder_factor 100. 3 | 4 | namespace Eigen { 5 | 6 | namespace internal { 7 | 8 | template 9 | void chkder( 10 | const Matrix< Scalar, Dynamic, 1 > &x, 11 | const Matrix< Scalar, Dynamic, 1 > &fvec, 12 | const Matrix< Scalar, Dynamic, Dynamic > &fjac, 13 | Matrix< Scalar, Dynamic, 1 > &xp, 14 | const Matrix< Scalar, Dynamic, 1 > &fvecp, 15 | int mode, 16 | Matrix< Scalar, Dynamic, 1 > &err 17 | ) 18 | { 19 | using std::sqrt; 20 | using std::abs; 21 | using std::log; 22 | 23 | typedef DenseIndex Index; 24 | 25 | const Scalar eps = sqrt(NumTraits::epsilon()); 26 | const Scalar epsf = chkder_factor * NumTraits::epsilon(); 27 | const Scalar epslog = chkder_log10e * log(eps); 28 | Scalar temp; 29 | 30 | const Index m = fvec.size(), n = x.size(); 31 | 32 | if (mode != 2) { 33 | /* mode = 1. */ 34 | xp.resize(n); 35 | for (Index j = 0; j < n; ++j) { 36 | temp = eps * abs(x[j]); 37 | if (temp == 0.) 38 | temp = eps; 39 | xp[j] = x[j] + temp; 40 | } 41 | } 42 | else { 43 | /* mode = 2. */ 44 | err.setZero(m); 45 | for (Index j = 0; j < n; ++j) { 46 | temp = abs(x[j]); 47 | if (temp == 0.) 48 | temp = 1.; 49 | err += temp * fjac.col(j); 50 | } 51 | for (Index i = 0; i < m; ++i) { 52 | temp = 1.; 53 | if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i])) 54 | temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i])); 55 | err[i] = 1.; 56 | if (temp > NumTraits::epsilon() && temp < eps) 57 | err[i] = (chkder_log10e * log(temp) - epslog) / epslog; 58 | if (temp >= eps) 59 | err[i] = 0.; 60 | } 61 | } 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/src/NonLinearOptimization/covar.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void covar( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const VectorXi &ipvt, 9 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 10 | { 11 | using std::abs; 12 | typedef DenseIndex Index; 13 | 14 | /* Local variables */ 15 | Index i, j, k, l, ii, jj; 16 | bool sing; 17 | Scalar temp; 18 | 19 | /* Function Body */ 20 | const Index n = r.cols(); 21 | const Scalar tolr = tol * abs(r(0,0)); 22 | Matrix< Scalar, Dynamic, 1 > wa(n); 23 | eigen_assert(ipvt.size()==n); 24 | 25 | /* form the inverse of r in the full upper triangle of r. */ 26 | l = -1; 27 | for (k = 0; k < n; ++k) 28 | if (abs(r(k,k)) > tolr) { 29 | r(k,k) = 1. / r(k,k); 30 | for (j = 0; j <= k-1; ++j) { 31 | temp = r(k,k) * r(j,k); 32 | r(j,k) = 0.; 33 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 34 | } 35 | l = k; 36 | } 37 | 38 | /* form the full upper triangle of the inverse of (r transpose)*r */ 39 | /* in the full upper triangle of r. */ 40 | for (k = 0; k <= l; ++k) { 41 | for (j = 0; j <= k-1; ++j) 42 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 43 | r.col(k).head(k+1) *= r(k,k); 44 | } 45 | 46 | /* form the full lower triangle of the covariance matrix */ 47 | /* in the strict lower triangle of r and in wa. */ 48 | for (j = 0; j < n; ++j) { 49 | jj = ipvt[j]; 50 | sing = j > l; 51 | for (i = 0; i <= j; ++i) { 52 | if (sing) 53 | r(i,j) = 0.; 54 | ii = ipvt[i]; 55 | if (ii > jj) 56 | r(ii,jj) = r(i,j); 57 | if (ii < jj) 58 | r(jj,ii) = r(i,j); 59 | } 60 | wa[jj] = r(j,j); 61 | } 62 | 63 | /* symmetrize the covariance matrix in r. */ 64 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 65 | r.diagonal() = wa; 66 | } 67 | 68 | } // end namespace internal 69 | 70 | } // end namespace Eigen 71 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | DenseIndex fdjac1( 7 | const FunctorType &Functor, 8 | Matrix< Scalar, Dynamic, 1 > &x, 9 | Matrix< Scalar, Dynamic, 1 > &fvec, 10 | Matrix< Scalar, Dynamic, Dynamic > &fjac, 11 | DenseIndex ml, DenseIndex mu, 12 | Scalar epsfcn) 13 | { 14 | using std::sqrt; 15 | using std::abs; 16 | 17 | typedef DenseIndex Index; 18 | 19 | /* Local variables */ 20 | Scalar h; 21 | Index j, k; 22 | Scalar eps, temp; 23 | Index msum; 24 | int iflag; 25 | Index start, length; 26 | 27 | /* Function Body */ 28 | const Scalar epsmch = NumTraits::epsilon(); 29 | const Index n = x.size(); 30 | eigen_assert(fvec.size()==n); 31 | Matrix< Scalar, Dynamic, 1 > wa1(n); 32 | Matrix< Scalar, Dynamic, 1 > wa2(n); 33 | 34 | eps = sqrt((std::max)(epsfcn,epsmch)); 35 | msum = ml + mu + 1; 36 | if (msum >= n) { 37 | /* computation of dense approximate jacobian. */ 38 | for (j = 0; j < n; ++j) { 39 | temp = x[j]; 40 | h = eps * abs(temp); 41 | if (h == 0.) 42 | h = eps; 43 | x[j] = temp + h; 44 | iflag = Functor(x, wa1); 45 | if (iflag < 0) 46 | return iflag; 47 | x[j] = temp; 48 | fjac.col(j) = (wa1-fvec)/h; 49 | } 50 | 51 | }else { 52 | /* computation of banded approximate jacobian. */ 53 | for (k = 0; k < msum; ++k) { 54 | for (j = k; (msum<0) ? (j>n): (jn): (j(0,j-mu); 69 | length = (std::min)(n-1, j+ml) - start + 1; 70 | fjac.col(j).segment(start, length) = ( wa1.segment(start, length)-fvec.segment(start, length))/h; 71 | } 72 | } 73 | } 74 | return 0; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | // TODO : move this to GivensQR once there's such a thing in Eigen 6 | 7 | template 8 | void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector > &v_givens, const std::vector > &w_givens) 9 | { 10 | typedef DenseIndex Index; 11 | 12 | /* apply the first set of givens rotations to a. */ 13 | for (Index j = n-2; j>=0; --j) 14 | for (Index i = 0; i 6 | void rwupdt( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const Matrix< Scalar, Dynamic, 1> &w, 9 | Matrix< Scalar, Dynamic, 1> &b, 10 | Scalar alpha) 11 | { 12 | typedef DenseIndex Index; 13 | 14 | const Index n = r.cols(); 15 | eigen_assert(r.rows()>=n); 16 | std::vector > givens(n); 17 | 18 | /* Local variables */ 19 | Scalar temp, rowj; 20 | 21 | /* Function Body */ 22 | for (Index j = 0; j < n; ++j) { 23 | rowj = w[j]; 24 | 25 | /* apply the previous transformations to */ 26 | /* r(i,j), i=0,1,...,j-1, and to w(j). */ 27 | for (Index i = 0; i < j; ++i) { 28 | temp = givens[i].c() * r(i,j) + givens[i].s() * rowj; 29 | rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj; 30 | r(i,j) = temp; 31 | } 32 | 33 | /* determine a givens rotation which eliminates w(j). */ 34 | givens[j].makeGivens(-r(j,j), rowj); 35 | 36 | if (rowj == 0.) 37 | continue; // givens[j] is identity 38 | 39 | /* apply the current transformation to r(j,j), b(j), and alpha. */ 40 | r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj; 41 | temp = givens[j].c() * b[j] + givens[j].s() * alpha; 42 | alpha = -givens[j].s() * b[j] + givens[j].c() * alpha; 43 | b[j] = temp; 44 | } 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | -------------------------------------------------------------------------------- /include/eigen/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPECIALFUNCTIONS_HALF_H 9 | #define EIGEN_SPECIALFUNCTIONS_HALF_H 10 | 11 | namespace Eigen { 12 | namespace numext { 13 | 14 | #if EIGEN_HAS_C99_MATH 15 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) { 16 | return Eigen::half(Eigen::numext::lgamma(static_cast(a))); 17 | } 18 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half digamma(const Eigen::half& a) { 19 | return Eigen::half(Eigen::numext::digamma(static_cast(a))); 20 | } 21 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half zeta(const Eigen::half& x, const Eigen::half& q) { 22 | return Eigen::half(Eigen::numext::zeta(static_cast(x), static_cast(q))); 23 | } 24 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half polygamma(const Eigen::half& n, const Eigen::half& x) { 25 | return Eigen::half(Eigen::numext::polygamma(static_cast(n), static_cast(x))); 26 | } 27 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erf(const Eigen::half& a) { 28 | return Eigen::half(Eigen::numext::erf(static_cast(a))); 29 | } 30 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erfc(const Eigen::half& a) { 31 | return Eigen::half(Eigen::numext::erfc(static_cast(a))); 32 | } 33 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma(const Eigen::half& a, const Eigen::half& x) { 34 | return Eigen::half(Eigen::numext::igamma(static_cast(a), static_cast(x))); 35 | } 36 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igammac(const Eigen::half& a, const Eigen::half& x) { 37 | return Eigen::half(Eigen::numext::igammac(static_cast(a), static_cast(x))); 38 | } 39 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half betainc(const Eigen::half& a, const Eigen::half& b, const Eigen::half& x) { 40 | return Eigen::half(Eigen::numext::betainc(static_cast(a), static_cast(b), static_cast(x))); 41 | } 42 | #endif 43 | 44 | } // end namespace numext 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SPECIALFUNCTIONS_HALF_H 48 | --------------------------------------------------------------------------------