C/C++ :: Applying Heat Flux On A Surface

Apr 21, 2014

I am trying to write udf for heat flux on X-Y plane in Fluent having the formula

Q(Y) = (0.304)/(deltaY + deltaY/2)^-3
Where deltaY = 50cm and
Y = 10m

but I am unable to do it. Can write udf for heat flux? Y is the length on Y-axis and X whixh is equal to 5m is length on X-axis. Q is heat flux goes through X-Y plane in Z direction. Geometry is a cube with dimension 10*5*0.005 all are in meters.

View 1 Replies


ADVERTISEMENT

C++ :: Game Freezes When Applying Surface From One Object Onto Another?

May 28, 2013

Been trying to figure out why my program freezes. I know exactly what line of code is causing it, but I can't figure out WHY it's causing it. It compiles fine, there are no errors returned, and then the game just stalls and I have to ctrl+alt+del to kill it.

Anyway, what I have set up is something like this:

main.cpp
#include "SDL.h"
#include "SDL_gfxPrimitives.h"
#include "SDL_image.h"
#include "SDL_rotozoom.h"

[Code]....

This is the line of code that's freezing the program. Simply put, so that you don't really have to go through it piece by piece, what I have done is:

*each player gets their own drawing surface called PlayScreen
*each player gets an array of 360 drawing surfaces called ShipPic. These are to keep the game from having to render the rotation pics of the ship on the fly.
*Get_Ship clips the requested ship picture out of the ship sprite sheet and puts it in ShipPic[0] for the original angle.
*the original picture is rotated by 1 degree and put into the 360 ShipPic slots.
*when the player rotates their ship, the angle changes, and it calls the ShipPic with the same number as the player's angle and places it on the screen.

All of this works perfectly.

Then, in Player::draw_screen(), I have it set up so that each player looks at all the other players and gets their distance. If they're within range, it takes the other player's picture rotated by the other player's angle and puts it on the current player's PlayScreen. This is where it freezes.

I've checked for NULL pictures, I've checked to be sure the angle is between 0 and 359, nothing makes any difference. I know it's reading the other player's information since I can output all of the player's X & Y coordinates, angles, the width/height of their pictures, etc. on each other's screens. So they're definitely talking.

To test the code, I've changed it from

Apply_Surface(ShipX, ShipY, p[i].ShipPic[(int)p[i].angle], PlayScreen);
to
Apply_Surface(ShipX, ShipY, p[ID].ShipPic[(int)p[ID].angle], PlayScreen);

And it works perfectly, placing the player's OWN picture in for the other players. So the function works. It's just when I try to take another player's picture and place it on the current player's screen that it freezes.

I've tried quite a few different ideas, such as creating a temp drawing surface to blit the other player's picture onto, but again, it freezes as soon as I try using the other player's pictures.

View 5 Replies View Related

C/C++ :: Room Temperature / Humidity And Heat Index

Jan 20, 2015

What I have to write in "int main" to get 1.room list 2.every room temperature, humidity and heat index 3.and how to increase or decrease every parameter

#include <iostream>
#include <string>
using namespace std;
struct Klinikos //hospital {
string Patalpos; //room
float Temperatura; //temperature
float Dregme; //humidity
bool moreTemp;
float KarscioIndeksas; //heatindex

[Code] .....

View 7 Replies View Related

C/C++ :: Applying Texture To Sphere?

Apr 19, 2015

I am currently trying to apply a texture to a sphere I made, and have been following various tutorials. My program no longer crashes (used to be a problem but I figured it out), but the texture isn't being applied to the sphere. I used glut and SOIL to do this, but I am pretty sure that I am missing some necessary code from my own program for the textures to work. Because my program is a bit different from the tutorials though, I can't figure out what it is that I am missing. Below is what I have written to this point. It all compiles, and it successfully displays two objects (a sphere, and a pyramid), but neither object has textures, the pyramid simply has the colors it was set with (supposed to, I want to texture map the sphere first), while the sphere is a solid blue. What am I missing or what do I need to move?

#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>

[code]....

View 9 Replies View Related

C/C++ :: How Does Casting Work (under The Surface)

Mar 14, 2014

So, I've used int to float cast before. And it makes sense that it preserves the int value just converts it. I don't really need the answer, I'm just interested, and a resources could suffice.

1. Why in my test program it seems to preserve the int value, I expect that, but why for 0x8000 is it registering bit negation also. I know that is the negative bit for float, but it seems wrong. Is this an error in the gcc compiler conversion code?

2. What is the documentation on these type cast on how they actual work.

3. I know like no assembly, I'm wondering if some of the built in routines to handle or is it all c side code.

4. Can I convert type and preserve the bits. Maybe use void* casting ? I've never really bothered with void* so I don't all that I can do. Except be a pointer that doesn't know the type, obviously. I tested that out in the second code, the output doesn't seem correct, except -0.000. Is it working and my test numbers just are improper float format? It can't be that I test 0x3E20000 = 0.15625 from SingleWiki , but I got 1.328e-36 so the int to void* to float doesn't seem to work in the code below:

