473,410 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Progam not running

vj
Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go to Options--Linker and increase the MaxStackSize, which
sorts out the problem.

All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close. We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.

The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks

Apr 17 '07 #1
17 2028
vj wrote:
Hi All,

I am using C++Builder V5.0 to run my C programs.
what part of *comp*.*lang*.*c++* you haven't understood? In other words,
you are OT.

Additionally, crosspost is evil, so i've removed it.
I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go to Options--Linker and increase the MaxStackSize, which
sorts out the problem.
Oh well, this means that your program is bad written, not that you do
huge amount of data processing. Don't use static memory if you have to
allocate big data structures.
>
All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close. We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.
I suggest you not to send. Apart from this, if the compiler crashes,
change compiler.
The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
it's not the case. Is the limited stack size. Use dynamic allocation.

Regards,

Zeppe
Apr 17 '07 #2
vj wrote:
Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go to Options--Linker and increase the MaxStackSize, which
sorts out the problem.

All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close.
This means that the Integrated Development Environment (IDE) has
crashed. Your program has nothing to do with this. As the message says:
"C++ Builder Development Environment has encountered a problem "
not your program.

We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.
Send it to Microsoft, but probably your project file has been corrupted.
Just rebuild your project from scratch and it will probably work.
The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks
This has nothing to do with your program. It is NOT your program
that crashed but VC++
Apr 17 '07 #3
On Apr 17, 11:37 am, jacob navia <j...@jacob.remcomp.frwrote:
[snip]
This has nothing to do with your program. It is NOT your program
that crashed but VC++
I doubt it. He said he is running C++ Builder. That's Borland.

To the O.P.:
If you can produce a simple example that demonstrates the problem,
post it here and we can diagnose it.

Apr 17 '07 #4
jacob navia said:
vj wrote:
<snip>
>We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.

Send it to Microsoft,
Why? What can they do to help?

<snip>
This has nothing to do with your program. It is NOT your program
that crashed but VC++
I disagree. This is the C++ Builder debugger that's crashed, probably as
a result of the OP ignorantly* breaching some unwritten limit.

* This is not intended as an insult. For even the most knowledgeable
programmers, that state of knowledge is preceded by a state of
ignorance.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Apr 17 '07 #5
vj wrote:
Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go to Options--Linker and increase the MaxStackSize, which
sorts out the problem.

All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close. We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.

The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks
Have you recently updated/upgraded your OS and/or IDE ?
Apr 17 '07 #6
Aioanei Rares said:
vj wrote:
>Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert
in C.
<snip>
Have you recently updated/upgraded your OS and/or IDE ?
Occam's Razor applies. The most likely cause of his troubles is that he
has a misconception about C that is causing him to write programs that
BCB's runtime is having trouble with. The fix is almost certainly to
take a look at one or two of his C programs that have been causing him
trouble, and see if we can't spot some obvious abuse or other.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Apr 17 '07 #7

"jacob navia" <ja***@jacob.remcomp.frwrote in message
news:46***********************@news.orange.fr...
vj wrote:
>Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go to Options--Linker and increase the MaxStackSize, which
sorts out the problem.

All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close.

This means that the Integrated Development Environment (IDE) has
crashed. Your program has nothing to do with this. As the message says:
"C++ Builder Development Environment has encountered a problem "
not your program.

>We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.

Send it to Microsoft, but probably your project file has been corrupted.
Just rebuild your project from scratch and it will probably work.
>The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks

This has nothing to do with your program. It is NOT your program
that crashed but VC++
<OT>
Well I guess I need to read up. I didn't know Borland used VC++.

There is never a use in sending a problem to Microsoft.

Ask in a forum that deals with Borland, some of them can be
found simply by searching for Borland C.
</OT>

Apr 17 '07 #8
"vj" <vi**********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go to Options--Linker and increase the MaxStackSize, which
sorts out the problem.

All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close. We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.

The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks
If you are having to increase your stack for your programs to run, you
should probably use the freestore instead of stack memory.

That is, instead of having:

int MyArray[10000];
you should do:
int* MyArray;
MyArray = malloc( sizeof( int ) * 10000 );

Then later

free( MyArray );
when you are done with the memory.

(In C++ you would use new and delete).

Check for MyArray being null. I don't remember if you have to cast it in C
or not. Either C or C++ you have to cast from malloc, but I don't remember
which. Anyway, this will use the freestore which you have a lot more of.

The other reason you could need a lot of stack space is because of
recursion, not much you can do there except either make it non recursive or
just increase the stack size.
Apr 17 '07 #9
vj
On Apr 17, 10:19 pm, vj <vijayjany...@gmail.comwrote:
Hi All,

I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go toOptions--LinkerandincreasetheMaxStackSize, which
sorts out the problem.

All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:

C++ Builder Development Environment has encountered a problem and
needs to close. We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.

