/** Compute the natural frequencies of the structure Arguments: n - number of natural frequencies to return (unless n exceeds the total DOF of the structure, in which case all computed natural frequencies will be returned. Return: freq - a numpy array of frequencies (not necessarily of length n as described above). **/ Vector computeNaturalFrequencies(int n){ Vector vec(n); beam->computeNaturalFrequencies(n, vec); return vec; }
/** Compute the natural frequencies of the structure Arguments: n - number of natural frequencies to return (unless n exceeds the total DOF of the structure, in which case all computed natural frequencies will be returned. Return: freq - a numpy array of frequencies (not necessarily of length n as described above). **/ py::tuple computeNaturalFrequenciesAndEigenvectors(int n){ Vector freqs(n); Matrix eigenvectors(0, 0); beam->computeNaturalFrequencies(n, freqs, eigenvectors); return py::make_tuple(freqs, eigenvectors); }
/** Compute the natural frequencies of the structure Arguments: n - number of natural frequencies to return (unless n exceeds the total DOF of the structure, in which case all computed natural frequencies will be returned. Return: freq - a numpy array of frequencies (not necessarily of length n as described above). **/ bpn::array computeNaturalFrequencies(int n) { Vector vec(n); beam->computeNaturalFrequencies(n, vec); bp::list list; for(int i = 0; i < vec.size(); i++) { list.append(vec(i)); } return bpn::array(list); }
/** Compute the natural frequencies of the structure Arguments: n - number of natural frequencies to return (unless n exceeds the total DOF of the structure, in which case all computed natural frequencies will be returned. Return: freq - a numpy array of frequencies (not necessarily of length n as described above). **/ bp::tuple computeNaturalFrequenciesAndEigenvectors(int n) { Vector vec(n); Matrix mat(0, 0); beam->computeNaturalFrequencies(n, vec, mat); bp::list freq_list; for(int i = 0; i < vec.size(); i++) { freq_list.append(vec(i)); } bp::list vec_list; for (int j = 0; j < mat.size2(); j++) { bp::list inner_list; for (int i = 0; i < mat.size1(); i++) { inner_list.append(mat(i, j)); } vec_list.append(bpn::array(inner_list)); } return bp::make_tuple(bpn::array(freq_list), bpn::array(vec_list)); }