Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/penn-graphics-research/ziran2019
23 July 2020, 12:09:27 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • 0bca774
  • /
  • Lib
  • /
  • Ziran
  • /
  • Physics
  • /
  • LagrangianForce
  • /
  • LagrangianForce.h
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:8e2d32731d247e7d6bd1ca075a4e11d4d30a6529
origin badgedirectory badge
swh:1:dir:ea55178cc494830ba91a72f11883ac1d673f9dc9
origin badgerevision badge
swh:1:rev:8d3d27cd17bbceab18c317820dbe595178f6312a
origin badgesnapshot badge
swh:1:snp:60d230fd23a15f9241785ee90478bf9722d99dac

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 8d3d27cd17bbceab18c317820dbe595178f6312a authored by fangy14 on 06 November 2019, 07:20:57 UTC
open source
Tip revision: 8d3d27c
LagrangianForce.h
#ifndef LAGRANGIAN_FORCE_H
#define LAGRANGIAN_FORCE_H

#include <Ziran/CS/Util/Forward.h>
#include <Ziran/Math/Geometry/ElementManager.h>
#include <Eigen/Sparse>

namespace ZIRAN {

/**
This is the base class for computing forces on a collection of particles. The forces are usually functions of the lagrangian mesh node positions and velocities. Derived examples are hyperelastic FEM,
mass/spring etc.
**/

template <class T, int dim>
class LagrangianForce {
protected:
public:
    using TVStack = Matrix<T, dim, Eigen::Dynamic>;
    using Vec = Vector<T, Eigen::Dynamic>;
    using VecBlock = Eigen::VectorBlock<Vec>;
    using TV = Vector<T, dim>;

    LagrangianForce() {}
    virtual ~LagrangianForce() {}

    /**
       TODO: A nice comment.
     **/
    virtual void reinitialize() {}

    /**
       For those have element manager, override with the proper function
     */
    virtual bool isThisMyElementManager(ElementManager<T, dim>& em)
    {
        return false;
    }

    virtual void splatToPad(const T scale, const int pad_id) const {}

    virtual void splatDifferentialToPad(const T scale, const int pad_id, const TVStack& pad_dx) const {}

    /**
Often, force, energy and or force derivatives need to be computed without changing the particle state. When this is the case, it is efficient to precompute quantities that are needed for each of these
routines. This function call precomputes position based quantities used for each of the energy, force and force derivative routines at a given particle position state.
**/
    virtual void updatePositionBasedState() {}

    virtual void updatePositionBasedState(const StdVector<TV>& x) {}

    virtual void updatePositionDifferentialBasedState(const TVStack& dx) {}

    /**
This adds a scaled version of the force derivatives wrt to particles positions into newton_matrix. Force derivatives are typically only one of a few terms in the expression for the matrix used when
time stepping (e.g. backward Euler or quasistatics) the state of the particles. E.g. this can be used when setting up the linear system for both backward Euler and quasistatics.
**/
    virtual void addScaledStiffnessEntries(const T scale, Eigen::SparseMatrix<T, Eigen::RowMajor>& newton_matrix) const {}

    /**
This is analogous to addScaledstiffnessEntires but for matrix free solution of the equations needed in the time stepping.
df += scale*A*dx
**/
    virtual void addScaledForceDifferential(const T scale, const TVStack& dx, TVStack& df) const {}

    /**
This adds a scaled version of the force into the forces array. The Lagrangian force is typically only one of a few terms in the expression for the RHS used when
time stepping (e.g. backward Euler or quasistatics) the state of the particles. E.g. this can be used when setting up the linear system for both backward Euler and quasistatics.
**/
    virtual void addScaledForces(const T scale, TVStack& forces) const {}

    /**
This is mainly used for debugging tests, but it can be used for line search. It is not necessarily even defined for all Lagrangian forces.
**/
    virtual T totalEnergy() const { return (T)0; }

    /**
      This adds triplets to the triplet list for every nonzero entry of the matrix
**/
    virtual void initializeStiffnessSparsityPattern(StdVector<Eigen::Triplet<T>>& tripletList) const {}

    /**
     This updates any sparsity patern dependent state i.e a saved block matrix per element in FEM
**/
    virtual void updateStiffnessSparsityPatternBasedState(Eigen::SparseMatrix<T, Eigen::RowMajor>& newton_matrix) {}

    virtual void updateStrainWithFullImplicit() {}
};
} // namespace ZIRAN
#endif

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API