Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Jul 29, 2022
1 parent fabd531 commit 9793cf5
Show file tree
Hide file tree
Showing 3 changed files with 333 additions and 289 deletions.
10 changes: 4 additions & 6 deletions python/typemap_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,13 @@ static int pymaterial_grid_to_material_grid(PyObject *po, material_data *md) {
PyObject *po_dp = PyObject_GetAttrString(po, "weights");
PyArrayObject *pao = (PyArrayObject *)po_dp;
if (!PyArray_Check(pao)) { meep::abort("MaterialGrid weights failed to init."); }
if (!PyArray_ISCARRAY(pao)) {
meep::abort("Numpy array weights must be C-style contiguous.");
}
if (!PyArray_ISCARRAY(pao)) { meep::abort("Numpy array weights must be C-style contiguous."); }
md->weights.clear();
for (size_t i=0;i<PyArray_SIZE(pao);i++){
for (size_t i = 0; i < PyArray_SIZE(pao); i++) {
md->weights.push_back(((double *)PyArray_DATA(pao))[i]);
}
//md->weights = new double[PyArray_SIZE(pao)];
//memcpy(md->weights, (double *)PyArray_DATA(pao), PyArray_SIZE(pao) * sizeof(double));
// md->weights = new double[PyArray_SIZE(pao)];
// memcpy(md->weights, (double *)PyArray_DATA(pao), PyArray_SIZE(pao) * sizeof(double));

// if needed, combine sus structs to main object
PyObject *py_e_sus_m1 = PyObject_GetAttrString(po_medium1, "E_susceptibilities");
Expand Down

0 comments on commit 9793cf5

Please sign in to comment.