Closed Vahid-Galavi closed 3 years ago
Yes it is possible if you add that application to the CMakeList.txt, and you compile that application (for linking) of course.
El mié., 12 may. 2021 20:17, Vahid @.***> escribió:
Description I derived some elements in GeoMechanicsApplication from the elements in StructuralMechanicsApplication. If I put them in GeoMechanicsApplication, I get errors in linking such as " unresolved external symbol". But if I move them to StructuralMechanicsApplication, they are compiled and linked without any errors. So, it seems that there is no problem with the derived elements. I guess my problem is related to the build script. Now, my question is if such a thing has been done before or should I simply move the derived elements to StructuralMechanicsApplication, although they might have little use in that application.
This is related to the discussion in #8464 https://github.com/KratosMultiphysics/Kratos/pull/8464
Scope Which areas of Kratos are involved:
- Compilation
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/8769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYQZAHUDMU5YUA6TV32RTLTNLA4XANCNFSM44ZDQFVA .
You should link that application as well of course in the CmakeLists.txt
El mié., 12 may. 2021 21:48, Vicente Mataix Ferrándiz < @.***> escribió:
Yes it is possible if you add that application to the CMakeList.txt, and you compile that application (for linking) of course.
El mié., 12 may. 2021 20:17, Vahid @.***> escribió:
Description I derived some elements in GeoMechanicsApplication from the elements in StructuralMechanicsApplication. If I put them in GeoMechanicsApplication, I get errors in linking such as " unresolved external symbol". But if I move them to StructuralMechanicsApplication, they are compiled and linked without any errors. So, it seems that there is no problem with the derived elements. I guess my problem is related to the build script. Now, my question is if such a thing has been done before or should I simply move the derived elements to StructuralMechanicsApplication, although they might have little use in that application.
This is related to the discussion in #8464 https://github.com/KratosMultiphysics/Kratos/pull/8464
Scope Which areas of Kratos are involved:
- Compilation
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/issues/8769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYQZAHUDMU5YUA6TV32RTLTNLA4XANCNFSM44ZDQFVA .
If the element that you're deriving from is templated but no header only you may have such problems. If this is the case, I'm afraid that the unique solution is to make the base element header only (we struggled with this not long ago in the FluidDynamicsApplication
).
If the element that you're deriving from is templated but no header only you may have such problems. If this is the case, I'm afraid that the unique solution is to make the base element header only (we struggled with this not long ago in the
FluidDynamicsApplication
).
Thanks @rubenzorrilla! In which element should I look?
You should link that application as well of course in the CmakeLists.txt El mié., 12 may. 2021 21:48, Vicente Mataix Ferrándiz < @.> escribió: … Yes it is possible if you add that application to the CMakeList.txt, and you compile that application (for linking) of course. El mié., 12 may. 2021 20:17, Vahid @.> escribió: > Description > I derived some elements in GeoMechanicsApplication from the elements in > StructuralMechanicsApplication. If I put them in GeoMechanicsApplication, I > get errors in linking such as " unresolved external symbol". But if I move > them to StructuralMechanicsApplication, they are compiled and linked > without any errors. So, it seems that there is no problem with the derived > elements. > I guess my problem is related to the build script. Now, my question is if > such a thing has been done before or should I simply move the derived > elements to StructuralMechanicsApplication, although they might have little > use in that application. > > This is related to the discussion in #8464 > <#8464> > > Scope > Which areas of Kratos are involved: > > - Compilation > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <#8769>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AEYQZAHUDMU5YUA6TV32RTLTNLA4XANCNFSM44ZDQFVA > . >
Thanks @loumalouomega! Is there any example that I can look into?
Thanks @loumalouomega! Is there any example that I can look into?
@AlejandroCornejo may have some examples (not in my case)
If the element that you're deriving from is templated but no header only you may have such problems. If this is the case, I'm afraid that the unique solution is to make the base element header only (we struggled with this not long ago in the
FluidDynamicsApplication
).Thanks @rubenzorrilla! In which element should I look?
What we decided to do in the FluidDynamicsApplication
was to implement the derived one not in the other application but in the FluidDynamicsApplication
one to avoid making the base ones header only. We decided to do so because the formulation implemented in the derived element was generic enough to have it in the common CFD app.
Long story short, I don't know where to point you for such example... I think that the structural mechanics guys will know this much better than me.
@Vahid-Galavi which element are you talking about? It should work, the elements in the Structural don't use the mechanism that causes the issues in the FluidElements
@philbucher As a starting point, I derived elements from cable element (cable_element_3D2N) and truss elements (truss_element_3D2N, truss_element_linear_3D2N)
If the element that you're deriving from is templated but no header only you may have such problems. If this is the case, I'm afraid that the unique solution is to make the base element header only (we struggled with this not long ago in the
FluidDynamicsApplication
).Thanks @rubenzorrilla! In which element should I look?
What we decided to do in the
FluidDynamicsApplication
was to implement the derived one not in the other application but in theFluidDynamicsApplication
one to avoid making the base ones header only. We decided to do so because the formulation implemented in the derived element was generic enough to have it in the common CFD app.Long story short, I don't know where to point you for such example... I think that the structural mechanics guys will know this much better than me.
I have no problem to put derived elements in StructuralMechanicsApplication, if the structural mechanics guys agree.
Hm those elements are nothing fancy in the sense of programming so the deriving should work.
since they have limited use for the StructuralMechanicsApp I would prefer not to add them if possible
do you have a branch or PR? I could help/take a look.
Hm those elements are nothing fancy in the sense of programming so the deriving should work.
since they have limited use for the StructuralMechanicsApp I would prefer not to add them if possible
do you have a branch or PR? I could help/take a look.
Yes, there is a branch, called GeoStructureDerivedElem.
I tried your branch and for me it worked fine, I could also run some of your tests
Can you try with a clean build?
@philbucher I rebuilt the code and also did a clean checkout and build but got the same errors. Did you compile GeoStructureDerivedElem branch?
@philbucher I have just compiled it on Linux and it works! My previous attempts were all on Windows 10. I have no idea why it gives errors on Windows.
@roigcarlo do you have any clue why the code can be compiled and tested on Linux but gives "unresolved external symbol" errors for all derived functions on Windows?
There are a couple of scenarios where this can happen, let me take a look tomorrow. GeoStructureDerivedElem branch right?
I think the problem is that the base ThrustElement
is not exposed in the StructuralApp (this one at least https://github.com/KratosMultiphysics/Kratos/blob/master/applications/StructuralMechanicsApplication/custom_elements/truss_element_3D2N.hpp#L36 maybe others)
We should change it to
class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) TrussElement3D2N : public Element
If it works, is it ok if we commit directly to your branch? Or if @loumalouomega preffers, I can make a PR making all the elements from the structural exposed.
Thanks @roigcarlo! I will modify the elements and then make a PR.
@roigcarlo I added KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) to the StructuralApp elements but I still get similar errors. I committed the updated code to the branch.
Ok let me check in my computer
Ok problem in my machine seems to be because of the CalculateReferenceLenght3D2N
function.
It seems that you are calling the one from the StructuralMechanics, (which is not exported hence the problem). I noticed that there is a copy of that class and specifically that particualr function in the GeoMechanics app which, to the best of my knowledge, is identical.
So either we need to call it from the implementation of the GeoMechanics (changing the namespace in the geo_cable_element_3D2N
and geo_truss_element_3D2N
) or we export it from the structural and delete the duplicated methods / class in the geo.
I think the second solution is better but I don't know if toy have changed some details in the GeoStructuralMechanicsElementUtilitites
so I leave it for you to decide.
It does not help. I still get errors for all derived functions. I committed my changes.
Ok, let me see
It compiles just fine to me. I will make a PR to upload the changes in the Structural so they can be merged in your branch
If it does not compile with this, can you send me the compile errors?
geo_truss_element_linear_3D2N.obj : error LNK2019: unresolved external symbol "public: cdecl Kratos::TrussElementLinear3D2N::TrussElementLinear3D2N(unsigned int64,class std::shared_ptr<class Kratos::Geometry<class Kratos::Node<3,cla
ss Kratos::Dof
,class std::allocator<class boost::numeric::ublas::vector<double,class boost::numeric::ublas::unbounded_array<double,class std::allocator
> > > > &,class Kratos::ProcessInfo const &)" (?CalculateOnIntegrationPoints@TrussEleme ntLinear3D2N@Kratos@@UEAAXAEBV?$Variable@V?$vector@NV?$unbounded_array@NV?$allocator@N@std@@@ublas@numeric@boost@@@ublas@numeric@boost@@@2@AEAV?$vector@V?$vector@NV?$unbounded_array@NV?$allocator@N@std@@@ublas@numeric@boost@@@ublas@nume ric@boost@@V?$allocator@V?$vector@NV?$unbounded_array@NV?$allocator@N@std@@@ublas@numeric@boost@@@ublas@numeric@boost@@@std@@@std@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanic sCore.vcxproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "public: virtual void cdecl Kratos::TrussElementLinear3D2N::CalculateOnIntegrationPoints(class Kratos::Variable<class boost::numeric::ublas::vector<double,class boost::numeric::ublas::unbounded_array<double,class std::allocator > > > const &,class std::vector<class boost::numeric::ublas::vector<double,class boost::numeric::ublas::unbounded_array<double,class std::allocator cdecl Kratos::TrussElementLinear3D2N::WriteTransformationCoordinates(class boost::numeric::ublas::bounded_vector<double,6> &)" (?Write TransformationCoordinates@TrussElementLinear3D2N@Kratos@@UEAAXAEAV?$bounded_vector@N$05@ublas@numeric@boost@@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "public: virtual void cdecl Kratos::TrussElementLinear3D2N::WriteTransformationCoordinates(class boost::numeric::ublas::bounded_vector<double,6> &)" (?WriteTran sformationCoordinates@TrussElementLinear3D2N@Kratos@@UEAAXAEAV?$bounded_vector@N$05@ublas@numeric@boost@@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_truss_element_linear_3D2N.obj : error LNK2019: unresolved external symbol "public: double cdecl Kratos::TrussElementLinear3D2N::CalculateLinearStrain(void)" (?CalculateLinearStrain@TrussElementLinear3D2N@Kratos@@QEAANXZ) reference d in function "public: virtual void cdecl Kratos::GeoTrussElementLinear3D2N::CalculateOnIntegrationPoints(class Kratos::Variable<class Kratos::array_1d<double,3> > const &,class std::vector<class Kratos::array_1d<double,3>,class std:: allocator<class Kratos::array_1d<double,3> > > &,class Kratos::ProcessInfo const &)" (?CalculateOnIntegrationPoints@GeoTrussElementLinear3D2N@Kratos@@UEAAXAEBV?$Variable@V?$array_1d@N$02@Kratos@@@2@AEAV?$vector@V?$array_1d@N$02@Kratos@@ V?$allocator@V?$array_1d@N$02@Kratos@@@std@@@std@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_truss_element_linear_3D2N.obj : error LNK2001: unresolved external symbol "public: virtual void cdecl Kratos::TrussElementLinear3D2N::UpdateInternalForces(class boost::numeric::ublas::bounded_vector<double,6> &,class Kratos::Proce ssInfo const &)" (?UpdateInternalForces@TrussElementLinear3D2N@Kratos@@UEAAXAEAV?$bounded_vector@N$05@ublas@numeric@boost@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vc xproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "public: virtual void cdecl Kratos::TrussElementLinear3D2N::UpdateInternalForces(class boost::numeric::ublas::bounded_vector<double,6> &,class Kratos::ProcessIn fo const &)" (?UpdateInternalForces@TrussElementLinear3D2N@Kratos@@UEAAXAEAV?$bounded_vector@N$05@ublas@numeric@boost@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxpro j] geo_truss_element_linear_3D2N.obj : error LNK2019: unresolved external symbol "public: virtual void cdecl Kratos::TrussElementLinear3D2N::FinalizeSolutionStep(class Kratos::ProcessInfo const &)" (?FinalizeSolutionStep@TrussElementLine ar3D2N@Kratos@@UEAAXAEBVProcessInfo@2@@Z) referenced in function "public: virtual void cdecl Kratos::GeoTrussElementLinear3D2N::FinalizeSolutionStep(class Kratos::ProcessInfo const &)" (?FinalizeSolutionStep@GeoTrussElementLinear3D2N@ Kratos@@UEAAXAEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "public: virtual void cdecl Kratos::TrussElementLinear3D2N::FinalizeSolutionStep(class Kratos::ProcessInfo const &)" (?FinalizeSolutionStep@TrussElementLinear3D 2N@Kratos@@UEAAXAEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_truss_element_linear_3D2N.obj : error LNK2019: unresolved external symbol "private: virtual void cdecl Kratos::TrussElementLinear3D2N::save(class Kratos::Serializer &)const " (?save@TrussElementLinear3D2N@Kratos@@EEBAXAEAVSerializ er@2@@Z) referenced in function "private: virtual void cdecl Kratos::GeoTrussElementLinear3D2N::save(class Kratos::Serializer &)const " (?save@GeoTrussElementLinear3D2N@Kratos@@EEBAXAEAVSerializer@2@@Z) [D:\src\Kratos\build\Release\ap plications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "private: virtual void cdecl Kratos::TrussElementLinear3D2N::save(class Kratos::Serializer &)const " (?save@TrussElementLinear3D2N@Kratos@@EEBAXAEAVSerializer@2 @@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_truss_element_linear_3D2N.obj : error LNK2019: unresolved external symbol "private: virtual void cdecl Kratos::TrussElementLinear3D2N::load(class Kratos::Serializer &)" (?load@TrussElementLinear3D2N@Kratos@@EEAAXAEAVSerializer@2@@ Z) referenced in function "private: virtual void cdecl Kratos::GeoTrussElementLinear3D2N::load(class Kratos::Serializer &)" (?load@GeoTrussElementLinear3D2N@Kratos@@EEAAXAEAVSerializer@2@@Z) [D:\src\Kratos\build\Release\applications\G eoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "private: virtual void cdecl Kratos::TrussElementLinear3D2N::load(class Kratos::Serializer &)" (?load@TrussElementLinear3D2N@Kratos@@EEAAXAEAVSerializer@2@@Z) [ D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\Release\KratosGeoMechanicsCore.dll : fatal error LNK1120: 16 unresolved externals [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore. vcxproj]> >, class std::allocator<class boost::numeric::ublas::vector<double,class boost::numeric::ublas::unbounded_array<double,class std::allocator > > > > &,class Kratos::ProcessInfo const &)" (?CalculateOnIntegrationPoints@TrussElementLi near3D2N@Kratos@@UEAAXAEBV?$Variable@V?$vector@NV?$unbounded_array@NV?$allocator@N@std@@@ublas@numeric@boost@@@ublas@numeric@boost@@@2@AEAV?$vector@V?$vector@NV?$unbounded_array@NV?$allocator@N@std@@@ublas@numeric@boost@@@ublas@numeric@ boost@@V?$allocator@V?$vector@NV?$unbounded_array@NV?$allocator@N@std@@@ublas@numeric@boost@@@ublas@numeric@boost@@@std@@@std@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCor e.vcxproj] geo_truss_element_linear_3D2N.obj : error LNK2001: unresolved external symbol "public: virtual class boost::numeric::ublas::bounded_matrix<double,6,6,struct boost::numeric::ublas::basic_row_major<unsigned int64,int64> > cdecl Krat os::TrussElementLinear3D2N::CreateElementStiffnessMatrix(class Kratos::ProcessInfo const &)" (?CreateElementStiffnessMatrix@TrussElementLinear3D2N@Kratos@@UEAA?AV?$bounded_matrix@N$05$05U?$basic_row_major@_K_J@ublas@numeric@boost@@@ubla s@numeric@boost@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_mechanics_application.obj : error LNK2001: unresolved external symbol "public: virtual class boost::numeric::ublas::bounded_matrix<double,6,6,struct boost::numeric::ublas::basic_row_major<unsigned int64,int64> > cdecl Kratos:: TrussElementLinear3D2N::CreateElementStiffnessMatrix(class Kratos::ProcessInfo const &)" (?CreateElementStiffnessMatrix@TrussElementLinear3D2N@Kratos@@UEAA?AV?$bounded_matrix@N$05$05U?$basic_row_major@_K_J@ublas@numeric@boost@@@ublas@nu meric@boost@@AEBVProcessInfo@2@@Z) [D:\src\Kratos\build\Release\applications\GeoMechanicsApplication\KratosGeoMechanicsCore.vcxproj] geo_truss_element_linear_3D2N.obj : error LNK2001: unresolved external symbol "public: virtual void
Seems that the TrussElementLinear3D2N
was still missing, can you pull and try?
It work! Thanks @roigcarlo for your help!
I close the issue
Description I derived some elements in GeoMechanicsApplication from the elements in StructuralMechanicsApplication. If I put them in GeoMechanicsApplication, I get errors in linking such as " unresolved external symbol". But if I move them to StructuralMechanicsApplication, they are compiled and linked without any errors. So, it seems that there is no problem with the derived elements. I guess my problem is related to the build script. Now, my question is if such a thing has been done before or should I simply move the derived elements to StructuralMechanicsApplication, although they might have little use in that application.
This is related to the discussion in #8464
Scope Which areas of Kratos are involved: