Skip to content

Commit

Permalink
formatting and checking for uniqness of the coordinate vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
LemurPwned committed Nov 24, 2024
1 parent f952c2f commit 212ad8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmtj/reservoir/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,26 @@ class Reservoir:
"""
...

def setAllExternalField(self, arg0: cmtj.AxialDriver) -> None:
def setAllExternalField(self, driver: cmtj.AxialDriver) -> None:
"""Set external field for all layers.
:param arg0: External field driver
:param driver: External field driver
"""
...

def setLayerAnisotropy(self, arg0: int, arg1: cmtj.ScalarDriver) -> None:
def setLayerAnisotropy(self, arg0: int, driver: cmtj.ScalarDriver) -> None:
"""Set anisotropy for specific layer.
:param arg0: Layer index
:param arg1: Anisotropy driver
:param driver: Anisotropy driver
"""
...

def setLayerExternalField(self, arg0: int, arg1: cmtj.AxialDriver) -> None:
def setLayerExternalField(self, arg0: int, driver: cmtj.AxialDriver) -> None:
"""Set external field for specific layer.
:param arg0: Layer index
:param arg1: External field driver
:param driver: External field driver
"""
...

Expand Down
9 changes: 9 additions & 0 deletions core/reservoir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ class GroupInteraction {
this->noElements = junctionList.size();
this->coordinateMatrix = std::move(coordinateMatrix);
this->junctionList = std::move(junctionList);

// check that all vectors in coordinateMatrix are unique
for (size_t i = 0; i < this->coordinateMatrix.size(); i++) {
for (size_t j = i + 1; j < this->coordinateMatrix.size(); j++) {
if (this->coordinateMatrix[i] == this->coordinateMatrix[j]) {
throw std::runtime_error("Coordinate vectors must be unique!");
}
}
}
}

void setInteractionFunction(interactionFunction interactionFunc) {
Expand Down

0 comments on commit 212ad8b

Please sign in to comment.