Skip to content

Commit

Permalink
Added simplicial complex project
Browse files Browse the repository at this point in the history
Added a project on simplicial complexes. To do so, I added a
MeshSubset class to Core. When I rebuilt the documentation, links
starting with www didn't work, so I removed the www from the links
Keenan's website.
  • Loading branch information
Mark Gillespie authored and Mark Gillespie committed Jan 21, 2019
1 parent 8d90fd7 commit b2eef1d
Show file tree
Hide file tree
Showing 68 changed files with 15,662 additions and 276 deletions.
2 changes: 1 addition & 1 deletion core/discrete-exterior-calculus.js
@@ -1,7 +1,7 @@
"use strict";

/**
* This class contains methods to build common {@link https://www.cs.cmu.edu/~kmcrane/Projects/DDG/paper.pdf discrete exterior calculus} operators.
* This class contains methods to build common {@link https://cs.cmu.edu/~kmcrane/Projects/DDG/paper.pdf discrete exterior calculus} operators.
* @memberof module:Core
*/
class DEC {
Expand Down
2 changes: 1 addition & 1 deletion core/geometry.js
Expand Up @@ -245,7 +245,7 @@ class Geometry {

/**
* Computes the circumcentric dual area of a vertex.
* @see {@link http://www.cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSheet.pdf}
* @see {@link http://cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSheet.pdf}
* @method module:Core.Geometry#circumcentricDualArea
* @param {module:Core.Vertex} v The vertex whose circumcentric dual area needs to be computed.
* @returns {number}
Expand Down
214 changes: 214 additions & 0 deletions core/mesh-subset.js
@@ -0,0 +1,214 @@
"use strict";

class MeshSubset {
/**
* This class represents a subset of a {@link module:Core.Mesh Mesh}
* @constructor module:Core.MeshSubset
* @param {Set.<number>} vertices A set of the indices of the vertices which this subset should contain. Default value is the empty set.
* @param {Set.<number>} edges A set of the indices of the edges which this subset should contain. Default value is the empty set.
* @param {Set.<number>} faces A set of the indices of the faces which this subset should contain. Default value is the empty set.
* @property {Set.<number>} vertices The set of the indices of the vertices which this subset contains.
* @property {Set.<number>} edges The set of the indices of the edges which this subset contains.
* @property {Set.<number>} faces The set of the indices of the faces which this subset contains.
*/
constructor(vertices = new Set(), edges = new Set(), faces = new Set()) {
this.vertices = vertices;
this.edges = edges;
this.faces = faces;
}

/**
* Makes a copy of a {@link moduel:Core.MeshSubset}
* @method module:Core.MeshSubset.deepCopy
* @param {module:Core.MeshSubset} subset The subset to copy.
* @returns {module:Core.MeshSubset} A copy of the given subset.
*/
static deepCopy(subset) {
return new MeshSubset(new Set(subset.vertices),
new Set(subset.edges), new Set(subset.faces));
}

/**
* Resets this subset (i.e. empties out the vertex, edge, and face sets)
* @method module:Core.Meshsubset#reset
*/
reset() {
this.vertices = new Set();
this.edges = new Set();
this.faces = new Set();
}

/**
* Adds a vertex to this subset
* @method module:Core.MeshSubset#addVertex
* @param {number} vertex The index of the vertex to add.
*/
addVertex(vertex) {
this.vertices.add(vertex);
}

/**
* Adds set of vertices to this subset
* @method module:Core.MeshSubset#addVertices
* @param {Set.<number>} vertices The set of indices of vertices to add.
*/
addVertices(vertices) {
for (let v of vertices) {
this.addVertex(v);
}
}

/**
* Removes a vertex from this subset.
* @method module:Core.MeshSubset#deleteVertex
* @param {number} vertex The index of the vertex to remove.
*/
deleteVertex(vertex) {
this.vertices.delete(vertex);
}

/**
* Removes a set of vertices from this subset.
* @method module:Core.MeshSubset#deleteVertices
* @param {Set.<number>} vertices The indices of vertices to remove.
*/
deleteVertices(vertices) {
for (let v of vertices) {
this.deleteVertex(v);
}
}

/**
* Adds an edge to this subset
* @method module:Core.MeshSubset#addEdge
* @param {number} edge The index of the edge to add.
*/
addEdge(edge) {
this.edges.add(edge);
}

/**
* Adds set of edges to this subset
* @method module:Core.MeshSubset#addEdges
* @param {number} edges The set of indices of edges to add.
*/
addEdges(edges) {
for (let e of edges) {
this.addEdge(e);
}
}

/**
* Removes an edge from this subset.
* @method module:Core.MeshSubset#deleteEdge
* @param {number} edge The index of the edge to remove.
*/
deleteEdge(edge) {
this.edges.delete(edge);
}

/**
* Removes a set of edges from this subset.
* @method module:Core.MeshSubset#deleteEdges
* @param {Set.<number>} edges The indices of the edges to remove.
*/
deleteEdges(edges) {
for (let e of edges) {
this.deleteEdge(e);
}
}

/**
* Adds a face to this subset
* @method module:Core.MeshSubset#addFace
* @param {number} face The index of the face to add.
*/
addFace(face) {
this.faces.add(face);
}

/**
* Adds set of faces to this subset
* @method module:Core.MeshSubset#addFaces
* @param {number} faces The set of indices of faces to add.
*/
addFaces(faces) {
for (let f of faces) {
this.addFace(f);
}
}

/**
* Removes a face from this subset.
* @method module:Core.MeshSubset#deleteFace
* @param {number} face The index of the face to remove.
*/
deleteFace(face) {
this.faces.delete(face);
}

/**
* Removes a set of faces from this subset.
* @method module:Core.MeshSubset#deleteFaces
* @param {Set.<number>} faces The indices of the faces to remove.
*/
deleteFaces(fs) {
for (let f of fs) {
this.deleteFace(f);
}
}

/**
* Adds a subset's vertices, edges, and faces to this subset.
* @method module:Core.MeshSubset#addSubset
* @param {module:Core.MeshSubset} subset The subset to add in.
*/
addSubset(subset) {
this.addVertices(subset.vertices);
this.addEdges(subset.edges);
this.addFaces(subset.faces);
}

/**
* Removes a subset's vertices, edges, and faces from this subset.
* @method module:Core.MeshSubset#deleteSubset
* @param {module:Core.MeshSubset} subset The subset to remove.
*/
deleteSubset(subset) {
this.deleteVertices(subset.vertices);
this.deleteEdges(subset.edges);
this.deleteFaces(subset.faces);
}

/**
* Returns true if the input subset contains the same vertices, edges, and faces as
* this subset and false otherwise.
* @method module:Core.MeshSubset#equals
* @param {module:Core.MeshSubset} subset The subset to compare to.
*/
equals(subset) {
return this.setsEqual(this.vertices, subset.vertices)
&& this.setsEqual(this.edges, subset.edges)
&& this.setsEqual(this.faces, subset.faces);
}

/**
* Returns true if the two sets contain the same elements and false otherwise.
* @private
* @method module:Core.MeshSubset#setsEqual
* @param {Set.<number>} as A set of numbers.
* @param {Set.<number>} bs A set of numbers.
* @returns {boolean} True if the sets contain the same elements and false otherwise.
*/
setsEqual(as, bs) {
if (as.size != bs.size) {
return false
}
for (let a of as) {
if (!bs.has(a)) {
return false;
}
}
return true;
}
}
2 changes: 1 addition & 1 deletion core/mesh.js
Expand Up @@ -207,7 +207,7 @@ class Mesh {
}

// index elements
this.indexElements();
this.indexElements();

return true;
}
Expand Down
14 changes: 10 additions & 4 deletions docs/classes.list.html
Expand Up @@ -40,14 +40,14 @@
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="module-Core.Corner.html">Core.Corner</a></li><li><a href="module-Core.DEC.html">Core.DEC</a></li><li><a href="module-Core.Edge.html">Core.Edge</a></li><li><a href="module-Core.Face.html">Core.Face</a></li><li><a href="module-Core.Geometry.html">Core.Geometry</a></li><li><a href="module-Core.Halfedge.html">Core.Halfedge</a></li><li><a href="module-Core.Mesh.html">Core.Mesh</a></li><li><a href="module-Core.Vertex.html">Core.Vertex</a></li><li><a href="module-LinearAlgebra.ComplexDenseMatrix.html">LinearAlgebra.ComplexDenseMatrix</a></li><li><a href="module-LinearAlgebra.ComplexSparseMatrix.html">LinearAlgebra.ComplexSparseMatrix</a></li><li><a href="module-LinearAlgebra.ComplexTriplet.html">LinearAlgebra.ComplexTriplet</a></li><li><a href="module-LinearAlgebra.ComplexCholesky.html">LinearAlgebra.ComplexCholesky</a></li><li><a href="module-LinearAlgebra.ComplexLU.html">LinearAlgebra.ComplexLU</a></li><li><a href="module-LinearAlgebra.ComplexQR.html">LinearAlgebra.ComplexQR</a></li><li><a href="module-LinearAlgebra.Complex.html">LinearAlgebra.Complex</a></li><li><a href="module-LinearAlgebra.DenseMatrix.html">LinearAlgebra.DenseMatrix</a></li><li><a href="module-LinearAlgebra.EmscriptenMemoryManager.html">LinearAlgebra.EmscriptenMemoryManager</a></li><li><a href="module-LinearAlgebra.SparseMatrix.html">LinearAlgebra.SparseMatrix</a></li><li><a href="module-LinearAlgebra.Triplet.html">LinearAlgebra.Triplet</a></li><li><a href="module-LinearAlgebra.Cholesky.html">LinearAlgebra.Cholesky</a></li><li><a href="module-LinearAlgebra.LU.html">LinearAlgebra.LU</a></li><li><a href="module-LinearAlgebra.QR.html">LinearAlgebra.QR</a></li><li><a href="module-LinearAlgebra.Vector.html">LinearAlgebra.Vector</a></li><li><a href="module-Projects.TrivialConnections.html">Projects.TrivialConnections</a></li><li><a href="module-Projects.HeatMethod.html">Projects.HeatMethod</a></li><li><a href="module-Projects.MeanCurvatureFlow.html">Projects.MeanCurvatureFlow</a></li><li><a href="module-Projects.ModifiedMeanCurvatureFlow.html">Projects.ModifiedMeanCurvatureFlow</a></li><li><a href="module-Projects.BoundaryFirstFlattening.html">Projects.BoundaryFirstFlattening</a></li><li><a href="module-Projects.SpectralConformalParameterization.html">Projects.SpectralConformalParameterization</a></li><li><a href="module-Projects.ScalarPoissonProblem.html">Projects.ScalarPoissonProblem</a></li><li><a href="module-Projects.HarmonicBases.html">Projects.HarmonicBases</a></li><li><a href="module-Projects.HodgeDecomposition.html">Projects.HodgeDecomposition</a></li><li><a href="module-Projects.TreeCotree.html">Projects.TreeCotree</a></li><li><a href="module-Utils.Distortion.html">Utils.Distortion</a></li><li><a href="module-Utils.MeshIO.html">Utils.MeshIO</a></li><li><a href="module-Utils.Solvers.html">Utils.Solvers</a></li>
<li><a href="module-Core.Corner.html">Core.Corner</a></li><li><a href="module-Core.DEC.html">Core.DEC</a></li><li><a href="module-Core.Edge.html">Core.Edge</a></li><li><a href="module-Core.Face.html">Core.Face</a></li><li><a href="module-Core.Geometry.html">Core.Geometry</a></li><li><a href="module-Core.Halfedge.html">Core.Halfedge</a></li><li><a href="module-Core.MeshSubset.html">Core.MeshSubset</a></li><li><a href="module-Core.Mesh.html">Core.Mesh</a></li><li><a href="module-Core.Vertex.html">Core.Vertex</a></li><li><a href="module-LinearAlgebra.ComplexDenseMatrix.html">LinearAlgebra.ComplexDenseMatrix</a></li><li><a href="module-LinearAlgebra.ComplexSparseMatrix.html">LinearAlgebra.ComplexSparseMatrix</a></li><li><a href="module-LinearAlgebra.ComplexTriplet.html">LinearAlgebra.ComplexTriplet</a></li><li><a href="module-LinearAlgebra.ComplexCholesky.html">LinearAlgebra.ComplexCholesky</a></li><li><a href="module-LinearAlgebra.ComplexLU.html">LinearAlgebra.ComplexLU</a></li><li><a href="module-LinearAlgebra.ComplexQR.html">LinearAlgebra.ComplexQR</a></li><li><a href="module-LinearAlgebra.Complex.html">LinearAlgebra.Complex</a></li><li><a href="module-LinearAlgebra.DenseMatrix.html">LinearAlgebra.DenseMatrix</a></li><li><a href="module-LinearAlgebra.EmscriptenMemoryManager.html">LinearAlgebra.EmscriptenMemoryManager</a></li><li><a href="module-LinearAlgebra.SparseMatrix.html">LinearAlgebra.SparseMatrix</a></li><li><a href="module-LinearAlgebra.Triplet.html">LinearAlgebra.Triplet</a></li><li><a href="module-LinearAlgebra.Cholesky.html">LinearAlgebra.Cholesky</a></li><li><a href="module-LinearAlgebra.LU.html">LinearAlgebra.LU</a></li><li><a href="module-LinearAlgebra.QR.html">LinearAlgebra.QR</a></li><li><a href="module-LinearAlgebra.Vector.html">LinearAlgebra.Vector</a></li><li><a href="module-Projects.TrivialConnections.html">Projects.TrivialConnections</a></li><li><a href="module-Projects.HeatMethod.html">Projects.HeatMethod</a></li><li><a href="module-Projects.MeanCurvatureFlow.html">Projects.MeanCurvatureFlow</a></li><li><a href="module-Projects.ModifiedMeanCurvatureFlow.html">Projects.ModifiedMeanCurvatureFlow</a></li><li><a href="module-Projects.BoundaryFirstFlattening.html">Projects.BoundaryFirstFlattening</a></li><li><a href="module-Projects.SpectralConformalParameterization.html">Projects.SpectralConformalParameterization</a></li><li><a href="module-Projects.ScalarPoissonProblem.html">Projects.ScalarPoissonProblem</a></li><li><a href="module-Projects.SimplicialComplexOperators.html">Projects.SimplicialComplexOperators</a></li><li><a href="module-Projects.HarmonicBases.html">Projects.HarmonicBases</a></li><li><a href="module-Projects.HodgeDecomposition.html">Projects.HodgeDecomposition</a></li><li><a href="module-Projects.TreeCotree.html">Projects.TreeCotree</a></li><li><a href="module-Utils.Distortion.html">Utils.Distortion</a></li><li><a href="module-Utils.MeshIO.html">Utils.MeshIO</a></li><li><a href="module-Utils.Solvers.html">Utils.Solvers</a></li>
</ul>
</li>

<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#Detector">Detector</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
</ul>
</li>

Expand Down Expand Up @@ -167,6 +167,9 @@ <h3 class="subsection-title">Classes</h3>
<dt><a href="module-Core.Halfedge.html">Halfedge</a></dt>
<dd></dd>

<dt><a href="module-Core.MeshSubset.html">MeshSubset</a></dt>
<dd></dd>

<dt><a href="module-Core.Mesh.html">Mesh</a></dt>
<dd></dd>

Expand Down Expand Up @@ -239,6 +242,9 @@ <h3 class="subsection-title">Classes</h3>
<dt><a href="module-Projects.ScalarPoissonProblem.html">ScalarPoissonProblem</a></dt>
<dd></dd>

<dt><a href="module-Projects.SimplicialComplexOperators.html">SimplicialComplexOperators</a></dt>
<dd></dd>

<dt><a href="module-Projects.HarmonicBases.html">HarmonicBases</a></dt>
<dd></dd>

Expand Down Expand Up @@ -312,9 +318,9 @@ <h4 class="modal-title">Search results</h4>


<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on Sun Mar 11th 2018
on Mon Jan 21st 2019

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down

0 comments on commit b2eef1d

Please sign in to comment.