Skip to content

Commit 7d1d8f1

Browse files
committed
fix: GetCSX returns an empty list when structure is read from xml using openEMS ReadFromXML API.
This patch fixes GetCSX API to return the created object
1 parent 5b1cbe1 commit 7d1d8f1

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

openems.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,11 @@ void openEMS::SetCSX(ContinuousStructure* csx)
11251125
m_CSX = csx;
11261126
}
11271127

1128+
ContinuousStructure* openEMS::GetCSX() const
1129+
{
1130+
return m_CSX;
1131+
}
1132+
11281133
int openEMS::SetupFDTD()
11291134
{
11301135
timeval startTime;

openems.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class OPENEMS_EXPORT openEMS
115115
Excitation* InitExcitation();
116116

117117
void SetCSX(ContinuousStructure* csx);
118+
ContinuousStructure* GetCSX() const;
118119

119120
Engine_Interface_FDTD* NewEngineInterface(int multigridlevel = 0);
120121

python/openEMS/openEMS.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ cdef extern from "openEMS/openems.h":
2929

3030
void SetNumberOfTimeSteps(unsigned int val)
3131
void SetCSX(_ContinuousStructure* csx)
32+
_ContinuousStructure* GetCSX()
3233

3334
void SetEndCriteria(double val)
3435
void SetOverSampling(int val)

python/openEMS/openEMS.pyx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,17 @@ cdef class openEMS:
428428
self.thisptr.SetCSX(CSX.thisptr)
429429

430430
def GetCSX(self):
431+
cdef _ContinuousStructure* ptr = self.thisptr.GetCSX()
432+
cdef ContinuousStructure csx # declare here
433+
434+
if ptr == NULL:
435+
self.__CSX = None
436+
return None
437+
438+
if self.__CSX is None or self.__CSX.thisptr != ptr:
439+
csx = ContinuousStructure.__new__(ContinuousStructure)
440+
csx.thisptr = ptr
441+
self.__CSX = csx
431442
return self.__CSX
432443

433444
def AddEdges2Grid(self, dirs, primitives=None, properties=None, **kw):

0 commit comments

Comments
 (0)