25 {
27 if (
coordinates.size2() != 3 || normals.size2() != 3 ||
30 "SDF coordinates and normals must both have shape (N,3)");
31 PythonLock lock;
35 "Script %s has no callable %s",
file.c_str(),
name);
36 try {
38 std::vector<np::ndarray>
args;
39 for (
int d = 0;
d != 6; ++
d) {
40 auto a = np::empty(bp::make_tuple(
n), np::dtype::get_builtin<double>());
41 auto *p =
reinterpret_cast<double *
>(
a.get_data());
42 for (
size_t i = 0;
i !=
n; ++
i)
45 }
48 auto a = np::from_object(
result, np::dtype::get_builtin<double>());
49 if (
a.get_nd() != (columns == 1 ? 1 : 2) ||
50 a.shape(0) != static_cast<Py_intptr_t>(
n) ||
51 (columns != 1 &&
a.shape(1) != columns))
53 "Wrong result shape from %s in %s",
name,
file.c_str());
54 values.resize(
n, columns,
false);
55 for (
size_t i = 0;
i !=
n; ++
i)
56 for (
int d = 0;
d != columns; ++
d) {
59 a.get_data() +
i *
a.strides(0) +
60 (columns == 1 ? 0 :
d *
a.strides(1)),
62 if (!std::isfinite(
v))
64 "Non-finite result from %s in %s",
name,
file.c_str());
66 }
67 } catch (const bp::error_already_set &) {
68 PyErr_Print();
70 "Python %s failed in %s",
name,
file.c_str());
71 }
73 }
Vec t
Removal: the ring edge.
std::vector< std::array< double, 3 > > coordinates
SmartPetscObj< Vec > values
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)