The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks
Hi All,
Thanks a lot for all your replies. As an update, I have noticed that I
get an error message in the small window at the bottom of the source-
code window saying: "[Linker Errror] Could not create filename.tds
[error code 123]". Here filename is the actual filename of my file.

I remember I have run this code successfully in the past, and also
other programmes are still working fine (that have lower memory
requirements I think). I have not changed my OS and/or IDE or any
other changes. I have tried sending the report to Microsoft (as
suggested in one of the replies), but after sending the report, it
just says "error reporting complete", and doesn't give any feedback.
I have also tried making the project from scratch, but no success,
same problems continues.

Apr 18 '07 #10
On Apr 17, 8:03 pm, vj <vijayjany...@gmail.comwrote:
On Apr 17, 10:19 pm, vj <vijayjany...@gmail.comwrote:
Hi All,
I am using C++Builder V5.0 to run my C programs. I am not an expert in
C. Normally, I run the C program with these steps: 'Compile', 'Make
Project', 'Build Project' and then 'Run'. Many a times, I have a stack
overflow error due to huge amount of data processing involved, and for
this, I go toOptions--LinkerandincreasetheMaxStackSize, which
sorts out the problem.
All of a sudden, I have started to get trouble with one of my
programs, and I know I have run this program successfully in the past.
The problem is : When I click on 'Make Project' after 'Compile Unit'
operation, I get the following error dialog box:
C++ Builder Development Environment has encountered a problem and
needs to close. We are sorry for the inconvenience. Please tell
Microsoft about this problem. (Send)(Don't Send) etc.
The other C programs, some of which in the same directory, are running
alright. This particular program has huge data involved. Within this
program, if I decrease the array dimensions, it works fine. I have
freed some memory also from my hard disk suspecting that this problem
may be due to insufficient memory, but that doesn't serve the purpose.
Any suggestions are most welcome.
Thanks

Hi All,
Thanks a lot for all your replies. As an update, I have noticed that I
get an error message in the small window at the bottom of the source-
code window saying: "[Linker Errror] Could not create filename.tds
[error code 123]". Here filename is the actual filename of my file.
How much free disk space is currently available on your machine?
I remember I have run this code successfully in the past, and also
other programmes are still working fine (that have lower memory
requirements I think). I have not changed my OS and/or IDE or any
other changes. I have tried sending the report to Microsoft (as
suggested in one of the replies), but after sending the report, it
just says "error reporting complete", and doesn't give any feedback.
I have also tried making the project from scratch, but no success,
same problems continues.
Since Microsoft does not make C++ Builder, I suggest that you have
sent the problem report to the wrong place.

Apr 18 '07 #11
vj said:

<snip>
I have also tried making the project from scratch, but no success,
same problems continues.
So perhaps now is the time to show us the code that you're struggling
with. (Actually, earlier was the time, but now will do.)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Apr 18 '07 #12
vj
On Apr 18, 9:11 am, Richard Heathfield <r...@see.sig.invalidwrote:
vj said:

<snip>
I have also tried making the project from scratch, but no success,
same problems continues.

So perhaps now is the time to show us the code that you're struggling
with. (Actually, earlier was the time, but now will do.)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999http://www.cpax.org.uk
email: rjh at the above domain, - www.
Thanks for the replies. The free disk space is at least 4 GB.
I am copying below the code. The interesting thing is that the same
code is running alright on a different machine, so this makes me think
that there seems to be problem with my machine. (Of course I have to
increase the stack size on the other machine also, and this is what I
normally do, and it works fine). As mentioned in my previous post, I
don't remember doing anything signifacant with the machine (only thing
I can remember is wiriting a songs CD using Nero). Here is the code
(I admit that the code is far from being an example of an efficient
code :), but serves my purpose well) :

#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stddef.h>
#include <complex.h>
#include <fstream>
#include <time.h>
#define PI 3.14159265
#define c 3.0e8
#define dX 50.0e-9//73.170731e-9
#define dT dX/(c)

#define NX 780
#define NY 600

#define NM 4
#define double_complex complex <double>
class D2{
public:
int NT;
double **V10, **V11, **V8, **V9, **Iy, **Ix, **Vz;
double **Sez;
double **pez, **X1z, **X2z;
double ALPHA[NM], d[NM], w0[NM];
double Tp0[NM], b0, b1[NM], b2[NM], b3[NM], Tp1[NM], Te2[NM],
Te1[NM];

double *h1, *h2, *h3, *h4;
int X, Y, N;

D2( );
~D2( );
void iterate( );
};

main(){
time_t starttime,endtime;
starttime=time(NULL);

D2 A;
A.iterate();
endtime=time(NULL);
cout<<endl<<"Total Run time"<<"\t"<<endtime-starttime<<" sec
("<<(endtime-starttime)/60<<" min "<<(endtime-starttime)%60<<"
sec)"<<endl;

getchar();
}

