Coder Social home page Coder Social logo

Comments (9)

certik avatar certik commented on August 29, 2024

How would that be done?

from hermes-legacy.

solin avatar solin commented on August 29, 2024

The vector knows whether it is real or complex, so why should
the user control this by calling either get_c_array() or get_c_array_cplx() ?
Imho the user should just call get_c_array() that would return a pointer
to scalar.

from hermes-legacy.

certik avatar certik commented on August 29, 2024

Because then you would have to compile hermes_common twice, once for real and once for complex numbers. Which I think is a step back, as I think we want to combine real and complex numbers in one project.

Maybe I am missing some other option how this would be done. I tried to do this for example:

double *get_c_array();
cplx *get_c_array();

but C++ doesn't allow such code -- it can only overload the methods if they have different arguments, not return values.

from hermes-legacy.

solin avatar solin commented on August 29, 2024

So why not make it

void get_c_array(double *c_array);
void get_c_array(cplx *c_array);

from hermes-legacy.

certik avatar certik commented on August 29, 2024

Nice idea, that should work. Well, probably something like this:

void get_c_array(double * &c_array);
void get_c_array(cplx * &c_array);

from hermes-legacy.

solin avatar solin commented on August 29, 2024

This is a good question. In order to avoid segfaults, I would
almost prefer to copy the vectors into user-supplied allocated
structures rather than exposing the pointers.

from hermes-legacy.

certik avatar certik commented on August 29, 2024

Well, we will use RPC anyways, and then you don't need to worry about this.

from hermes-legacy.

l-korous avatar l-korous commented on August 29, 2024

Hi, this has been done I think, is that right?

from hermes-legacy.

solin avatar solin commented on August 29, 2024

Yes, I am closing this. However, we have another issue in front
ot us, which is to allow multiphysics problems where part is real
and part complex. The resulting stiffness matrix must be real.
I created an issue for this recently.

from hermes-legacy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.