Unable Incorporate new member variable to cariboutopology counterpart of splines implementation. #146
-
Hello Cariobu Community, I am Bhagath, and I am currently working on the implementation of FEM analysis with splines (aka Isogeometric analysis) in Caribou. So far :
I tested all of them individually, everything is working fine. However, when I attempted to implement As CT has In addition to already existing Please go through the below code snippets and suggest anything I am missing. Thanks in advance.
// d_knots declarations, each vector item correspond to spline element in patch :
Data<sofa::type::vector<sofa::type::fixed_array<Real, KnotDimension>>> d_knots;
template <typename Element>
CaribouSplineTopology<Element>::CaribouSplineTopology ()
: d_position(initData(&d_position,
"position",
"Position vector of the patch nodes."))
, d_indices(initData(&d_indices,
"indices",
"Node indices (w.r.t the position vector) of each elements."))
, d_knots(initData(&d_knots,
"d_knots",
"knot span of every element"))
{}
template <typename Element>
void CaribouSplineTopology<Element>::attachSplinePatch(const caribou::topology::SplinePatch<Dimension, PointID> * patch) {
this->p_patch = patch;
using namespace sofa::helper;
int KnotDimension = 4; // for reference
auto indices = WriteOnlyAccessor<Data<sofa::type::vector<sofa::type::fixed_array<PointID, NumberOfNodes>>>>(d_indices);
auto knots = WriteOnlyAccessor<Data<sofa::type::vector<sofa::type::fixed_array<Real, KnotDimension>>>>(d_knots);
const auto number_of_elements = patch->number_of_elements();
indices.resize(number_of_elements);
for (sofa::Index element_id = 0; element_id < number_of_elements; ++element_id) {
const auto element_indices = patch->element_indices(element_id);
const auto element_knots = patch->element_knotranges(element_id);
for (sofa::Index node_id = 0; node_id < NumberOfNodes; ++node_id) {
indices[element_id][node_id] = static_cast<PointID>(element_indices[node_id]);
}
for (sofa::Index node_id = 0; node_id < KnotDimension; ++node_id) {
knots[element_id][node_id] = static_cast<Real>(element_knots[node_id]);
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hey @bhagath555 Thanks for your post and sorry for our latency. I need some time to dig into Caribou API which I am not 100% familiar with. Let me also notice @Sidaty1 about this post |
Beta Was this translation helpful? Give feedback.
-
Hello @hugtalbot , ########## SIG 11 - SIGSEGV: segfault ########## -> /home/bhagath/code/sofa/build/install/lib/libSofa.Helper.so.21.06.03(sofa::helper::BackTrace::dump()+0x27) [0x7fb6df66fd87] -> /home/bhagath/code/sofa/build/install/lib/libSofa.Helper.so.21.06.03(sofa::helper::BackTrace::sig(int)+0x1d6) [0x7fb6df670126] -> /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7fb6df0c7090] -> /home/bhagath/code/plugins/caribou_IGA/build/lib/libSofaCaribou.so(SofaCaribou::topology::CaribouSplineTopology<caribou::geometry::BezierSurf<2ull> >::attachSplinePatch(caribou::topology::SplinePatch<2u, unsigned int, caribou::topology::EigenSplineNodesHolder<Eigen::Matrix<double, -1, 2, 1, -1, 2> > > const*)+0x161) [0x7fb6e19f4da1] -> ./Caribou.unittests.SofaCaribou(+0x5e7a5) [0x5652a6aeb7a5] -> /home/bhagath/code/sofa/build/install/lib/libgtest.so.2.6.2(void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0x51) [0x7fb6e07931c1] -> /home/bhagath/code/sofa/build/install/lib/libgtest.so.2.6.2(testing::Test::Run()+0xd6) [0x7fb6e07885a6] -> /home/bhagath/code/sofa/build/install/lib/libgtest.so.2.6.2(testing::TestInfo::Run()+0x135) [0x7fb6e0788705] -> /home/bhagath/code/sofa/build/install/lib/libgtest.so.2.6.2(testing::TestSuite::Run()+0xfd) [0x7fb6e078882d] -> /home/bhagath/code/sofa/build/install/lib/libgtest.so.2.6.2(testing::internal::UnitTestImpl::RunAllTests()+0x493) [0x7fb6e0788d93] -> /home/bhagath/code/sofa/build/install/lib/libgtest.so.2.6.2(testing::UnitTest::Run()+0xd8) [0x7fb6e0788ff8] -> ./Caribou.unittests.SofaCaribou(+0x204dc) [0x5652a6aad4dc] -> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fb6df0a8083] -> ./Caribou.unittests.SofaCaribou(+0x2408e) [0x5652a6ab108e] Segmentation fault (core dumped) |
Beta Was this translation helpful? Give feedback.
-
Hi @bhagath555 and @hugtalbot, @bhagath555, I can suggest two things, Have you added the variable Otherwise, let's meet virtually so I can have a better idea of your code. Best, |
Beta Was this translation helpful? Give feedback.
-
Thank you @Sidaty1 for meeting. |
Beta Was this translation helpful? Give feedback.
Thank you @Sidaty1 for meeting.
Also, Thank you @hugtalbot.
It was just a resizing vector before assign values into it. ;)
Hopefully, I'll come with better problem next-time.
Cheers, have a nice day,
Bhagath