when i try to debug this program
in the log file i am getting this error
"An attempt was made to initialise an object in the null part"
i think problem lies in the function "formSection"
Code:
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include <vector>
#include "common.h"
#include"defGeometry.h"
#include <uf.h>
#include<uf_vec.h>
#include<uf_curve.h>
#include<uf_part.h>
using namespace std;
void defGeometry::populateGeometry(int nthPoint1, int nthPoint2)
{
//Initializing variables
//Points that controll the split of splines
nthN1Point = nthPoint1;
nthN2Point = nthPoint2;
for(int i=0;i<ActionSide.NumberOfSections;i++)
{
tag_t Spline1_tag=NULL_TAG,
Spline2_tag=NULL_TAG,
Spline3_tag=NULL_TAG,
Spline4_tag=NULL_TAG;
struct Section Spline1,
Spline2,
Spline3,
Spline4;
geometricSection tempGeomSect;
Spline1 = formSection(ActionSide.Sections[i],ReactionSide.Sections[i]);
Spline1_tag = createSplineThruPoints(Spline1);
Spline2 = SectionXtractPoints(ActionSide.Sections[i]);
Spline2_tag = createSplineThruPoints(Spline2);
Spline3 = SectionXtractPoints(ReactionSide.Sections[i]);
Spline3_tag = createSplineThruPoints(Spline3);
/*Spline4 = formSection(ReactionSide.Sections[i],ActionSide.Sections[i]);
Spline4_tag = createSplineThruPoints(Spline4);*/
tempGeomSect.section_tags["spline1"] =Spline1_tag;
tempGeomSect.section_tags["spline2"] =Spline2_tag;
tempGeomSect.section_tags["spline3"] =Spline3_tag;
tempGeomSect.section_tags["spline4"] =Spline4_tag;
sections.push_back(tempGeomSect);
//This is temp function need to be deleted
//UF_PART_save();
}
}
Section defGeometry::formSection( struct Section Section1,struct Section Section2)
{
int j;
struct Section defGeomSecTemp;
for(j=nthN1Point;j>=0;j--)
{
defGeomSecTemp.Points.push_back(Section1.Points[j]);
}
for(j=1;j<nthN2Point;j++)
{
defGeomSecTemp.Points.push_back(Section2.Points[j]);
}
defGeomSecTemp.NumberOfPoints = defGeomSecTemp.Points.size();
defGeomSecTemp.NumberOfPoints = nthN1Point+nthN2Point;
//nthN1Point=NumberOfPoints-(nthN1Point+nthN2Point-2)+nthN1Point;
//nthN2Point=NumberOfPoints-(nthN1Point+nthN2Point-2)+nthN2Point;
return defGeomSecTemp;
}
Section defGeometry::SectionXtractPoints(struct Section Section1)
{
int j;
struct Section defGeomSecTemp;
for(j=nthN1Point-1;j<NumberOfPoints-nthN2Point+1;j++)
{
defGeomSecTemp.Points.push_back(Section1.Points[j]);
}
defGeomSecTemp.NumberOfPoints=NumberOfPoints-(nthN1Point+nthN2Point-2);
return defGeomSecTemp;
}
tag_t defGeometry::createSplineThruPoints(struct Section thruSplineData)
{
int degree=3,
periodicity=0,
save_def_data = 0;
double *p_par=NULL;
tag_t thruSplineTag=NULL_TAG, ReplacedSpline=NULL_TAG;
UF_CURVE_pt_slope_crvatr_t point_data[1000];
for(int i=0; i<thruSplineData.NumberOfPoints; i++)
{
UF_VEC3_copy(thruSplineData.Points[i].pt,point_data[i].point);
point_data[i].slope_type = UF_CURVE_SLOPE_AUTO;
point_data[i].crvatr_type = UF_CURVE_CRVATR_NONE;
}
UF_CALL(UF_CURVE_create_spline_thru_pts(degree, periodicity,thruSplineData.NumberOfPoints,\
point_data, p_par,save_def_data,&thruSplineTag));
if(!thruSplineTag)
{
sysLogPrint("Failed to create spline %s", thruSplineData.Name);
return NULL_TAG;
}
return thruSplineTag;
}