D2 :: D2(){
int array_counter;
V10 = new double *[NX];
V11 = new double *[NX];
V8 = new double *[NX];
V9 = new double *[NX];
Iy = new double *[NX];
Ix = new double *[NX];
Vz = new double *[NX];
Sez = new double *[NX];
pez = new double *[NX];
X1z = new double *[NX];
X2z = new double *[NX];

for (array_counter = 0; array_counter < NX; array_counter++)
{
V10[array_counter] = new double [NY];
V11[array_counter] = new double [NY];
V8[array_counter] = new double [NY];
V9[array_counter] = new double [NY];
Iy[array_counter] = new double [NY];
Ix[array_counter] = new double [NY];
Vz[array_counter] = new double [NY];
//Sey[array_counter] = new double [NY];
Sez[array_counter] = new double [NY];
pez[array_counter] = new double [NY];
//pey[array_counter] = new double [NY];
X1z[array_counter] = new double [NY];
//X1y[array_counter] = new double [NY];
X2z[array_counter] = new double [NY];
//X2y[array_counter] = new double [NY];
}
cout << "Enter no. of Timesteps (NT) - ";
cin >NT;
ofstream outfileNT("Last_NT.out");
outfileNT<<"Last NT= "<<NT<<endl;
// NT=30;
h1=new double [NT];
h2=new double [NT];
h3=new double [NT];
h4=new double [NT];
}