#include <cstdio>
int main(){
float flout;
unsigned int num = 1;
int ant;
printf("Int Shift float");
for(unsigned int shift=0;shift<32;shift++){

[Code] ....

View 5 Replies View Related

C++ :: Tic Tac Toe Game - Applying OOP And Arrays

Sep 25, 2012

Objective : Code a game allowing two human players to play tictactoe.

Create 2 classes:
-Create a 3 x 3, 2-D array board class to play the game.
-Player; has a private string name data member and a method that reads the players’ row and column selections from the keyboard.

Create 2 player objects from this class. Name the players Orestes and Xerxes.

Think carefully about board and player classes responsibilities and how they interaction with one another. The players do not collaborate with one another but they collaborate with the board.

My Problem : The program compiles with the header file, but it the displaying is wrong as you will see when you enter your row and column.

Sources
Header file:

Code:
#include <iostream>
#include <string>
using namespace std;
class Board {
public:
void display(char Z[][3], int row, int col);

[Code] ....

View 1 Replies View Related

C++ :: SDL User-made Surface Class?

Feb 13, 2014

I want to make an encapsulated surface class that keeps track of important aspects about a surface. I have it started, except when I test the .onDraw() function, nothing appears on the screen. My Code is below:

#include "NSurface.h"
NSurface::NSurface() {
surface = NULL;
}
NSurface::~NSurface() {
SDL_FreeSurface(surface);

[code]....

why nothing is blitting to the screen when I test that class.onDraw() and SDL_Flip(screen)?

View 1 Replies View Related

C/C++ :: Applying Limit To Recursive Depth?

Jul 9, 2014

I wrote this code, but now need to apply a limit to the recursive depth. This is the format that I have to use. How would I pass a limit so that it stops after a given number? I'm just confused about where to apply it.

int compute_edit_distance(char *string1, char *string2, int i, int j, int limit) {
if (strlen(string1) == i) return strlen(string2) - j;
if (strlen(string2) == j) return strlen(string1) - i;
if (string1[i] == string2[j]) return compute_edit_distance(string1, string2, i + 1, j + 1, limit);

[Code] .....

View 4 Replies View Related

C# :: Applying Dijkstra Algorithm To Graphs?

Jan 30, 2015

I'm attempting to build a tool for a Minecraft mod called Thaumcraft. In it, there are various aspects of magic that are used in a little research minigame; basically, you have to link Aspect A to Aspect B by the aspects either used to make them, or the aspects that use them in their creation. I figured the easiest way to find a path from A to B would be to relate them via graph object, the code for which I found here, minus the IEnumerable<T> dependency on the Graph<T> class itself, because that requires I build an IEnumerator<T> class and it seems difficult I can do without.

Must be between MinSteps and MaxSteps (say, between 3 and 5 steps).Must use either a source aspect (as in, the current aspect requires it to be built), or a destination aspect (as in, the current aspect is used in its creation).An aspect requires two other aspects of a lower tier to create it.The only exceptions to the above rule are the Primal aspects, which require no aspects to build them.

Here's my Aspect class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace Pathfinder

[code].....

View 2 Replies View Related

C++ :: Applying Bubble Sort On Linked List

Feb 27, 2015

I'm trying to apply a bubble sort on a linked list. It works in the first traversal, but then after the code cPtr = nPtr;, it inputs repeated digits at the end of the (semi-sorted) linked lists.

View 1 Replies View Related

C++ :: How To Calculate Total Surface Covered - Overlapping Squares

May 24, 2013

How would i calculate a surface that up to 10^5 squares cover. The info you get is xpos,ypos and width for each square.

How would you calculate the total surface covered (if any overlap only one counts).

Cannot use a big array of bools as the memory limit is 512 MiB.

View 2 Replies View Related

C :: How To Calculate Surface Area And Volume For Rectangular Prism

Jan 24, 2015

So for my assignment, I have to write code to calculate the surface area and volume for a rectangular prism that involves the use of functions. I made the program without functions and it works perfectly but as I'm putting in the required functions, it conversely made it non-functional, ironically. How to call functions correctly and the online book we're using now is confusing me even more.

Code:

#include <stdio.h>
#include <math.h>
int main(void) {
double x1, x2, x3, x4, x5, x6, x7, x8 = 0;
double y1, y2, y3, y4, y5, y6, y7, y8 = 0;
double z1, z2, z3, z4, z5, z6, z7, z8 = 0;
double length, width, height=0;

[Code]....

And here is the version I'm using to test it (without the need to input the individual coordinates).

Code:

#include <stdio.h>
#include <math.h>
int main(void) {
double x1, x2, x3, x4, x5, x6, x7, x8 = 0;
double y1, y2, y3, y4, y5, y6, y7, y8 = 0;
double z1, z2, z3, z4, z5, z6, z7, z8 = 0;
double volumePrism, surfaceArea =0;

[Code]...

View 3 Replies View Related

C++ :: Calculate Surface Area Of Various Shapes - Symbolic Constant For The Value Of PI

Mar 2, 2013

This error keeps coming.

******************************************************************
CSCI 240 Program 5 Part 2 Spring 2013

Programmer:
Section: 1
Date Due: 3/1/13

Purpose: This program uses functions to calculate the surface area of various shapes. It is an exercise in learning to write functions.
******************************************************************/

#include <iostream>
#include <iomanip>
using namespace std;
#define PI 3.14
//Symbolic constant for the value of PI

int Menu();
int getValue( string prompt, int lowerBound, int upperBound );

[Code] .....

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved