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/lsw9021/DexterousManipulation
13 October 2021, 00:36:27 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • 7cca30f
  • /
  • fem
  • /
  • Constraint
  • /
  • AttachmentCst.cpp
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:6eea0a5a8f2b55265c747f30ed48104d76e5f199
origin badgedirectory badge
swh:1:dir:7adf1921f8bba74d9a0923d92249b1e3d98bdf1e
origin badgerevision badge
swh:1:rev:11269e20e5283c3f31b6ce1ea9a4805c8bdeecac
origin badgesnapshot badge
swh:1:snp:39de196a0865c6816c958d6b123bc74f85735191

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 11269e20e5283c3f31b6ce1ea9a4805c8bdeecac authored by Lee Seung Hwan on 07 October 2021, 05:40:43 UTC
Create LICENSE
Tip revision: 11269e2
AttachmentCst.cpp
#include "AttachmentCst.h"

using namespace FEM;

AttachmentCst::
AttachmentCst(const std::string& name,double k,int i0,const Eigen::Vector3d& p)
	:Cst(name,k),mi0(i0),mp(p)
{
	mE = 0.0;
	mg.setZero();
	mH.setZero();
	md.setZero();
}
std::shared_ptr<Cst>
AttachmentCst::
Clone()
{
	return Create(mName,mStiffness,mi0,mp);
}
std::shared_ptr<AttachmentCst>
AttachmentCst::
Create(const std::string& name,double k,int i0,const Eigen::Vector3d& p)
{
	auto c = new AttachmentCst(name,k,i0,p);
	return std::shared_ptr<AttachmentCst>(c);
}
void
AttachmentCst::
EvaluatePotentialEnergy(const Eigen::VectorXd& x)
{
	mE = 0.5 * mStiffness * ((x.block<3,1>(mi0*3,0) - mp).squaredNorm());
}
void
AttachmentCst::
EvaluateGradient(const Eigen::VectorXd& x)
{
	mg = mStiffness*(x.block<3,1>(mi0*3,0) - mp);
}
void
AttachmentCst::
EvaluateHessian(const Eigen::VectorXd& x)
{
	Eigen::Vector3d kv;

	kv[0] = mStiffness;
	kv[1] = mStiffness;
	kv[2] = mStiffness;
	mH = kv.asDiagonal();
}
void
AttachmentCst::
GetPotentialEnergy(double& e)
{
	e += mE;
}
void
AttachmentCst::
GetGradient(Eigen::VectorXd& g)
{
	g.block<3,1>(mi0*3,0) += mg;
}
void
AttachmentCst::
GetHessian(std::vector<Eigen::Triplet<double>>& h_triplets)
{
	h_triplets.push_back(Eigen::Triplet<double>(3*mi0+0, 3*mi0+0, mH(0, 0)));
	h_triplets.push_back(Eigen::Triplet<double>(3*mi0+1, 3*mi0+1, mH(1, 1)));
	h_triplets.push_back(Eigen::Triplet<double>(3*mi0+2, 3*mi0+2, mH(2, 2)));
}
void
AttachmentCst::
EvaluateDVector(const Eigen::VectorXd& x)
{
	md = mp;
}
void
AttachmentCst::
GetDVector(int& index,Eigen::VectorXd& d)
{
	d.block<3,1>(index*3,0) = md;
	index++;
}
void
AttachmentCst::
EvaluateJMatrix(int& index, std::vector<Eigen::Triplet<double>>& J_triplets)
{
	J_triplets.push_back(Eigen::Triplet<double>(3*mi0+0, 3*index+0, mStiffness));
	J_triplets.push_back(Eigen::Triplet<double>(3*mi0+1, 3*index+1, mStiffness));
	J_triplets.push_back(Eigen::Triplet<double>(3*mi0+2, 3*index+2, mStiffness));
	index++;
}
void
AttachmentCst::
EvaluateLMatrix(std::vector<Eigen::Triplet<double>>& L_triplets)
{
	L_triplets.push_back(Eigen::Triplet<double>(3*mi0+0, 3*mi0+0, mStiffness));
	L_triplets.push_back(Eigen::Triplet<double>(3*mi0+1, 3*mi0+1, mStiffness));
	L_triplets.push_back(Eigen::Triplet<double>(3*mi0+2, 3*mi0+2, mStiffness));
}
int
AttachmentCst::
GetNumHessianTriplets()
{
	return 3;
}

void
AttachmentCst::
AddOffset(int offset)
{
	mi0 += offset;
}

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