Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes tagnumber overwriting in edges #111

Merged
merged 6 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion external/googletest
lmdiazangulo marked this conversation as resolved.
Show resolved Hide resolved
Submodule googletest updated 70 files
+43 −0 .github/workflows/gtest-ci.yml
+13 −30 BUILD.bazel
+1 −1 CMakeLists.txt
+0 −1 CONTRIBUTORS
+13 −32 MODULE.bazel
+9 −5 README.md
+3 −36 WORKSPACE
+1 −1 ci/linux-presubmit.sh
+1 −6 ci/windows-presubmit.bat
+8 −18 docs/advanced.md
+11 −40 docs/gmock_cook_book.md
+0 −2 docs/gmock_for_dummies.md
+11 −10 docs/primer.md
+30 −23 docs/quickstart-bazel.md
+2 −9 docs/reference/assertions.md
+2 −2 docs/reference/mocking.md
+2 −21 docs/reference/testing.md
+0 −61 fake_fuchsia_sdk.bzl
+3 −4 googlemock/CMakeLists.txt
+20 −59 googlemock/include/gmock/gmock-actions.h
+129 −183 googlemock/include/gmock/gmock-matchers.h
+5 −7 googlemock/include/gmock/gmock-more-actions.h
+6 −4 googlemock/include/gmock/gmock-spec-builders.h
+6 −8 googlemock/include/gmock/internal/gmock-internal-utils.h
+4 −5 googlemock/include/gmock/internal/gmock-port.h
+4 −4 googlemock/src/gmock-cardinalities.cc
+2 −3 googlemock/src/gmock-internal-utils.cc
+14 −13 googlemock/src/gmock-matchers.cc
+1 −1 googlemock/src/gmock-spec-builders.cc
+4 −52 googlemock/test/gmock-actions_test.cc
+2 −2 googlemock/test/gmock-function-mocker_test.cc
+27 −27 googlemock/test/gmock-matchers-arithmetic_test.cc
+2 −5 googlemock/test/gmock-matchers-comparisons_test.cc
+11 −29 googlemock/test/gmock-matchers-containers_test.cc
+23 −63 googlemock/test/gmock-matchers-misc_test.cc
+0 −26 googlemock/test/gmock-more-actions_test.cc
+1 −1 googlemock/test/gmock-pp_test.cc
+1 −1 googlemock/test/gmock_link_test.h
+1 −1 googletest/README.md
+1 −1 googletest/include/gtest/gtest-assertion-result.h
+4 −4 googletest/include/gtest/gtest-death-test.h
+3 −3 googletest/include/gtest/gtest-matchers.h
+4 −4 googletest/include/gtest/gtest-param-test.h
+0 −39 googletest/include/gtest/gtest-printers.h
+61 −65 googletest/include/gtest/gtest-typed-test.h
+14 −31 googletest/include/gtest/gtest.h
+23 −24 googletest/include/gtest/internal/gtest-death-test-internal.h
+1 −7 googletest/include/gtest/internal/gtest-filepath.h
+62 −24 googletest/include/gtest/internal/gtest-internal.h
+74 −76 googletest/include/gtest/internal/gtest-param-util.h
+0 −2 googletest/include/gtest/internal/gtest-port-arch.h
+15 −45 googletest/include/gtest/internal/gtest-port.h
+3 −3 googletest/include/gtest/internal/gtest-type-util.h
+16 −18 googletest/src/gtest-death-test.cc
+16 −28 googletest/src/gtest-internal-inl.h
+19 −34 googletest/src/gtest-port.cc
+120 −216 googletest/src/gtest.cc
+0 −1 googletest/test/googletest-color-test.py
+37 −41 googletest/test/googletest-death-test-test.cc
+9 −101 googletest/test/googletest-json-output-unittest.py
+1 −4 googletest/test/googletest-options-test.cc
+4 −0 googletest/test/googletest-output-test-golden-lin.txt
+0 −24 googletest/test/googletest-printers-test.cc
+44 −52 googletest/test/gtest_environment_test.cc
+0 −3 googletest/test/gtest_json_test_utils.py
+3 −1 googletest/test/gtest_repeat_test.cc
+26 −67 googletest/test/gtest_unittest.cc
+13 −52 googletest/test/gtest_xml_output_unittest.py
+0 −16 googletest/test/gtest_xml_output_unittest_.cc
+10 −16 googletest_deps.bzl
2 changes: 1 addition & 1 deletion external/ngspice
lmdiazangulo marked this conversation as resolved.
Show resolved Hide resolved
Submodule ngspice updated 1 files
+0 −7 CMakeLists.txt
1 change: 1 addition & 0 deletions src_json_parser/smbjson.F90
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ subroutine appendRegion(resCoords, resNCoords, resNCoordsMax, cs)
resNCoords = size(cs)
resNCoordsMax = size(cs)
else
allocate(auxCs(size(resCoords)))
do i = 1, size(resCoords)
auxCs(i) = resCoords(i)
end do
Expand Down
178 changes: 141 additions & 37 deletions src_main_pub/healer.F90

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions src_main_pub/preprocess_geom.F90

