我需要帮助确定函数调用分配的正确数据类型。
我正在尝试获取content. N_Vector u以下是文档所说的N_Vector:
类型
N_Vector定义为N_Vector u; tpedef struct _generic_N_Vector *N_Vector; struct _generic_N_Vector { void *content; struct _generic_N_Vector_Ops *ops; };...
[并行NVECTOR模块]将内容字段定义为
N_Vector包含全局和局部长度的结构、指向连续局部数据数组开头的指针、MPI通信器和标志。struct _N_VectorContent_Parallel { long int local_length; long int global_length; booleantype own_data; realtype *data; MPI_Comm comm; }
所以我想这意味着content“_generic_N_Vector指向”一个类型的结构_N_VectorContent_Parallel(对吗?)。
然后我尝试使用宏来访问content. 这是NV_CONTENT_P.
v_cont=NV_CONTENT_P(v)设置v_cont为指向N_Vectortype 的内容结构的指针struct _N_VectorParallelContent。
注意结构的不同名称!
这意味着什么?我声明v_cont是什么类型?
我试过了
N_Vector u;
...
_N_VectorParallelContent *v_cont1;
_N_VectorContent_Parallel *v_cont2;
v_cont1 = NV_CONTENT_P(u);
v_cont2 = NV_CONTENT_P(u);
但这些声明得到错误“'_N_VectorContent_Parallel' undeclared...”或“'_N_VectorParallelContent' undeclared...”。
但似乎这些结构必须已经被删除。我成功地声明(并使用了)u,类型为N_Vector。并且文档似乎说N_Vector包含这两种结构之一(或者可能两者兼有)。
那么为什么会出现错误消息? v_cont 声明接收数据 的正确数据类型是NV_CONTENT_P什么?
我知道这是一个冗长而详细的问题,但我理解的不够深入,无法再减少它。谢谢你的帮助。