Fixed seg fault when there are only mswells

This commit is contained in:
Jose Eduardo Bueno 2020-09-30 18:34:50 -03:00
parent 7aad035bcf
commit 89cefd8d95
2 changed files with 7 additions and 4 deletions

View File

@ -75,9 +75,9 @@ namespace bda
}
void WellContributionsOCLContainer::copy_to_gpu(Opm::WellContributions &wellContribs, int *toOrder_){
if(num_std_wells > 0){
toOrder.insert(toOrder.end(), toOrder_, toOrder_ + Nb);
toOrder.insert(toOrder.end(), toOrder_, toOrder_ + Nb);
if(num_std_wells > 0){
cl::Event event;
std::vector<cl::Event> events(7);
queue->enqueueWriteBuffer(s.Cnnzs, CL_FALSE, 0, sizeof(double) * wellContribs.h_Cnnzs_ocl.size(), wellContribs.h_Cnnzs_ocl.data(), nullptr, &events[0]);
@ -159,10 +159,11 @@ namespace bda
// actually apply MultisegmentWells
for(auto well: *multisegments){
well->setReordering(toOrder.data(), true);
well->setReordering(toOrder.data(), reorder);
well->apply(x_msw.data(), y_msw.data());
}
// copy vector y from CPU to GPU
queue->enqueueWriteBuffer(y, CL_FALSE, 0, sizeof(double) * N, y_msw.data(), nullptr, &event);
event.wait();

View File

@ -31,11 +31,13 @@ namespace bda
private:
typedef std::vector<Opm::MultisegmentWellContribution*> mswVecT;
int N, Nb;
unsigned int dim, dim_wells;
unsigned int num_blocks = 0;
unsigned int num_std_wells = 0;
unsigned int num_ms_wells = 0; // number of MultisegmentWells in this object, must equal multisegments.size()
int N, Nb;
bool reorder = true;
std::vector<int> toOrder;
std::vector<double> x_msw, y_msw;
std::unique_ptr<mswVecT> multisegments;