Large diffs are not rendered by default.

131 changes: 125 additions & 6 deletions test/pyWrapper/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def test_sphere_case_with_far_field_probe_launches(tmp_path):
assert np.all(p.cell_init == np.array([2, 2, 2]))


def test_sgbc_with_mapvtk_checking_tagnumbers(tmp_path):
fn = CASES_FOLDER + 'sgbc/sgbc.fdtd.json'
def test_tagnumbers_3_surfaces(tmp_path):
fn = CASES_FOLDER + 'tagNumber_mediaType/three_surfaces.fdtd.json'
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
run_in_folder=tmp_path, flags=['-mapvtk'])
solver['general']['numberOfSteps'] = 1
Expand All @@ -74,7 +74,126 @@ def test_sgbc_with_mapvtk_checking_tagnumbers(tmp_path):
vtkmapfile = solver.getVTKMap()
assert os.path.isfile(vtkmapfile)

d = createFaceTagDictionary(vtkmapfile)
assert d[64] == 4
assert d[128] == 4
assert d[192] == 4
face_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'tagnumber')
assert face_tag_dict[64] == 4
assert face_tag_dict[128] == 4
assert face_tag_dict[192] == 4

line_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'tagnumber')
assert line_tag_dict[64] == 8
assert line_tag_dict[128] == 4
assert line_tag_dict[192] == 4

face_media_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'mediatype')
assert face_media_dict[0] == 4 #PEC surface
assert face_media_dict[304] == 4 #SGBC surface
assert face_media_dict[305] == 4 #SGBC surface

line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
assert line_media_dict[0.5] == 8 #PEC line
assert line_media_dict[3.5] == 8 #SGBC line

def test_tagnumbers_1_volume(tmp_path):
fn = CASES_FOLDER + 'tagNumber_mediaType/pec_volume.fdtd.json'
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
run_in_folder=tmp_path, flags=['-mapvtk'])
solver['general']['numberOfSteps'] = 1

solver.run()
assert solver.hasFinishedSuccessfully() == True

vtkmapfile = solver.getVTKMap()
assert os.path.isfile(vtkmapfile)

face_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'tagnumber')
assert face_tag_dict[64] == 36

line_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'tagnumber')
assert len(line_tag_dict) == 0

face_media_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'mediatype')
assert face_media_dict[0] == 36 #PEC surface

line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
assert len(line_media_dict) == 0

def test_tagnumbers_2_volumes(tmp_path):
fn = CASES_FOLDER + 'tagNumber_mediaType/pec_volumes.fdtd.json'
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
run_in_folder=tmp_path, flags=['-mapvtk'])
solver['general']['numberOfSteps'] = 1