D2 :: ~D2(){
int array_counter;
for (array_counter = 0; array_counter < NX; array_counter++)
{
delete [] V10[array_counter];
delete [] V11[array_counter];
delete [] V8[array_counter];
delete [] V9[array_counter];
delete [] Iy[array_counter];
delete [] Ix[array_counter];
delete [] Vz[array_counter];
// delete [] Sey[array_counter];
delete [] Sez[array_counter];
delete [] pez[array_counter];
// delete [] pey[array_counter];
delete [] X1z[array_counter];
// delete [] X1y[array_counter];
delete [] X2z[array_counter];
//delete [] X2y[array_counter];
}
delete [] V10;
delete [] V11;
delete [] V8;
delete [] V9;
delete [] Iy;
delete [] Ix;
delete [] Vz;
// delete [] Sey;
delete [] Sez;
delete [] pez;
// delete [] pey;
delete [] X1z;
// delete [] X1y;
delete [] X2z;
// delete [] X2y;

delete []h1;
delete []h2;
delete []h3;
delete []h4;

}
void D2 :: iterate(){

ofstream outfile1("sp_dist_Ix_NL.out");
//ofstream outfile1_ENV("sp_dist_Vx_NL_Envelope.out");
ofstream outfile2A("FFT_Vz_NL.out");
//ofstream outfile2B("FFT_Vy_NL.out");
//ofstream outfile2C("FFT_I_NL.out");
//ofstream outfile2D("FFT_P_NL.out");
ofstream outfile3("TimeData_NL.out");

//ofstream outfile4A("sp_dist_Vy_NL_1.out");
//ofstream outfile4B("sp_dist_Vy_NL_2.out");
//ofstream outfile4C("sp_dist_Vy_NL_3.out");
ofstream outfile4("sp_dist_Iy_NL.out");
ofstream outfileMatProfile("MaterialProfile.out");

//ofstream outfile4_ENV("sp_dist_Vy_NL_Envelope.out");
ofstream outfile5("sp_dist_Vz_NL.out");
ofstream outfile5A("sp_dist_Vz_NL_NT1000.out");
ofstream outfile5B("sp_dist_Vz_NL_NT1200.out");
ofstream outfile5C("sp_dist_Vz_NL_NT1400.out");
ofstream outfile5D("sp_dist_Vz_NL_NT800.out");
//ofstream outfile5E("sp_dist_Vz_NL_NT400.out");

//ofstream outfile5_ENV("sp_dist_I_NL_Envelope.out");
ofstream outfile6("sp_dist_P_NL.out");

//ofstream outfile6_ENV("sp_dist_P_NL_Envelope.out");
ofstream StoreVoltages("AllVoltages.out");
ifstream ReadVoltages("AllVoltages_400.in");
int MaterialPresent[NX][NY];

int NLB = 220;//NX-10;
int StripStartY_LEFT = (NY/2)-30;
int StripEndY_LEFT = (NY/2)+30;

int StripStartY_RIGHT = StripStartY_LEFT;//(NY/2)-6; //=144;
int StripEndY_RIGHT = StripEndY_LEFT;//(NY/2)+6; //=156;
for (X=0; X<NX; X++)
{
for (Y=0; Y<NY; Y++)
{
if (X<=NLB)
{
if (Y>=StripStartY_LEFT && Y<=StripEndY_LEFT) MaterialPresent[X][Y]
=1;
else MaterialPresent[X][Y]=0;

}
if (X>NLB)
{
if (Y>=StripStartY_RIGHT && Y<=StripEndY_RIGHT)
MaterialPresent[X][Y] =2;
else MaterialPresent[X][Y]=3;
}

outfileMatProfile<<MaterialPresent[X][Y];

}
outfileMatProfile<<endl;
}

double CH[NM];
double T1[NM];

CH[0] = (10.487 * 10.487) - 1.0;
CH[1] = (10.491 * 10.491) - 1.0;
CH[2] = (10.491 * 10.491) - 1.0;
CH[3] = (10.487 * 10.487) - 1.0;

double n0_0=10.487, n0_1=10.491, n0_2=10.491, n0_3=10.487, n2=2.5e16;
double e0 = 8.854e-12;
double Z0=376.7;
double dCH_0 = n0_0*n0_0 + 1.0;
double dCH_1 = n0_1*n0_1 + 1.0;
double dCH_2 = n0_2*n0_2 - 1.0;
double dCH_3 = n0_3*n0_3 + 1.0;

double alpha_value_0 = 2.0 * n0_0 * n2 / (dCH_0*dCH_0*dCH_0*2.0*Z0) ;
double alpha_value_1 = 2.0 * n0_1 * n2 / (dCH_1*dCH_1*dCH_1*2.0*Z0) ;
double alpha_value_2 = 2.0 * n0_2 * n2 / (dCH_2*dCH_2*dCH_2*2.0*Z0) ;
double alpha_value_3 = 2.0 * n0_3 * n2 / (dCH_3*dCH_3*dCH_3*2.0*Z0) ;
double x=-0*1.0/2000.0;
ALPHA[0] = 0.0*alpha_value_0;
ALPHA[1] = 0.0*alpha_value_1;
ALPHA[2] = x*alpha_value_2;
ALPHA[3] = x*alpha_value_3;

w0[0] = 2.0 * M_PI * 1500e12;
w0[1] = 2.0 * M_PI * 1500e12;
w0[2] = 2.0 * M_PI * 1500e12;
w0[3] = 2.0 * M_PI * 1500e12;

d[0] = w0[0] * 1e-3;
d[1] = w0[1] * 1e-3;
d[2] = w0[2] * 1e-3;
d[3] = w0[3] * 1e-3;

w0[0] = 2.0 * M_PI * 1500e12 * 1e50;
w0[1] = 2.0 * M_PI * 1500e12 * 1e50;
w0[2] = 2.0 * M_PI * 1500e12 * 1e50;
w0[3] = 2.0 * M_PI * 1500e12 * 1e50;


w0[0] = w0[0] * (dT);
w0[1] = w0[1] * (dT);
w0[2] = w0[2] * (dT);
w0[3] = w0[3] * (dT);

d[0] = d[0] * (dT);
d[1] = d[1] * (dT);
d[2] = d[2] * (dT);
d[3] = d[3] * (dT);

double Convergence_z = 1.5e-9;
//double Convergence_y = 1.5e-9;

Tp0[0] = 1.0 / (4.0 + 4.0*d[0]);
Tp0[1] = 1.0 / (4.0 + 4.0*d[1]);
Tp0[2] = 1.0 / (4.0 + 4.0*d[2]);
Tp0[3] = 1.0 / (4.0 + 4.0*d[3]);

b0 = 8.0;

b1[0] = -2.0 * w0[0] * w0[0];
b1[1] = -2.0 * w0[1] * w0[1];
b1[2] = -2.0 * w0[2] * w0[2];
b1[3] = -2.0 * w0[3] * w0[3];

b2[0] = 2.0 * CH[0] * w0[0] * w0[0];
b2[1] = 2.0 * CH[1] * w0[1] * w0[1];
b2[2] = 2.0 * CH[2] * w0[2] * w0[2];
b2[3] = 2.0 * CH[3] * w0[3] * w0[3];

b3[0] = -(4.0 - 4.0 * d[0]);
b3[1] = -(4.0 - 4.0 * d[1]);
b3[2] = -(4.0 - 4.0 * d[2]);
b3[3] = -(4.0 - 4.0 * d[3]);

double Te = 0.5;
double Ke = -2.0;
Tp1[0] = 1.0 / (1.0 + 2.0 * CH[0] * w0[0] * w0[0] * Tp0[0] * Te);
Tp1[1] = 1.0 / (1.0 + 2.0 * CH[1] * w0[1] * w0[1] * Tp0[1] * Te);
Tp1[2] = 1.0 / (1.0 + 2.0 * CH[2] * w0[2] * w0[2] * Tp0[2] * Te);
Tp1[3] = 1.0 / (1.0 + 2.0 * CH[3] * w0[3] * w0[3] * Tp0[3] * Te);

Te2[0] = Tp0[0];
Te2[1] = Tp0[1];
Te2[2] = Tp0[2];
Te2[3] = Tp0[3];

Te1[0] = CH[0] * w0[0] * w0[0];
Te1[1] = CH[1] * w0[1] * w0[1];
Te1[2] = CH[2] * w0[2] * w0[2];
Te1[3] = CH[3] * w0[3] * w0[3];

double r_Abs_LEFT, r_Abs_RIGHT, r_Abs_TOP, r_Abs_BOTTOM;
//double r_Metal = -1.0;

int Noff=300;
for (X=0; X<NX; X++)
{
for (Y=0; Y<NY; Y++)
{
V10[X][Y] = V11[X][Y] = V8[X][Y] = V9[X][Y] =Iy[X][Y]=Ix[X][Y]=Vz[X]
[Y]/*=Sey[X][Y]*/=Sez[X][Y]=0.0;
pez[X][Y] = /*pey[X][Y] =*/ X1z[X][Y] = /*X1y[X][Y] =*/ X2z[X][Y] /
*= X2y[X][Y]*/ = 0.0;
}
}

int SignalFromSource, SignalFromFile;
SignalFromSource=1;
SignalFromFile=!SignalFromSource;
if (SignalFromSource==1){cout<<"Taking input signal from SOURCE.....
\n";}
if (SignalFromFile==1){cout<<"Taking input signal from File.....\n";}

if (SignalFromFile==1)
{
for (X=0; X<NX; X++)
{
for (Y=NY-1; Y>=0; Y--)
{
if(X>=150 && X<990)
{
int Xn = X-148;
ReadVoltages>>V8[Xn][Y]>>V9[Xn][Y]>>V10[Xn][Y]>>V11[Xn]
[Y]>>Ix[Xn][Y]>>Iy[Xn][Y]>>Vz[Xn][Y]>>/*Sex[Xn][Y]>>*/Sez[Xn]
[Y]>>X1z[Xn][Y]>>X2z[Xn][Y]>>/*X1y[Xn][Y]>>X2y[Xn][Y]>>*/pez[Xn][Y]/
*>>pey[Xn][Y]*/;
}
else {double junk;
ReadVoltages>>junk>>junk>>junk>>junk>>junk>>junk>> junk>>junk>>junk>>junk>>junk/
*>>junk>>junk>>junk>>junk*/;}
}

}
}

for (N=0; N<NT; N++)
{

/*if (N%200==0) */cout << "Time Step N= "<<N<<endl;

if (SignalFromSource==1)
{
// if (N<Noff)

{

for (Y=0; Y<NY; Y++)//Y=NY/2;//=150;
// Y=NY/2.0;
{

double MD = (1000.0/sqrt(2.0))* exp(log(0.001)*(N-double(Noff)/
2.0)*(N-double(Noff)/2.0)/((double(Noff)/2.0)*(double(Noff)/2.0)))*
cos(2.0 * PI * 196.07843e12 * double(N) * dT);

double a= (StripEndY_LEFT - StripStartY_LEFT +1.0)/2.0;
double u=/*0.9899;0.872;*/ 0.573982;
double w=/*1.508;1.038;*/ 0.371137;
if (Y>= StripStartY_LEFT && Y<=StripEndY_LEFT)
{
V10[20][Y]+= (0.5/sqrt(2.0))* MD *cos((Y-NY/2.0)*(u/a)) /
cos(a);
V11[20][Y]+= (0.5/sqrt(2.0))* MD*cos((Y-NY/2.0)*(u/a)) /
cos(a);
V8[20][Y]+=0.5/sqrt(2.0) * MD*cos((Y-NY/2.0)*(u/a)) /
cos(a);
V9[20][Y]+= 0.5/sqrt(2.0) * MD*cos((Y-NY/2.0)*(u/a)) /
cos(a);
}
else
{

V10[20][Y]+= (0.5/sqrt(2.0) )* MD *exp(-fabs(Y-NY/2.0)*w/a)/
exp(-a);
V11[20][Y]+= (0.5/sqrt(2.0) )* MD*exp(-fabs(Y-NY/2.0)*w/a)/
exp(-a);
V8[20][Y]+=0.5/sqrt(2.0) * MD*exp(-fabs(Y-NY/2.0)*w/a)/
exp(-a);
V9[20][Y]+= 0.5/sqrt(2.0) * MD*exp(-fabs(Y-NY/2.0)*w/a)/
exp(-a);
}


}
}
}
int Xout =115 ;
int Yout =(double(NY))/2.0;

h1[N] = Vz[Xout][Yout];
//h2[N] = Iy[Xout][Yout];
//h3[N] = Vz[Xout][Yout];
//h4[N] = Ix[Xout][Yout] * Ix[Xout][Yout] + Iy[Xout][Yout] * Iy[Xout]
[Yout];
outfile3<<N<<" "<<h1[N]<<endl;
for (X=0; X<NX; X++)
{
for (Y=0; Y<NY; Y++)
{
double v8 = V8[X][Y];
double v9 = V9[X][Y];
double v10 = V10[X][Y];
double v11 = V11[X][Y];
// if (N>=54) cout<<"X= "<<X<<" Y= "<<Y<<" N=
"<<N<<endl;
// I[X][Y] = 0.5 * (-V2[X][Y]+ V4[X][Y] + V3[X][Y] - V5[X][Y]);
Ix[X][Y] = (V8[X][Y] + V9[X][Y]);
Iy[X][Y] = (V10[X][Y] + V11[X][Y]);

//if (Iy[X][Y]!=0.0) {cout<<"N= "<<N<<" X= "<<X<<"
Y= "<<Y<<" Iy[X][Y]= "<<Iy[X][Y]<<endl;char fff; cin>>fff;}

// Vy[X][Y] = V4[X][Y] + V5[X][Y];
{
double Uez = (Te * (2.0 * (v9+v10) + Sez[X][Y]))/2.0;
double Wez = Te2[MaterialPresent[X][Y]] * (b2[MaterialPresent[X]
[Y]] * Uez + X1z[X][Y]);
double P0z = pez[X][Y];

// int itercount_z =0;
for ( ; ; ) {
// if (X==310 && Y==25){ cout<<"itercount_y =
"<<itercount_y<<" at timestep N = "<<N<<" (X,Y) = "<<X<<","<<Y<<endl;
char iterchecky; cin>>iterchecky;}
// itercount_z++;
double P1z = P0z - (P0z - b1[MaterialPresent[X][Y]] *
Te2[MaterialPresent[X][Y]] *exp(ALPHA[MaterialPresent[X]
[Y]]*(P0z*P0z)) * P0z - Wez) / (1.0 - 0.5*b1[MaterialPresent[X][Y]] *
Te2[MaterialPresent[X][Y]] *exp(ALPHA[MaterialPresent[X]
[Y]]*(P0z*P0z)) * (1.0 + 2.0*ALPHA[MaterialPresent[X][Y]]*P0z*P0z) );
if (fabs(P1z - P0z) < Convergence_z) {pez[X][Y] = P1z;
break;}
P0z = P1z;
}
Vz[X][Y] = Uez + 2.0 * Te * pez[X][Y];
Sez[X][Y] = (2.0 * (V10[X][Y] - V11[X][Y] + V8[X][Y] - V9[X]
[Y]) + 2.0* Ke * Vz[X][Y] + 2.0* 2.0 * pez[X][Y]);

X1z[X][Y] = b0 * pez[X][Y] + b1[MaterialPresent[X][Y]] *
exp((ALPHA[MaterialPresent[X][Y]]*(pez[X][Y]*pez[X][Y]))) *pez[X][Y] +
b2[MaterialPresent[X][Y]] *
Vz[X][Y] + X2z[X][Y];
//if (N>474 && X>400 ){ cout<<"X= "<<X<<" Y= "<<Y<<" N= "<<N<<"
X1z[X][Y]= "<<X1z[X][Y]<<endl; char zz; cin>>zz;}
X2z[X][Y] = b3[MaterialPresent[X][Y]] * pez[X][Y] +
0.5*b1[MaterialPresent[X][Y]] * exp((ALPHA[MaterialPresent[X]
[Y]]*(pez[X][Y]*pez[X][Y] ))) * pez[X][Y] + 0.5*b2[MaterialPresent[X]
[Y]] *
Vz[X][Y];
}


//Vx[X][Y] = V2[X][Y] + V3[X][Y];
V10[X][Y] = Vz[X][Y] + Iy[X][Y] - v11;
V11[X][Y] = Vz[X][Y] + Iy[X][Y] - v10;
V8[X][Y] = Vz[X][Y] - Ix[X][Y] - v9;
V9[X][Y] = Vz[X][Y] + Ix[X][Y] - v8;
}
}
double tempref89=20.0;
double tempref1011=20.0;

for (Y=0; Y<NY; Y++)
{
if (Y>=StripStartY_LEFT && Y<=StripEndY_LEFT) r_Abs_LEFT =
(sqrt(tempref1011) - sqrt(CH[1] + 1.0)) / (sqrt(tempref1011) +
sqrt(CH[1] + 1.0));
else r_Abs_LEFT = (sqrt(tempref1011) - sqrt(CH[0] + 1.0)) /
(sqrt(tempref1011) + sqrt(CH[0] + 1.0));

if (Y>=StripStartY_RIGHT && Y<=StripEndY_RIGHT) r_Abs_RIGHT =
(sqrt(tempref1011) - sqrt(CH[2] + 1.0)) / (sqrt(tempref1011) +
sqrt(CH[2] + 1.0));
else r_Abs_RIGHT = (sqrt(tempref1011) - sqrt(CH[3] + 1.0)) /
(sqrt(tempref1011) + sqrt(CH[3] + 1.0));

//r_Abs_RIGHT = (sqrt(2.0) - sqrt(CH[2] + 1.0)) / (sqrt(2.0) +
sqrt(CH[2] + 1.0));
//r_Abs_RIGHT = r_Abs_LEFT;
//r_Abs_RIGHT = (sqrt(2.0) - sqrt(CH[2] + 1.0)) / (sqrt(2.0) +
sqrt(CH[2] + 1.0));

r_Abs_LEFT=r_Abs_RIGHT=0.3637;
V10[0][Y] = V10[0][Y]*(-r_Abs_LEFT);
V11[NX-1][Y] = V11[NX-1][Y] *(-r_Abs_RIGHT);
}
for (X=0; X<NX; X++)
{
if (X>NLB) r_Abs_BOTTOM = (sqrt(tempref89) - sqrt(CH[3] +
1.0)) / (sqrt(tempref89) + sqrt(CH[3] + 1.0));
else r_Abs_BOTTOM = (sqrt(tempref89) -
sqrt(CH[0] + 1.0)) / (sqrt(tempref89) + sqrt(CH[0] + 1.0));

if (X>NLB) r_Abs_TOP = (sqrt(tempref89) - sqrt(CH[3] + 1.0)) /
(sqrt(tempref89) + sqrt(CH[3] + 1.0));
else r_Abs_TOP = (sqrt(tempref89) - sqrt(CH[0] + 1.0)) /
(sqrt(tempref89) + sqrt(CH[0] + 1.0));
r_Abs_BOTTOM=r_Abs_TOP=0.3637;
V8[X][0] = V8[X][0] *(-r_Abs_BOTTOM);
V9[X][NY-1] = V9[X][NY-1] *(-r_Abs_TOP);

}


