Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
name: ASan
runs-on: ubuntu-latest
container:
image: helics/buildenv:sanitizers-22
image: "helics/buildenv:sanitizers-22"
env:
ASAN_OPTIONS: detect_leaks=0
LSAN_OPTIONS: verbosity=1:log_threads=1
ASAN_OPTIONS: "detect_leaks=0"
LSAN_OPTIONS: "verbosity=1:log_threads=1"

steps:
- uses: actions/checkout@v6
Expand Down
5 changes: 2 additions & 3 deletions ThirdParty/Minizip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if(NOT CPACK_INCLUDED)
include(CPack)
endif(NOT CPACK_INCLUDED)

if(NOT DEFINED ZLIB_BUILD_MINIZIP)
if(NOT DEFINED ZLIB_BUILD_MINIZIP AND NOT GRIDDYN_MINIZIP_USE_EXISTING_ZLIB_TARGETS)
if(MINIZIP_BUILD_SHARED)
list(APPEND REQUIRED_COMPONENTS "shared")
endif(MINIZIP_BUILD_SHARED)
Expand All @@ -60,7 +60,7 @@ if(NOT DEFINED ZLIB_BUILD_MINIZIP)
endif(MINIZIP_BUILD_STATIC)

find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
endif(NOT DEFINED ZLIB_BUILD_MINIZIP)
endif(NOT DEFINED ZLIB_BUILD_MINIZIP AND NOT GRIDDYN_MINIZIP_USE_EXISTING_ZLIB_TARGETS)

if(MINIZIP_ENABLE_BZIP2)
find_package(BZip2 REQUIRED)
Expand Down Expand Up @@ -279,4 +279,3 @@ if(MINIZIP_INSTALL)
COMPONENT Development
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endif(MINIZIP_INSTALL)

13 changes: 7 additions & 6 deletions src/core/CoreObjectTemplates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include "CoreObject.h"
#include <span>
#include <type_traits>
namespace griddyn {
/**
Expand Down Expand Up @@ -55,9 +56,9 @@ A* cloneBase(const A* originalObject, CoreObject* obj)
template<class A, class B>
void getParamString(const A* cobj,
stringVec& pstr,
const stringVec& numStr,
const stringVec& strStr,
const stringVec& flagStr,
std::span<const std::string_view> numStr,
std::span<const std::string_view> strStr,
std::span<const std::string_view> flagStr,
ParamStringType pstype)
{
static_assert(std::is_base_of<B, A>::value,
Expand All @@ -77,13 +78,13 @@ void getParamString(const A* cobj,
cobj->B::getParameterStrings(pstr, ParamStringType::STR);
break;
case ParamStringType::LOCAL_NUM:
pstr = numStr;
pstr.assign(numStr.begin(), numStr.end());
break;
case ParamStringType::LOCAL_STR:
pstr = strStr;
pstr.assign(strStr.begin(), strStr.end());
break;
case ParamStringType::LOCAL_FLAGS:
pstr = flagStr;
pstr.assign(flagStr.begin(), flagStr.end());
break;
case ParamStringType::NUMERIC:
pstr.reserve(pstr.size() + numStr.size());
Expand Down
18 changes: 7 additions & 11 deletions src/griddyn/GridComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "gmlc/utilities/vectorOps.hpp"
#include "utilities/MatrixData.hpp"
#include <algorithm>
#include <array>
#include <cassert>
#include <format>
#include <functional>
Expand Down Expand Up @@ -573,22 +574,17 @@ void GridComponent::disconnect()
{
opFlags.set(DISCONNECTED);
}
static const stringVec& localNumericStrings()
{
static const stringVec strings{"status", "basefrequency", "basepower"};
return strings;
}
static constexpr auto localNumericStrings =
std::array<std::string_view, 3>{"status", "basefrequency", "basepower"};

static const stringVec& localStringStrings()
{
static const stringVec strings{"status"};
return strings;
}
static constexpr auto localStringStrings = std::array<std::string_view, 1>{"status"};

static constexpr std::array<std::string_view, 0> localFlagStrings{};

void GridComponent::getParameterStrings(stringVec& pstr, ParamStringType pstype) const
{
getParamString<GridComponent, CoreObject>(
this, pstr, localNumericStrings(), localStringStrings(), {}, pstype);
this, pstr, localNumericStrings, localStringStrings, localFlagStrings, pstype);
}

void GridComponent::set(std::string_view param, std::string_view val)
Expand Down
29 changes: 15 additions & 14 deletions src/griddyn/links/AcLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "gmlc/utilities/stringOps.h"
#include "gmlc/utilities/vectorOps.hpp"
#include "utilities/MatrixDataCompact.hpp"
#include <array>
#include <cmath>
#include <complex>
#include <cstring>
Expand Down Expand Up @@ -155,23 +156,23 @@ void AcLine::timestep(const CoreTime time, const IOdata& /*inputs*/, const Solve

void AcLine::checkMerge() {}

static const stringVec LOC_NUM_STRINGS{"r",
"x",
"link",
"b",
"g",
"tap",
"tapangle",
"switch1",
"switch2",
"fault",
"p"};
static const stringVec LOC_STR_STRINGS{"from", "to"};
static const stringVec FLAG_STRINGS{};
static constexpr auto locNumStrings = std::array<std::string_view, 11>{"r",
"x",
"link",
"b",
"g",
"tap",
"tapangle",
"switch1",
"switch2",
"fault",
"p"};
static constexpr auto locStrStrings = std::array<std::string_view, 2>{"from", "to"};
static constexpr std::array<std::string_view, 0> flagStrings{};
void AcLine::getParameterStrings(stringVec& pstr, ParamStringType pstype) const
{
getParamString<AcLine, GridComponent>(
this, pstr, LOC_NUM_STRINGS, LOC_STR_STRINGS, FLAG_STRINGS, pstype);
this, pstr, locNumStrings, locStrStrings, flagStrings, pstype);
}