solver.run()
assert solver.hasFinishedSuccessfully() == True

vtkmapfile = solver.getVTKMap()
assert os.path.isfile(vtkmapfile)

face_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'tagnumber')
assert face_tag_dict[64] == 36
assert face_tag_dict[128] == 36

line_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'tagnumber')
assert len(line_tag_dict) == 0

face_media_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'mediatype')
assert face_media_dict[0] == 72 #PEC surface

line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
assert len(line_media_dict) == 0

def test_tagnumbers_1_line(tmp_path):
fn = CASES_FOLDER + 'tagNumber_mediaType/pec_line.fdtd.json'
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
run_in_folder=tmp_path, flags=['-mapvtk'])
solver['general']['numberOfSteps'] = 1

solver.run()
assert solver.hasFinishedSuccessfully() == True

vtkmapfile = solver.getVTKMap()
assert os.path.isfile(vtkmapfile)

face_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'tagnumber')
assert len(face_tag_dict) == 0

line_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'tagnumber')
assert line_tag_dict[64] == 2

face_media_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'mediatype')
assert len(face_media_dict) == 0

line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
assert line_media_dict[0.5] == 2 #PEC line

def test_tagnumbers_volume_and_surfacs(tmp_path):
fn = CASES_FOLDER + 'tagNumber_mediaType/volume_and_surfaces.fdtd.json'
solver = FDTD(input_filename=fn, path_to_exe=SEMBA_EXE,
run_in_folder=tmp_path, flags=['-mapvtk'])
solver['general']['numberOfSteps'] = 1

solver.run()
assert solver.hasFinishedSuccessfully() == True

vtkmapfile = solver.getVTKMap()
assert os.path.isfile(vtkmapfile)

face_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'tagnumber')
assert face_tag_dict[64] == 6
assert face_tag_dict[128] == 1
assert face_tag_dict[192] == 1

line_tag_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'tagnumber')
assert line_tag_dict[64] == 1
assert line_tag_dict[128] == 4
assert line_tag_dict[192] == 3

face_media_dict = createPropertyDictionary(vtkmapfile, celltype = 9, property = 'mediatype')
assert face_media_dict[-1] == 1 #PEC surface
assert face_media_dict[0] == 6 #PEC surface
assert face_media_dict[305] == 1 #SGBC surface

line_media_dict = createPropertyDictionary(vtkmapfile, celltype = 3, property = 'mediatype')
assert line_media_dict[-0.5] == 4 #PMC line
assert line_media_dict[0.5] == 1 #PEC line
assert line_media_dict[3.5] == 3 #SGBC line
19 changes: 11 additions & 8 deletions test/pyWrapper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,18 @@ def readSpiceFile(spice_file):
return t, val


def createFaceTagDictionary(vtkfile):
def createPropertyDictionary(vtkfile, celltype:int, property:str):
ugrid = pv.UnstructuredGrid(vtkfile)
quads = np.argwhere(ugrid.celltypes == 9) # [i][0]
tags = np.array([])
tagnumber_array = ugrid.cell_data['tagnumber']
for i in range(quads[0][0], quads[-1][0]+1):
tags = np.append(tags, tagnumber_array[i])

unique, counts = np.unique(tags, return_counts=True)
objs = np.argwhere(ugrid.celltypes == celltype) # [i][0]
if len(objs) == 0:
return dict()

props = np.array([])
prop_array = ugrid.cell_data[property]
for i in range(objs[0][0], objs[-1][0]+1):
props = np.append(props, prop_array[i])

unique, counts = np.unique(props, return_counts=True)
return dict(zip(unique, counts))


Expand Down
19 changes: 0 additions & 19 deletions testData/cases/sgbc/gauss.exc

This file was deleted.

37 changes: 37 additions & 0 deletions testData/cases/tagNumber_mediaType/pec_line.fdtd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"format": "FDTD Input file",
"__comments": "Example input with sgbc material",