if (N==1000)
{

for (X=0; X<NX; X++)
{
for (Y=NY-1;Y>=0; Y--)
{

outfile5A<<X<<"\t"<<Y<<"\t"<<Vz[X][Y]<<endl;

}
outfile5A<<endl;

}
}

if (N==1200)
{

for (X=0; X<NX; X++)
{
for (Y=NY-1;Y>=0; Y--)
{

outfile5B<<X<<"\t"<<Y<<"\t"<<Vz[X][Y]<<endl;

}
outfile5B<<endl;

}
}


if (N==1400)
{

for (X=0; X<NX; X++)
{
for (Y=NY-1;Y>=0; Y--)
{

outfile5C<<X<<"\t"<<Y<<"\t"<<Vz[X][Y]<<endl;

}
outfile5C<<endl;

}
}
if (N==800)
{

for (X=0; X<NX; X++)
{
for (Y=NY-1;Y>=0; Y--)
{

outfile5D<<X<<"\t"<<Y<<"\t"<<Vz[X][Y]<<endl;

}
outfile5D<<endl;

}
}

if (N>1)
{

for (X=0; X<NX; X++)
{
{
}

}
}

}



for (X=0; X<NX; X++)
{
for (Y=NY-1;Y>=0; Y--)
{

outfile1<<X<<"\t"<<Y<<"\t"<<Ix[X][Y]<<endl;
outfile4<<X<<"\t"<<Y<<"\t"<<Iy[X][Y]<<endl;
outfile5<<X<<"\t"<<Y<<"\t"<<Vz[X][Y]<<endl;
outfile6<<X<<"\t"<<Y<<"\t"<<Iy[X][Y]*Iy[X][Y]+Ix[X][Y]*Ix[X]
[Y]<<endl;
StoreVoltages<<V8[X][Y]<<"\t"<<V9[X][Y]<<"\t"<<V10[X]
[Y]<<"\t"<<V11[X][Y]<<"\t"<<Ix[X][Y]<<"\t"<<Iy[X][Y]<<"\t"<<Vz[X]
[Y]<<"\t"<<Sez[X][Y]<<"\t"/*<<Sey[X][Y]*/<<"\t"<<X1z[X]
[Y]<<"\t"<<X2z[X][Y]<<"\t"<</*X1y[X][Y]<<"\t"<<X2y[X]
[Y]<<*/"\t"<<pez[X][Y]/*<<"\t"<<pey[X][Y]*/<<endl;

}
outfile1<<endl;
outfile4<<endl;
outfile5<<endl;
outfile6<<endl;
}


}