// set properties
Expand Down
44 changes: 23 additions & 21 deletions src/griddyn/links/AdjustableTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "utilities/MatrixData.hpp"
#include "utilities/MatrixDataTranslate.hpp"
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iostream>
Expand Down Expand Up @@ -82,30 +83,31 @@ CoreObject* AdjustableTransformer::clone(CoreObject* obj) const
return lnk;
}

static const stringVec LOC_NUM_STRINGS{"vmin",
"vmax",
"vtarget",
"pmin",
"pmax",
"ptarget",
"qmin",
"qmax",
"qtarget",
"direction",
"mintap",
"maxtap",
"mintapangle",
"maxtapangle",
"stepsize",
"nsteps",
"dtapdt",
"dtapadt"};
static const stringVec LOC_STR_STRINGS{"controlmode", "changemode", "centermode"};
static const stringVec FLAG_STRINGS{"no_pflow_adjustments"};
static constexpr auto locNumStrings = std::array<std::string_view, 18>{"vmin",
"vmax",
"vtarget",
"pmin",
"pmax",
"ptarget",
"qmin",
"qmax",
"qtarget",
"direction",
"mintap",
"maxtap",
"mintapangle",
"maxtapangle",
"stepsize",
"nsteps",
"dtapdt",
"dtapadt"};
static constexpr auto locStrStrings =
std::array<std::string_view, 3>{"controlmode", "changemode", "centermode"};
static constexpr auto flagStrings = std::array<std::string_view, 1>{"no_pflow_adjustments"};
void AdjustableTransformer::getParameterStrings(stringVec& pstr, ParamStringType pstype) const
{
getParamString<AdjustableTransformer, AcLine>(
this, pstr, LOC_NUM_STRINGS, LOC_STR_STRINGS, FLAG_STRINGS, pstype);
this, pstr, locNumStrings, locStrStrings, flagStrings, pstype);
}

// set properties
Expand Down
10 changes: 6 additions & 4 deletions src/griddyn/links/Link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "gmlc/utilities/vectorOps.hpp"
#include "utilities/MatrixDataCompact.hpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <cstdio>
Expand Down Expand Up @@ -177,13 +178,14 @@ void Link::timestep(const CoreTime time, const IOdata& /*inputs*/, const SolverM
}*/
}

static const stringVec LOC_NUM_STRINGS{"loss", "switch1", "switch2", "p"};
static const stringVec LOC_STR_STRINGS{"from", "to"};
static const stringVec FLAG_STRINGS{};
static constexpr auto locNumStrings =
std::array<std::string_view, 4>{"loss", "switch1", "switch2", "p"};
static constexpr auto locStrStrings = std::array<std::string_view, 2>{"from", "to"};
static constexpr std::array<std::string_view, 0> flagStrings{};
void Link::getParameterStrings(stringVec& pstr, ParamStringType pstype) const
{
getParamString<Link, GridPrimary>(
this, pstr, LOC_NUM_STRINGS, LOC_STR_STRINGS, FLAG_STRINGS, pstype);
this, pstr, locNumStrings, locStrStrings, flagStrings, pstype);
}

// set properties
Expand Down
Loading