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

Raw File Download

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
content badge Iframe embedding
swh:1:cnt:c18cc54fbd97cd1220ea54a3641bbe6a5d87cded

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
#include "stdafx.h"
#include "geodesic_mesh.h"
#include "geodesic_algorithm_exact.h" 

using namespace std;

int main(int argc, char **argv)
{
	if(argc == 1)
	{
		cout <<endl << "OPTIONS: " << endl;
		cout << endl;

		cout << "-m [meshFile]: input model file." << endl << endl;
		cout << "-s [src]: index of source." << endl << endl;
		cout << "-o [outputFile]: output model file." << endl << endl;
		return -1;
	}

	char file_name[255] = {'\0'};
	char outputMesh[255] = {'\0'};
	unsigned source_vertex_index = 0; // Source Vertex

	for (int i = 1; i < argc;)
	{
		if (strcmp(argv[i], "-m") == 0)
		{
			strcpy_s(file_name, argv[i+1]); i+=2;
		}
		else if (strcmp(argv[i], "-s") == 0)
		{
			while (++i < argc && argv[i][0] != '-')
			{
				source_vertex_index = atoi(argv[i]);
				break;
			}
		}
		else if (strcmp(argv[i], "-o") == 0)
		{
			strcpy_s(outputMesh, argv[i+1]); i+=2;
		}
		else ++i;
	}

	std::vector<double> points;	
	std::vector<unsigned> faces;
	std::vector<int> realIndex;
	int originalVertNum = 0;
	
	std::cout << file_name << std::endl;

	// Load Mesh
	bool success = geodesic::read_mesh_from_file(file_name, points, faces, realIndex, originalVertNum);
	if(!success)
	{
		std::cout << "something is wrong with the input file" << std::endl;
		return -2;
	}

	std::cout << "Load Mesh Success..." << std::endl;
	
	// Build Mesh
	geodesic::Mesh mesh;
	mesh.initialize_mesh_data(points, faces);		//create internal mesh data structure including edges

	std::cout << "Build Mesh Success..." << std::endl;
	
	geodesic::GeodesicAlgorithmExact algorithm(&mesh);

	// Propagation
	algorithm.propagate(source_vertex_index);	//cover the whole mesh

	// Print Statistics
	std::cout << endl;
	algorithm.print_statistics();

	// Output Geodesic Distances
	if (outputMesh[0] != '\0')
	{
		ofstream output(outputMesh);

		for(unsigned i=0; i<mesh.vertices().size(); ++i)
		{
			double distance = mesh.vertices()[i].geodesic_distance();

			output << setprecision(20)<< distance <<endl;		//print geodesic distance for every vertex
		}

		output << endl;
		
		output.close();
	}

	std::cout << std::endl;

	return 0;
}

back to top

Software Heritage — Copyright (C) 2015–2025, 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