Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create component #1293

Closed
jjcasmar opened this issue Mar 28, 2020 · 3 comments
Closed

Unable to create component #1293

jjcasmar opened this issue Mar 28, 2020 · 3 comments
Labels
issue: discussion Open topic of discussion

Comments

@jjcasmar
Copy link
Contributor

I have a multimap in a plugin and I am unable to create it.
The header file looks like this

template <typename TIn>
class CPFMapping : public sofa::core::MultiMapping<TIn, TIn>
public:
    SOFA_CLASS(SOFA_TEMPLATE(CPFMapping, TIn),  //
               SOFA_TEMPLATE2(sofa::core::MultiMapping, TIn, TIn));
    CPFMapping()
        : Inherit()
        , m_C(initData(&m_C, "C", "Cluster Matrix"))
    {
    }
...
};

and I register in the factory like this:

static int register_testComponent =
    sofa::core::RegisterObject("CPFMapping").add<CPFMapping<sofa::defaulttype::Vec3Types>>();

When trying to create the component with python

    final.addObject("CPFMapping",
                              template="Vec3",

I get the following error

The object is in the factory but cannot be created.  
Requested template: Vec3d,Vec3d(Vec3d,Vec3d)  
Available templates: Vec3d,Vec3d, 

I have tried Vec3, Vec3d, Vec3,Vec3 and Vec3d,Vec3d without success.
Not sure if this is a bug in SOFA or if I am doing something wrong with my component.

@jnbrunet
Copy link
Contributor

Hi @jjcasmar

MultiMapping need both an 'input' and 'output' data attributes pointing to valid mechanical objects.

With your example:
final.addObject("CPFMapping", template="Vec3", input="path/to/mo1", output="path/to/mo2" )

We are working on better diagnostic message for such failed object creation, see #1266 and #1294

@jjcasmar
Copy link
Contributor Author

Hi. I completely thought it was fromModels and toModels. I'll test with input and output, thanks!

@epernod epernod added the issue: discussion Open topic of discussion label Mar 28, 2020
@jjcasmar
Copy link
Contributor Author

Its working fine with the input/output. Sorry for the noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: discussion Open topic of discussion
Projects
None yet
Development

No branches or pull requests

3 participants