Apr 18 '07 #13
vj said:

<snip>
Thanks for the replies. The free disk space is at least 4 GB.
I am copying below the code. The interesting thing is that the same
code is running alright on a different machine, so this makes me think
that there seems to be problem with my machine. (Of course I have to
increase the stack size on the other machine also, and this is what I
normally do, and it works fine). As mentioned in my previous post, I
don't remember doing anything signifacant with the machine (only thing
I can remember is wiriting a songs CD using Nero). Here is the code
(I admit that the code is far from being an example of an efficient
code :), but serves my purpose well) :
The code is not C (as you originally claimed). It's closer to being C++,
but has issues even as a C++ program. I suggest, therefore, that you
constrain further discussion of it to alt.comp.lang.learn.c-c++
(followups set).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Apr 18 '07 #14
user923005 wrote:
>I remember I have run this code successfully in the past, and also
other programmes are still working fine (that have lower memory
requirements I think). I have not changed my OS and/or IDE or any
other changes. I have tried sending the report to Microsoft (as
suggested in one of the replies), but after sending the report, it
just says "error reporting complete", and doesn't give any feedback.
I have also tried making the project from scratch, but no success,
same problems continues.

Since Microsoft does not make C++ Builder, I suggest that you have
sent the problem report to the wrong place.
As if.

Zeppe
Apr 18 '07 #15
[removed c.l.c from the groups, as this is OT there]

vj wrote:

<snip>
#define NX 780
#define NY 600

#define NM 4
#define double_complex complex <double>
<snip>
void D2 :: iterate(){
<snip>
int MaterialPresent[NX][NY];
This variable alone takes up about 1.7 MB of memory (assuming 32-bit
int).
Variables with that kind of size should not be placed on the stack, but
should be allocated dynamically.

int** MaterialPresent = new int*[NX];
for (int i=0; i<NX; i++)
{
MaterialPresent[i] = new int[NY];
}

And don't forget to delete this memory at the end of the function.

I have not checked for other problems, as I don't have the time to
really analyse such a single big function.

Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/
Apr 18 '07 #16
"vj" <vi**********@gmail.comwrote in message
news:11*********************@b75g2000hsg.googlegro ups.com...
On Apr 18, 9:11 am, Richard Heathfield <r...@see.sig.invalidwrote:
>vj said:

<snip>
I have also tried making the project from scratch, but no success,
same problems continues.

So perhaps now is the time to show us the code that you're struggling
with. (Actually, earlier was the time, but now will do.)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999http://www.cpax.org.uk
email: rjh at the above domain, - www.

Thanks for the replies. The free disk space is at least 4 GB.
I am copying below the code. The interesting thing is that the same
code is running alright on a different machine, so this makes me think
that there seems to be problem with my machine. (Of course I have to
increase the stack size on the other machine also, and this is what I
normally do, and it works fine). As mentioned in my previous post, I
don't remember doing anything signifacant with the machine (only thing
I can remember is wiriting a songs CD using Nero). Here is the code
(I admit that the code is far from being an example of an efficient
code :), but serves my purpose well) :
Do a complete scan disk.

