Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8403901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:27:28+00:00 2026-06-09T22:27:28+00:00

I am having some very strange behavior when using a set (it’s actual a

  • 0

I am having some very strange behavior when using a set (it’s actual a 3d vector of sets). I have the following at the end of a loop (the comments are behavior the fourth time the loop occurs, so it’s not happenining right away)

cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl; 
//returns 4

grid_locations[box_counter][0]=i*xgridlength;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl; 
//returns 4

grid_locations[box_counter][1]=(i+1)*xgridlength;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl; 
//returns 4

grid_locations[box_counter][2]=j*ygridlength;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl; 
//returns 4

grid_locations[box_counter][3]=(j+1)*ygridlength;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl; 
//returns 4

grid_locations[box_counter][4]=k*zgridlength;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl; 
//returns 4

grid_locations[box_counter][5]=(k+1)*zgridlength;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl;
// returns 1071644672

grid_rank_lookup[box_counter]=use_rank;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl;
// returns 1071644672

box_counter++;
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl;
// returns 1071644672

use_rank=(use_rank+1)%world.size();
cout<<"size of set at 3 0 0 is "<<particles_celllist.at(3).at(0).at(0).size()<<endl;
// returns 1071644672

The definition of particles_celllist, grid_rank_lookup, and grid_locations are:

vector<vector<vector<set<int> > > > particles_celllist;
map<int,vector<double> > grid_locations
map<int,int> grid_rank_lookup

Note: the first is a local variable, while the other 2 are inputs to the function.

I have no idea what is causing this or even how to go about figuring out what is wrong. I see no logical explanation within the confines of the code itself, so maybe it is something to do with the memory? The comments are what happens when I run it on a single processor, but if I do it on 2 processors (it is an mpi code) it seems to happen at a random time on a random processor (I didn’t include all the details here because the code is quite long, but I can post it if you feel the information here is not sufficient to guess at what is wrong)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:27:30+00:00Added an answer on June 9, 2026 at 10:27 pm

    1071644672 has the same value representation as 1.75 (as 32-bit values).

    grid_locations[box_counter][5]=(k+1)*zgridlength;
    

    is overwriting memory belonging to particles_celllist. Probably grid_locations[box_counter] is insufficiently large to allow grid_locations[box_counter][5] to access memory correctly; try changing it to grid_locations[box_counter].at(5) and see if it breaks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some very strange ListView behavior when using a StateListDrawable as the
I have having a very strange issue Using Eclipse With the Amazon Integration. If
I'm having some trouble doing a very simple task. I have a rich textbox
I'm very familiar with using Enums in other languages, but I'm having some difficulty
I'm very new to Objective-C, and am having some beginner issues. I have an
I'm making a blog API and am having some very strange issues when trying
My C# program has a very strange behavior. I'm using four ''hacky'' pinvoke methods
I'm having some troubles with displaying a graph. It's a very strange issue, because
So I am seeing some very strange functionality in my app. I have a
Having a very strange issue with a few creative banners. On some computers when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.