"general": {
"timeStep": 10e-12,
"numberOfSteps": 2000
},

"boundary": {
"all": {"type": "mur"}
},

"mesh": {
"grid": {
"numberOfCells": [10, 10, 10],
"steps": { "x": [0.1], "y": [0.1], "z": [0.1] }
},
"elements": [
{"id": 1, "type": "cell", "intervals": [ [ [3, 3, 3], [3, 3, 5] ] ]}
]
},

"materials": [
{
"type": "pec",
"id": 1
}
],

"materialAssociations": [
{
"materialId": 1,
"elementIds": [ 1 ]
}
]
}
37 changes: 37 additions & 0 deletions testData/cases/tagNumber_mediaType/pec_volume.fdtd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"format": "FDTD Input file",
"__comments": "Example input with sgbc material",

"general": {
"timeStep": 10e-12,
"numberOfSteps": 2000
},

"boundary": {
"all": {"type": "mur"}
},

"mesh": {
"grid": {
"numberOfCells": [10, 10, 10],
"steps": { "x": [0.1], "y": [0.1], "z": [0.1] }
},
"elements": [
{"id": 1, "type": "cell", "intervals": [ [ [3, 3, 3], [5, 5, 5] ] ]}
]
},

"materials": [
{
"type": "pec",
"id": 1
}
],

"materialAssociations": [
{
"materialId": 1,
"elementIds": [ 1 ]
}
]
}
42 changes: 42 additions & 0 deletions testData/cases/tagNumber_mediaType/pec_volumes.fdtd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"format": "FDTD Input file",
"__comments": "Example input with sgbc material",

"general": {
"timeStep": 10e-12,
"numberOfSteps": 2000
},

"boundary": {
"all": {"type": "mur"}
},

"mesh": {
"grid": {
"numberOfCells": [10, 10, 10],
"steps": { "x": [0.1], "y": [0.1], "z": [0.1] }
},
"elements": [
{"id": 1, "type": "cell", "intervals": [ [ [3, 3, 3], [5, 5, 5] ] ]},
{"id": 2, "type": "cell", "intervals": [ [ [6, 6, 6], [8, 8, 8] ] ]}
]
},

"materials": [
{
"type": "pec",
"id": 1
}
],

"materialAssociations": [
{
"materialId": 1,
"elementIds": [ 1 ]
},
{
"materialId": 1,
"elementIds": [ 2 ]
}
]
}
60 changes: 60 additions & 0 deletions testData/cases/tagNumber_mediaType/volume_and_surfaces.fdtd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"format": "FDTD Input file",
"__comments": "Example input with sgbc material",

"general": {
"timeStep": 10e-12,
"numberOfSteps": 2000
},

"boundary": {
"all": {"type": "mur"}
},

"mesh": {
"grid": {
"numberOfCells": [10, 10, 10],
"steps": { "x": [0.1], "y": [0.1], "z": [0.1] }
},
"elements": [
{"id": 1, "type": "cell", "intervals": [ [ [5, 4, 4], [6, 5, 4] ] ]},
{"id": 2, "type": "cell", "intervals": [ [ [4, 4, 4], [5, 5, 5] ] ]},
{"id": 3, "type": "cell", "intervals": [ [ [4, 5, 4], [5, 6, 4] ] ]}
]
},

"materials": [
{
"type": "pmc",
"id": 1
},
{
"type": "pec",
"id": 2
},
{
"name": "2-layers-composite",
"type": "multilayeredSurface",
"id": 3,
"layers": [
{"thickness": 1e-3, "relativePermittivity": 1.3, "electricConductivity": 2e-4},
{"thickness": 5e-3, "relativePermittivity": 1.3}
]
}
],

"materialAssociations": [
{
"materialId": 1,
"elementIds": [ 1 ]
},
{
"materialId": 2,
"elementIds": [ 2 ]
},
{
"materialId": 3,
"elementIds": [ 3 ]
}
]
}
Loading