Skip to content
Snippets Groups Projects
Commit 781824c9 authored by Alexander Rose's avatar Alexander Rose
Browse files

operators in IndexPairBonds as directed property

parent 71121e52
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,8 @@ Note that since we don't clearly distinguish between a public and private interf ...@@ -6,6 +6,8 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased] ## [Unreleased]
- Make operators in `IndexPairBonds` a directed property
## [v3.35.0] - 2023-05-14 ## [v3.35.0] - 2023-05-14
- Enable odd dash count (1,3,5) - Enable odd dash count (1,3,5)
......
/** /**
* Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
* *
* @author David Sehnal <david.sehnal@gmail.com> * @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
...@@ -176,6 +176,13 @@ export namespace IntAdjacencyGraph { ...@@ -176,6 +176,13 @@ export namespace IntAdjacencyGraph {
prop[this.curB] = value; prop[this.curB] = value;
} }
assignDirectedProperty<T>(propA: { [i: number]: T }, valueA: T, propB: { [i: number]: T }, valueB: T) {
propA[this.curA] = valueA;
propA[this.curB] = valueB;
propB[this.curB] = valueA;
propB[this.curA] = valueB;
}
constructor(public vertexCount: number, public xs: ArrayLike<VertexIndex>, public ys: ArrayLike<VertexIndex>) { constructor(public vertexCount: number, public xs: ArrayLike<VertexIndex>, public ys: ArrayLike<VertexIndex>) {
this.edgeCount = xs.length; this.edgeCount = xs.length;
this.offsets = new Int32Array(this.vertexCount + 1); this.offsets = new Int32Array(this.vertexCount + 1);
......
/** /**
* Copyright (c) 2019-2022 Mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2019-2023 Mol* contributors, licensed under MIT, See LICENSE file for more info.
* *
* @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author David Sehnal <david.sehnal@gmail.com> * @author David Sehnal <david.sehnal@gmail.com>
...@@ -34,8 +34,10 @@ function getGraph(indexA: ArrayLike<ElementIndex>, indexB: ArrayLike<ElementInde ...@@ -34,8 +34,10 @@ function getGraph(indexA: ArrayLike<ElementIndex>, indexB: ArrayLike<ElementInde
for (let i = 0, _i = builder.edgeCount; i < _i; i++) { for (let i = 0, _i = builder.edgeCount; i < _i; i++) {
builder.addNextEdge(); builder.addNextEdge();
builder.assignProperty(key, props.key ? props.key[i] : -1); builder.assignProperty(key, props.key ? props.key[i] : -1);
builder.assignProperty(operatorA, props.operatorA ? props.operatorA[i] : -1); builder.assignDirectedProperty(
builder.assignProperty(operatorB, props.operatorB ? props.operatorB[i] : -1); operatorA, props.operatorA ? props.operatorA[i] : -1,
operatorB, props.operatorB ? props.operatorB[i] : -1
);
builder.assignProperty(order, props.order ? props.order[i] : 1); builder.assignProperty(order, props.order ? props.order[i] : 1);
builder.assignProperty(distance, props.distance ? props.distance[i] : -1); builder.assignProperty(distance, props.distance ? props.distance[i] : -1);
builder.assignProperty(flag, props.flag ? props.flag[i] : BondType.Flag.Covalent); builder.assignProperty(flag, props.flag ? props.flag[i] : BondType.Flag.Covalent);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment