Visual Studio 2008 によるリリース構成でソリューションをビルドするときに、c++ ベクトルの使用に問題があります。コードはデバッグ構成で正常に動作します。オンラインで検索しましたが、私が抱えている問題を解決する解決策が見つかりませんでした。
これが私のコードの説明です。以下のようにクラスを定義しました。このクラスは、空間内の位置などを含む平面のいくつかのパラメーターを格納します。
class PIVPlaneConfig{
public:
int update(){
// Create the frame list for the PIV plane.
for ( int i = ListStart ;
i <= ListEnd;
i = i + ListStep){
FramesList.push_back(i);
}
return 0;
};
~PIVPlaneConfig(){
DirRaw = "";
DirProcessed = "";
FnamePreVel = "";
// Reset frames list
FramesList.clear();
};
std::string DirRaw;
std::string DirProcessed;
std::string FnamePreVel;
double pivScaleFactor;
double pivUnitFactorXY;
double pivUnitFactorVxVy;
Point2D planeOriginLocal;
Point3D planeOriginGlobal;
Point3D planeNormal;
bool CS;
int OutOfPlaneVelocity;
// Image Processing Configuration.
std::string FnamePreRawImage;
std::string FnameMaskImage;
int ElemShape;
int ElemShapeCols;
int ElemShapeRows;
Point2D ElemShapeAnchor;
int pivResolutionHorizontal;
int pivResolutionVertical;
// File listing.
int ListStart;
int ListStep;
int ListEnd;
std::vector < int > FramesList;
int nPlanes;
};
12 の異なる PlaneConfig を構成する機能があります。
int PlaneConfigInit( int FileIndexStart, int FileIndexStep, int FileIndexEnd, vector < PIVPlaneConfig >& Planes )
各 PlaneConfig は、関数 PlaneConfigInit で次のように初期化されます。簡単にするために、PLANE01 の初期化だけを行いました。
double CatiaScalingFactor = 3.8 / 84.839;
PIVPlaneConfig Plane;
// PLANE01
pivPlane.DirRaw = "Y:\\Rectangular\\Sagittal_01_001";
pivPlane.DirProcessed = "Y:\\Rectangular\\Sagittal_01_001\\Processed";
pivPlane.FnamePreVel = "Sagittal_01_";
pivPlane.FnamePreRawImage = "Sagittal_01_";
pivPlane.OutOfPlaneVelocity = FR3D_MISSING_OUT_OF_PLANE_W;
// File list.
pivPlane.ListStart = FileIndexStart;
pivPlane.ListStep = FileIndexStep;
pivPlane.ListEnd = FileIndexEnd;
pivPlane.planeOriginLocal.x = 0;
pivPlane.planeOriginLocal.y = 0;
pivPlane.planeOriginGlobal.x = -39.206 * CatiaScalingFactor;
pivPlane.planeOriginGlobal.y = 100.0 * CatiaScalingFactor;
pivPlane.planeOriginGlobal.z = -52.316 * CatiaScalingFactor;
// Plane unit normal vector.
pivPlane.planeNormal.x = 0;
pivPlane.planeNormal.y = 0;
pivPlane.planeNormal.z = 1.0;
pivPlane.CS = FR3D_CS_RECT;
pivPlane.update();
pivPlanes.push_back( pivPlane );
pivPlane.~PIVPlaneConfig();
上記のコードを 2 番目のプレーンに正確に使用し、これを 12 個のプレーン (PLANE01、PLANE02、...、PLANE12) すべてが関数 PlaneConfigInit 内で初期化されるまで続けます。これはデバッグでは完全に機能しますが、リリースでは機能しません。PLANE01 の初期化はクラッシュせずに行われますが、PLANE02 になると、push_back() 関数を使用したクラスの update() 関数でクラッシュします。
私の問題をうまく説明できたと思います。さらに情報が必要な場合はお知らせください。
どんな助けにも感謝します。
アフマド