FleX - NvFlexParams

Hi,

I am running FleX through Visual Studio 2017 and am getting the following error when using the NvFlexGetParams function:

error C2440: ‘type cast’: cannot convert from ‘void’ to ‘NvFlexParams *’
note: Expressions of type void cannot be converted to other types

I pulled out the relevant code (below) into its own project and continued to get the error.

// Initialize library
NvFlexLibrary *library = NvFlexInit();

// Initialize solver
int maxParticles{ 100 };
int maxDiffuseParticles{ 0 };
int maxNeightborsPerParticle{ 96 };
NvFlexSolver *solver = NvFlexCreateSolver(library, maxParticles, maxDiffuseParticles, maxNeightborsPerParticle);

// Set parameters
NvFlexParams params{ nullptr };
params = (NvFlexParams
)NvFlexGetParams(solver, params);

Am I using the NvFlexGetParams function incorrectly? Thank you

Best,

Andrew

Hi,

After spending more time looking at the API reference I see that NvFlexGetParams does not have a return value but rather takes the params pointer as an out parameter. How should I initialize (or where should I get) the params pointer to pass to NvFlexGetParams? Thank you

Best,

Andrew

Hi,

I figured it out. params must be initialized as a variable, not a pointer, then passed as a pointer.

// Set parameters
NvFlexParams params{};
NvFlexGetParams(solver, &params);

Best,

Andrew