[Snip code]
Apr 19 '07 #17
"user923005" <dc*****@connx.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.com...
On Apr 17, 8:03 pm, vj <vijayjany...@gmail.comwrote:

Since Microsoft does not make C++ Builder, I suggest that you have
sent the problem report to the wrong place.
Not necessarily. I am nearly certain that Microsoft offers crash reports to
other vendors. My guess is that if Windows asks if a dump should be sent,
the vendor has made arrangemts to get the dumps for the third-party vendor's
products.
May 17 '07 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ross Presser | last post by:
OK, I've been researching this problem and can't find a definitive answer yet. The situation is one that seems to have come up a few times to different folks. I am writing an application that...
4
by: Bill Dika | last post by:
Hi I am trying to calculate a running total of a calculated textbox (tbAtStandard) in GroupFooter1 for placement in a textbox (tbTotalAtStandard) on my report in Groupfooter0. The problem...
1
by: Ennio-Sr | last post by:
Hi all! Testing a script where I need to make sure that postgresql is running before passing a <psql dbasename -c "insert into ..." > instruction I faced this curious behaviour: This is the...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
15
by: vj | last post by:
Hi All, I am using C++Builder V5.0 to run my C programs. I am not an expert in C. Normally, I run the C program with these steps: 'Compile', 'Make Project', 'Build Project' and then 'Run'. Many...
2
by: upperclass | last post by:
Hi, I'm trying to find a decent way to measure program running time. I know clock() is probably the standard way of doing it but clock_t overflows too quickly. The target program running time...
0
by: fabien.lyon | last post by:
hello, The C++ application uses a python module which wraps commands set for CVS management: checkout, checkin and tag. We used python2.5.1 and Visual C++ 6.0 The problem we get is: After a...
0
by: fabien.lyon | last post by:
-----Message d'origine----- De : fabien.lyon Envoyé : mercredi 30 mai 2007 20:16 À : 'python-list@python.org' Objet : RE: embeded python progam into visual C++ application crash 2.5.1 is...
1
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.