This C program code generates elastic response spectra including displacement, pseudo-acceleration, and pseudo-velocity spectra needed for structural response spectrum analysis. The code uses the Newmark linear method to solve the equation of motions for different periods. It inputs ground motion acceleration data, performs the analysis, and outputs the response spectra and graphs the results in an HTML file for visualization.
This document describes research on identifying extract method refactoring opportunities through program analysis and tool support. It discusses limitations of early work, such as not supporting extraction of objects or composite variables. It presents techniques to address these limitations, including handling behavior preservation issues and ensuring the complete computation of extracted variables. Evaluation results of tools are provided, showing improvements in precision and recall over time. The document also discusses how the work influenced the researcher's career and other researchers.
This document describes Xuan Zhang's term project for CSC413, which included two games: TankWar and KatchAndPop. It provides an overview of the game applications and components, including the collision detector class and how it interacts with other classes through the game events object. It also outlines some mistakes made during development that provided learning experiences, such as issues with collision detection and file paths. Areas for potential improvement are identified, such as making collision detection more accurate and adding more levels and weapons to enhance gameplay.
NLP on a Billion Documents: Scalable Machine Learning with Apache SparkMartin Goodson
This document provides an overview of Spark concepts and techniques for machine learning including naive Bayes classification, word2vec, k-means clustering, and semi-supervised learning. It discusses using RDD transformations like map, reduceByKey, and treeAggregate for counting word frequencies. It also covers configuring PySpark memory and using the EM algorithm to incorporate unlabeled data into naive Bayes classification.
Goal Based Data Production with Sim SimeonovDatabricks
Since the invention of SQL and relational databases, data production has been about specifying how data should be transformed through queries. While Apache Spark can certainly be used as a general distributed SQL-like query engine, the power and granularity of Spark’s APIs allows for a fundamentally different, and far more productive, approach. This session will introduce the principles of goal-based data production with examples ranging from ETL, to exploratory data analysis, to feature engineering for machine learning.
Goal-based data production concerns itself with specifying WHAT the desired result is, leaving the details of HOW the result is achieved to the smart data warehouse running on top of Spark. That not only substantially increases productivity, but also significantly expands the audience that can work directly with Spark: from developers and data scientists to technical business users. With specific data and architecture patterns and live demos, this session will demonstrate how easy it is for any company to create its own smart data warehouse with Spark 2.x and gain the benefits of goal-based data production.
The document describes a scenario to analyze access between a constellation of 40 low-Earth orbit satellites and a ground station located at MathWorks Natick. A satellite scenario is created in MATLAB and the constellation satellites are added along with their orbital parameters. Each satellite is equipped with a conical sensor camera with a 90-degree field of view. The ground station representing MathWorks Natick is also added with a minimum elevation angle of 30 degrees. Access analysis is performed between each camera and the ground station to determine the times each camera can photograph the site. The results show the start and end times of access intervals for each camera over the 6-hour period from 1:00 PM to 7:00 PM UTC on May 12,
Shai Halevi discusses new ways to protect cloud data and security. Presented at "New Techniques for Protecting Cloud Data and Security" organized by the New York Technology Council.
Cloud computing is an ever-growing field in today‘s era.With the accumulation of data and the
advancement of technology,a large amount of data is generated everyday.Storage, availability and security of
the data form major concerns in the field of cloud computing.This paper focuses on homomorphic encryption,
which is largely used for security of data in the cloud.Homomorphic encryption is defined as the technique of
encryption in which specific operations can be carried out on the encrypted data.The data is stored on a remote
server.The task here is operating on the encrypted data.There are two types of homomorphic encryption, Fully
homomorphic encryption and patially homomorphic encryption.Fully homomorphic encryption allow arbitrary
computation on the ciphertext in a ring, while the partially homomorphic encryption is the one in which
addition or multiplication operations can be carried out on the normal ciphertext.Homomorphic encryption
plays a vital role in cloud computing as the encrypted data of companies is stored in a public cloud, thus taking
advantage of the cloud provider‘s services.Various algorithms and methods of homomorphic encryption that
have been proposed are discussed in this paper
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."sjabs
The document discusses Hadoop and its applications. It provides examples of companies like Facebook and their use of Hadoop. It also discusses Hadoop components like HDFS, MapReduce, Pig and HBase. It provides examples of using Hadoop with databases like MongoDB and search engines like Solr. It notes that not every problem requires large-scale solutions and discusses potential use cases for Hadoop including log analysis, indexing documents and building recommendation systems.
This document describes research on identifying extract method refactoring opportunities through program analysis and tool support. It discusses limitations of early work, such as not supporting extraction of objects or composite variables. It presents techniques to address these limitations, including handling behavior preservation issues and ensuring the complete computation of extracted variables. Evaluation results of tools are provided, showing improvements in precision and recall over time. The document also discusses how the work influenced the researcher's career and other researchers.
This document describes Xuan Zhang's term project for CSC413, which included two games: TankWar and KatchAndPop. It provides an overview of the game applications and components, including the collision detector class and how it interacts with other classes through the game events object. It also outlines some mistakes made during development that provided learning experiences, such as issues with collision detection and file paths. Areas for potential improvement are identified, such as making collision detection more accurate and adding more levels and weapons to enhance gameplay.
NLP on a Billion Documents: Scalable Machine Learning with Apache SparkMartin Goodson
This document provides an overview of Spark concepts and techniques for machine learning including naive Bayes classification, word2vec, k-means clustering, and semi-supervised learning. It discusses using RDD transformations like map, reduceByKey, and treeAggregate for counting word frequencies. It also covers configuring PySpark memory and using the EM algorithm to incorporate unlabeled data into naive Bayes classification.
Goal Based Data Production with Sim SimeonovDatabricks
Since the invention of SQL and relational databases, data production has been about specifying how data should be transformed through queries. While Apache Spark can certainly be used as a general distributed SQL-like query engine, the power and granularity of Spark’s APIs allows for a fundamentally different, and far more productive, approach. This session will introduce the principles of goal-based data production with examples ranging from ETL, to exploratory data analysis, to feature engineering for machine learning.
Goal-based data production concerns itself with specifying WHAT the desired result is, leaving the details of HOW the result is achieved to the smart data warehouse running on top of Spark. That not only substantially increases productivity, but also significantly expands the audience that can work directly with Spark: from developers and data scientists to technical business users. With specific data and architecture patterns and live demos, this session will demonstrate how easy it is for any company to create its own smart data warehouse with Spark 2.x and gain the benefits of goal-based data production.
The document describes a scenario to analyze access between a constellation of 40 low-Earth orbit satellites and a ground station located at MathWorks Natick. A satellite scenario is created in MATLAB and the constellation satellites are added along with their orbital parameters. Each satellite is equipped with a conical sensor camera with a 90-degree field of view. The ground station representing MathWorks Natick is also added with a minimum elevation angle of 30 degrees. Access analysis is performed between each camera and the ground station to determine the times each camera can photograph the site. The results show the start and end times of access intervals for each camera over the 6-hour period from 1:00 PM to 7:00 PM UTC on May 12,
Shai Halevi discusses new ways to protect cloud data and security. Presented at "New Techniques for Protecting Cloud Data and Security" organized by the New York Technology Council.
Cloud computing is an ever-growing field in today‘s era.With the accumulation of data and the
advancement of technology,a large amount of data is generated everyday.Storage, availability and security of
the data form major concerns in the field of cloud computing.This paper focuses on homomorphic encryption,
which is largely used for security of data in the cloud.Homomorphic encryption is defined as the technique of
encryption in which specific operations can be carried out on the encrypted data.The data is stored on a remote
server.The task here is operating on the encrypted data.There are two types of homomorphic encryption, Fully
homomorphic encryption and patially homomorphic encryption.Fully homomorphic encryption allow arbitrary
computation on the ciphertext in a ring, while the partially homomorphic encryption is the one in which
addition or multiplication operations can be carried out on the normal ciphertext.Homomorphic encryption
plays a vital role in cloud computing as the encrypted data of companies is stored in a public cloud, thus taking
advantage of the cloud provider‘s services.Various algorithms and methods of homomorphic encryption that
have been proposed are discussed in this paper
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."sjabs
The document discusses Hadoop and its applications. It provides examples of companies like Facebook and their use of Hadoop. It also discusses Hadoop components like HDFS, MapReduce, Pig and HBase. It provides examples of using Hadoop with databases like MongoDB and search engines like Solr. It notes that not every problem requires large-scale solutions and discusses potential use cases for Hadoop including log analysis, indexing documents and building recommendation systems.
Mining Geo-referenced Data: Location-based Services and the Sharing Economytnoulas
This document summarizes an analysis of geo-referenced data from location-based services and the sharing economy. It loads and analyzes data on venues and check-ins from Foursquare in New York City to generate a place network, examines the network's degree distributions and clustering, and identifies central places and nodes. It also loads taxi trip and Airbnb listing data and plots journeys and locations on a map. Finally, it discusses accessing Uber's API to query pricing data and the potential for combining different data sources to predict surge areas.
The document summarizes new features and improvements in Cassandra 2.0, including enhanced performance, scalability, and ease of use. Key updates include improved cursors for paging through large result sets, batching of prepared statements, simplified parameterized queries, additional CQL3 functionality, and lightweight transactions. Future plans outlined are secondary indexes on collections, more efficient repairs, custom data types, and aggregate functions in CQL. The document provides examples and explanations of new capabilities such as tracing, tombstone handling, and rapid read protection.
The Ring programming language version 1.9 book - Part 78 of 210Mahmoud Samir Fayed
This document describes a simple notepad application developed using the RingQt GUI library. The application contains features like opening, saving, printing files as well as cut, copy, paste functionality. It allows changing font, text color and includes a find/replace feature. The main window contains toolbars for file operations and menus for file, edit, view and help. A text editor widget is used to display and edit text. Buttons are added to toolbars to trigger common operations like new, open, save etc.
Apache Flink Training: DataSet API BasicsFlink Forward
This document provides an overview of the Apache Flink DataSet API. It introduces key concepts such as batch processing, data types including tuples, transformations like map, filter, group, and reduce, joining datasets, data sources and sinks, and an example word count program in Java. The word count example demonstrates reading text data, tokenizing strings, grouping and counting words, and writing the results. The document contains slides with code snippets and explanations of Flink's DataSet API concepts and features.
"Используем MetricKit в бою" / Марина Звягина (Vivid Money)Egor Petrov
Этот доклад будет максимально прикладным. Насколько MetricKit
хорош? Какие данные действительно помогут оптимизировать работу приложения? Как подружить MetricKit с другими метриками?
В приложении Vivid используется MetricKit и мы уже решили эти вопросы и многие другие.
05 - Qt External Interaction and GraphicsAndreas Jakl
This module explores the remaining aspects of writing own widgets and explains how to handle low-level events, which can originate from for example the mouse or the keyboard. Low level painting, however, can not only be used to draw custom widget - a short overview gives you an idea of the power behind the QPainter class. If your application has to manage multiple graphics items or if you want to build a dynamic UI, the section about the graphics view framework will contain an overview of the classes required to build scene-graph-like user interfaces. At the end of this module, a few slides explain optimizing images, which is important to keep the file sizes and loading times down on mobile devices.
Time Series Analysis by JavaScript LL matsuri 2013 Daichi Morifuji
This document discusses time series analysis and visualization using JavaScript. It introduces Series.js, a utility library for time series data that provides methods for aggregation, statistics, and visualization. Sample time series CPU and memory usage data is provided, and it is summarized using Series.js methods to aggregate the data by minute. Future work includes improving performance, documentation, and client-side capabilities of Series.js.
GeoMesa on Apache Spark SQL with Anthony FoxDatabricks
This document discusses location intelligence and GeoMesa. It begins with an introduction to location intelligence and GeoMesa. It then covers spatial data types, spatial SQL, and optimizing spatial SQL queries by extending Spark's Catalyst optimizer. Examples are provided to demonstrate calculating density of activity in San Francisco and generating a speed profile of a metro area using location data. Spatial analysis techniques like spatial joins, buffers, and geohashing are explored to extract insights from spatial data at scale.
CodiLime Tech Talk - Katarzyna Ziomek-Zdanowicz: RxJS main concepts and real ...CodiLime
The document discusses RxJS, a library for reactive programming using observable streams. It introduces key RxJS concepts like Observables, operators, and the pipe method. It then provides a real-world example of an interactive drawing application using RxJS to manage streams of user input events, application state, and drawing output. Operators like switchMap are used to flatten streams and handle interactions. Flattening strategies of different operators are also explained. The summary concludes by emphasizing benefits of RxJS like managing complex async processes and broadening programming perspectives.
The document contains code snippets for several C++ programs that perform calculations related to arithmetic, finance, and currency conversion. The programs include:
1. A menu-driven program that allows the user to select an arithmetic operation like calculating the nth term, sum of n terms, arithmetic mean, etc. and performs the calculation.
2. A program that calculates the power of a number to a given exponent.
3. A quiz program that asks the user multiple choice questions and calculates their score.
4. Additional code snippets calculate compound interest, quotient and remainder, powers of a number, currency conversion rates and solar energy calculation.
Também conhecido como o “Time Lock Puzzle”, o LCS35 é um desafio em forma de criptografia projetado em 1999 pelo pesquisador Ron Rivest, do Instituto de Tecnologia de Massachusetts (MIT). Quando este problema matemático for resolvido, uma cápsula do tempo de chumbo será aberta no MIT.
O puzzle envolve a divisão de um número incrivelmente enorme, por um número que é apenas um pouco menor que o da conta (mas ainda com mais de 600 dígitos).
Ninguém sabe o que está dentro da capsula e, segundo os dados de Rivest, estima-se que levaria cerca de 35 anos para que o enigma seja resolvido. Os interessados ainda terão de esperar para descobrir o que de fato tem na capsula.
This document contains AutoLISP functions for analyzing and extracting data from 2D and 3D objects in AutoCAD. It includes functions to calculate distances between 2D points, extract coordinate data and write it to a file, analyze spline curves on polylines and write curve data like radii, angles and lengths to a file. The functions prompt the user for input like selecting objects or points and allow controlling snapping options.
This document provides an introduction and overview of NS-2, a discrete event network simulator. It discusses that NS-2 uses C++ for data and packet processing and OTcl for control and configuration. It also outlines some of NS-2's key capabilities like simulating wired and wireless networks, various protocols, and its use of events to drive simulation time forward. Examples of basic OTcl and Tcl commands are also provided.
This document contains a MATLAB script for creating pork chop plots of ballistic Earth-to-Mars trajectories. It includes functions for interpolating planetary ephemeris data from JPL files to calculate position and velocity vectors of planets. The script can then be used to determine optimal launch times from Earth to Mars by minimizing travel time and propellant requirements.
The Ring programming language version 1.5.4 book - Part 59 of 185Mahmoud Samir Fayed
This document describes the code for a 3D tic-tac-toe game written in Ring and Allegro. The code defines classes for the game logic, background, cubes, sounds, and interface. The main function initializes a TicTacToe3D object which loads resources and calls functions to draw the scene, handle mouse clicks, and check for a winner. The game interface class handles drawing the cubes on the game board and detecting mouse clicks on the cubes. The game logic class defines the game board data structure and functions for changing turns, detecting a winner, and refreshing the game.
The document discusses the history of object-oriented programming. It describes early computing projects like Project Whirlwind that used interactive computing. It then discusses Ivan Sutherland's 1963 PhD thesis called Sketchpad, which is considered a precursor to object-oriented programming. Sketchpad used the concept of objects and components to allow for interactive drawing with a light pen on a computer screen. The general functions developed in Sketchpad gave it the ability to operate on different types of entities, laying the foundations for object-oriented programming.
The document describes refactoring legacy code for a push notification daemon. It starts with a single long method that handles both pushing notifications to a queue and processing incoming requests over UDP. It goes through a series of refactoring steps like extracting methods, extracting classes, and replacing methods with objects to break the class into separate concerns and make it more extensible and maintainable. This includes creating separate Worker, UDPServer, and PushDaemon classes with clear responsibilities.
The document discusses texturing in OpenGL. It explains that textures are used to add visual detail to 3D graphics by mapping images onto surfaces. The key steps for using a texture are: 1) load the texture, 2) map it onto a polygon, 3) draw the polygon. Additional topics covered include texture coordinates, filtering modes, wrapping modes, blending textures for transparency effects, and using TGA images with an alpha channel for transparency. Code examples are provided for basic texture mapping and blending textures to achieve transparency.
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Salar Delavar Qashqai
This document describes a C program written by Salar Delavar Qashqai to analyze the geometric and material nonlinearity of a 2D truss structure under force and ductility damage index control. The program imports input data files, performs a pushover analysis using incremental loading, calculates member forces and displacements, and exports output to text, Excel, MATLAB, and HTML files. Key sections of code are presented to demonstrate how the program assembles and solves the system stiffness matrix, calculates element forces and stiffness, and checks for convergence at each iteration.
The document contains 10 programs written in C programming language to perform various 2D and 3D graphics operations like drawing lines, rectangles, circles, ellipses, torus, scaling, rotating, shearing and reflecting objects. Program 1-5 demonstrate drawing basic shapes like line, rectangle, circle and ellipse. Program 6 draws a 3D torus using OpenGL. Program 7-9 demonstrate transformations like scaling, rotating and shearing of objects. Program 10 shows reflection of an object about x-axis, y-axis and origin.
Mining Geo-referenced Data: Location-based Services and the Sharing Economytnoulas
This document summarizes an analysis of geo-referenced data from location-based services and the sharing economy. It loads and analyzes data on venues and check-ins from Foursquare in New York City to generate a place network, examines the network's degree distributions and clustering, and identifies central places and nodes. It also loads taxi trip and Airbnb listing data and plots journeys and locations on a map. Finally, it discusses accessing Uber's API to query pricing data and the potential for combining different data sources to predict surge areas.
The document summarizes new features and improvements in Cassandra 2.0, including enhanced performance, scalability, and ease of use. Key updates include improved cursors for paging through large result sets, batching of prepared statements, simplified parameterized queries, additional CQL3 functionality, and lightweight transactions. Future plans outlined are secondary indexes on collections, more efficient repairs, custom data types, and aggregate functions in CQL. The document provides examples and explanations of new capabilities such as tracing, tombstone handling, and rapid read protection.
The Ring programming language version 1.9 book - Part 78 of 210Mahmoud Samir Fayed
This document describes a simple notepad application developed using the RingQt GUI library. The application contains features like opening, saving, printing files as well as cut, copy, paste functionality. It allows changing font, text color and includes a find/replace feature. The main window contains toolbars for file operations and menus for file, edit, view and help. A text editor widget is used to display and edit text. Buttons are added to toolbars to trigger common operations like new, open, save etc.
Apache Flink Training: DataSet API BasicsFlink Forward
This document provides an overview of the Apache Flink DataSet API. It introduces key concepts such as batch processing, data types including tuples, transformations like map, filter, group, and reduce, joining datasets, data sources and sinks, and an example word count program in Java. The word count example demonstrates reading text data, tokenizing strings, grouping and counting words, and writing the results. The document contains slides with code snippets and explanations of Flink's DataSet API concepts and features.
"Используем MetricKit в бою" / Марина Звягина (Vivid Money)Egor Petrov
Этот доклад будет максимально прикладным. Насколько MetricKit
хорош? Какие данные действительно помогут оптимизировать работу приложения? Как подружить MetricKit с другими метриками?
В приложении Vivid используется MetricKit и мы уже решили эти вопросы и многие другие.
05 - Qt External Interaction and GraphicsAndreas Jakl
This module explores the remaining aspects of writing own widgets and explains how to handle low-level events, which can originate from for example the mouse or the keyboard. Low level painting, however, can not only be used to draw custom widget - a short overview gives you an idea of the power behind the QPainter class. If your application has to manage multiple graphics items or if you want to build a dynamic UI, the section about the graphics view framework will contain an overview of the classes required to build scene-graph-like user interfaces. At the end of this module, a few slides explain optimizing images, which is important to keep the file sizes and loading times down on mobile devices.
Time Series Analysis by JavaScript LL matsuri 2013 Daichi Morifuji
This document discusses time series analysis and visualization using JavaScript. It introduces Series.js, a utility library for time series data that provides methods for aggregation, statistics, and visualization. Sample time series CPU and memory usage data is provided, and it is summarized using Series.js methods to aggregate the data by minute. Future work includes improving performance, documentation, and client-side capabilities of Series.js.
GeoMesa on Apache Spark SQL with Anthony FoxDatabricks
This document discusses location intelligence and GeoMesa. It begins with an introduction to location intelligence and GeoMesa. It then covers spatial data types, spatial SQL, and optimizing spatial SQL queries by extending Spark's Catalyst optimizer. Examples are provided to demonstrate calculating density of activity in San Francisco and generating a speed profile of a metro area using location data. Spatial analysis techniques like spatial joins, buffers, and geohashing are explored to extract insights from spatial data at scale.
CodiLime Tech Talk - Katarzyna Ziomek-Zdanowicz: RxJS main concepts and real ...CodiLime
The document discusses RxJS, a library for reactive programming using observable streams. It introduces key RxJS concepts like Observables, operators, and the pipe method. It then provides a real-world example of an interactive drawing application using RxJS to manage streams of user input events, application state, and drawing output. Operators like switchMap are used to flatten streams and handle interactions. Flattening strategies of different operators are also explained. The summary concludes by emphasizing benefits of RxJS like managing complex async processes and broadening programming perspectives.
The document contains code snippets for several C++ programs that perform calculations related to arithmetic, finance, and currency conversion. The programs include:
1. A menu-driven program that allows the user to select an arithmetic operation like calculating the nth term, sum of n terms, arithmetic mean, etc. and performs the calculation.
2. A program that calculates the power of a number to a given exponent.
3. A quiz program that asks the user multiple choice questions and calculates their score.
4. Additional code snippets calculate compound interest, quotient and remainder, powers of a number, currency conversion rates and solar energy calculation.
Também conhecido como o “Time Lock Puzzle”, o LCS35 é um desafio em forma de criptografia projetado em 1999 pelo pesquisador Ron Rivest, do Instituto de Tecnologia de Massachusetts (MIT). Quando este problema matemático for resolvido, uma cápsula do tempo de chumbo será aberta no MIT.
O puzzle envolve a divisão de um número incrivelmente enorme, por um número que é apenas um pouco menor que o da conta (mas ainda com mais de 600 dígitos).
Ninguém sabe o que está dentro da capsula e, segundo os dados de Rivest, estima-se que levaria cerca de 35 anos para que o enigma seja resolvido. Os interessados ainda terão de esperar para descobrir o que de fato tem na capsula.
This document contains AutoLISP functions for analyzing and extracting data from 2D and 3D objects in AutoCAD. It includes functions to calculate distances between 2D points, extract coordinate data and write it to a file, analyze spline curves on polylines and write curve data like radii, angles and lengths to a file. The functions prompt the user for input like selecting objects or points and allow controlling snapping options.
This document provides an introduction and overview of NS-2, a discrete event network simulator. It discusses that NS-2 uses C++ for data and packet processing and OTcl for control and configuration. It also outlines some of NS-2's key capabilities like simulating wired and wireless networks, various protocols, and its use of events to drive simulation time forward. Examples of basic OTcl and Tcl commands are also provided.
This document contains a MATLAB script for creating pork chop plots of ballistic Earth-to-Mars trajectories. It includes functions for interpolating planetary ephemeris data from JPL files to calculate position and velocity vectors of planets. The script can then be used to determine optimal launch times from Earth to Mars by minimizing travel time and propellant requirements.
The Ring programming language version 1.5.4 book - Part 59 of 185Mahmoud Samir Fayed
This document describes the code for a 3D tic-tac-toe game written in Ring and Allegro. The code defines classes for the game logic, background, cubes, sounds, and interface. The main function initializes a TicTacToe3D object which loads resources and calls functions to draw the scene, handle mouse clicks, and check for a winner. The game interface class handles drawing the cubes on the game board and detecting mouse clicks on the cubes. The game logic class defines the game board data structure and functions for changing turns, detecting a winner, and refreshing the game.
The document discusses the history of object-oriented programming. It describes early computing projects like Project Whirlwind that used interactive computing. It then discusses Ivan Sutherland's 1963 PhD thesis called Sketchpad, which is considered a precursor to object-oriented programming. Sketchpad used the concept of objects and components to allow for interactive drawing with a light pen on a computer screen. The general functions developed in Sketchpad gave it the ability to operate on different types of entities, laying the foundations for object-oriented programming.
The document describes refactoring legacy code for a push notification daemon. It starts with a single long method that handles both pushing notifications to a queue and processing incoming requests over UDP. It goes through a series of refactoring steps like extracting methods, extracting classes, and replacing methods with objects to break the class into separate concerns and make it more extensible and maintainable. This includes creating separate Worker, UDPServer, and PushDaemon classes with clear responsibilities.
The document discusses texturing in OpenGL. It explains that textures are used to add visual detail to 3D graphics by mapping images onto surfaces. The key steps for using a texture are: 1) load the texture, 2) map it onto a polygon, 3) draw the polygon. Additional topics covered include texture coordinates, filtering modes, wrapping modes, blending textures for transparency effects, and using TGA images with an alpha channel for transparency. Code examples are provided for basic texture mapping and blending textures to achieve transparency.
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Salar Delavar Qashqai
This document describes a C program written by Salar Delavar Qashqai to analyze the geometric and material nonlinearity of a 2D truss structure under force and ductility damage index control. The program imports input data files, performs a pushover analysis using incremental loading, calculates member forces and displacements, and exports output to text, Excel, MATLAB, and HTML files. Key sections of code are presented to demonstrate how the program assembles and solves the system stiffness matrix, calculates element forces and stiffness, and checks for convergence at each iteration.
The document contains 10 programs written in C programming language to perform various 2D and 3D graphics operations like drawing lines, rectangles, circles, ellipses, torus, scaling, rotating, shearing and reflecting objects. Program 1-5 demonstrate drawing basic shapes like line, rectangle, circle and ellipse. Program 6 draws a 3D torus using OpenGL. Program 7-9 demonstrate transformations like scaling, rotating and shearing of objects. Program 10 shows reflection of an object about x-axis, y-axis and origin.
Final Project SkeletonCipherClient.javaFinal Project SkeletonC.docxvoversbyobersby
Final Project Skeleton/CipherClient.javaFinal Project Skeleton/CipherClient.javaimport java.io.*;
import java.net.*;
import java.security.*;
import javax.crypto.*;
publicclassCipherClient
{
publicstaticvoid main(String[] args)throwsException
{
String message ="The quick brown fox jumps over the lazy dog.";
String host ="paradox.sis.pitt.edu";
int port =7999;
Socket s =newSocket(host, port);
// YOU NEED TO DO THESE STEPS:
// -Generate a DES key.
// -Store it in a file.
// -Use the key to encrypt the message above and send it over socket s to the server.
}
}
Final Project Skeleton/CipherServer.javaFinal Project Skeleton/CipherServer.javaimport java.io.*;
import java.net.*;
import java.security.*;
import javax.crypto.*;
publicclassCipherServer
{
publicstaticvoid main(String[] args)throwsException
{
int port =7999;
ServerSocket server =newServerSocket(port);
Socket s = server.accept();
// YOU NEED TO DO THESE STEPS:
// -Read the key from the file generated by the client.
// -Use the key to decrypt the incoming message from socket s.
// -Print out the decrypt String to see if it matches the orignal message.
}
}
Final Project Skeleton/ElGamalAlice.javaFinal Project Skeleton/ElGamalAlice.javaimport java.io.*;
import java.net.*;
import java.security.*;
import java.math.BigInteger;
publicclassElGamalAlice
{
privatestaticBigInteger computeY(BigInteger p,BigInteger g,BigInteger d)
{
// IMPLEMENT THIS FUNCTION;
}
privatestaticBigInteger computeK(BigInteger p)
{
// IMPLEMENT THIS FUNCTION;
}
privatestaticBigInteger computeA(BigInteger p,BigInteger g,BigInteger k)
{
// IMPLEMENT THIS FUNCTION;
}
privatestaticBigInteger computeB(String message,BigInteger d,BigInteger a,BigInteger k,BigInteger p)
{
// IMPLEMENT THIS FUNCTION;
}
publicstaticvoid main(String[] args)throwsException
{
String message ="The quick brown fox jumps over the lazy dog.";
String host ="paradox.sis.pitt.edu";
int port =7999;
Socket s =newSocket(host, port);
ObjectOutputStream os =newObjectOutputStream(s.getOutputStream());
// You should consult BigInteger class in Java API documentation to find out what it is.
BigInteger y, g, p;// public key
BigInteger d;// private key
int mStrength =1024;// key bit length
SecureRandom mSecureRandom =newSecureRandom();// a cryptographically strong pseudo-random number
// Create a BigInterger with mStrength bit length that is highly likely to be prime.
// (The '16' determines the probability that p is prime. Refer to BigInteger documentation.)
p =newBigInteger(mStrength,16, mSecureRandom);
// Create a randomly generated BigInteger of length mStrength-1
g =newBigInteger(mStrength-1, mSecureRandom);
d =newBigInteger(mStrength-1, mSecureRandom);
y = computeY(p, g, d);
// At this point, you have both the public key and the private key. Now compute the signature.
BigInteger k = computeK(p);
BigInteger a = computeA(p, g, k);
BigInteger b = computeB(message, d, a, k, p);
// send public key
...
The document discusses how scripting languages like Python, R, and MATLAB can be used to script CUDA and leverage GPUs for parallel processing. It provides examples of libraries like pyCUDA, rGPU, and MATLAB's gpuArray that allow these scripting languages to interface with CUDA and run code on GPUs. The document also compares different parallelization approaches like SMP, MPI, and GPGPU and levels of parallelism from nodes to vectors that can be exploited.
The document describes arrays and array operations like sorting and computing statistics. It defines arrays as structures that hold related data items of the same type. Arrays can be passed to functions by reference so the function can modify the original array. The document provides examples of using arrays to compute the mean, median, and mode of survey response data by sorting the array and counting frequencies. Functions are defined to calculate each statistic and sort the array using bubble sort.
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
This C program performs a geometric nonlinearity analysis of springs with rigid elements under displacement-controlled large deformations. It imports input data, analyzes the system over multiple increments of applied displacement, and outputs the results to Excel and HTML files. The analysis calculates forces, displacements, base shear, and critical buckling load at each increment. When the ultimate displacement is reached, the program terminates and displays completion messages.
The document provides source code for generating and manipulating computer graphics using various algorithms. It includes algorithms for drawing lines, circles and curves, as well as algorithms for translating, rotating, and scaling two-dimensional and three-dimensional objects. The source code is written in C/C++ and uses graphics libraries to output the results. Various input parameters are taken from the user and output is displayed to demonstrate the algorithms.
The document contains C code to perform matrix addition and multiplication using functions. It includes functions to read and write matrices, take user input for matrix dimensions and elements, perform the operations, and output the results. The code provides a menu for the user to select addition or multiplication and handles different cases for valid and invalid inputs.
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Salar Delavar Qashqai
This C program performs a geometric nonlinearity analysis of springs with rigid elements under displacement-controlled large deformations. It imports input data, performs an incremental analysis to calculate critical buckling loads, and exports output to Excel and HTML files. The analysis calculates forces, displacements, and critical pressures at each increment until the ultimate displacement is reached. Output graphs the displacement versus critical pressure relationship.
This document discusses using the C to Go translation tool c2go to translate C code implementing quicksort algorithms into Go code. It provides examples of translating simple quicksort C code, improving the translation by using a configuration file, and how c2go handles standard C functions like qsort by translating them to their Go equivalents. The examples demonstrate how c2go can generate valid Go code from C code but may require some manual fixes or configuration to handle certain data structures or language differences.
This document discusses MapReduce algorithms for sorting, building inverted indexes, and calculating standard deviation from weather datasets. It describes using MapReduce to extract date, temperature, and quality from weather data, then calculate the mean and standard deviation of temperature for each date. The standard deviation algorithm is refined to include a combiner for better load balancing by aggregating counts, sums, and sum of squares across mapper nodes.
Data structures notes for college students btech.pptxKarthikVijay59
The document provides information about data structures and algorithms. It defines key concepts such as data structures, algorithms, time complexity, space complexity, asymptotic notation (Big O, Big Omega, Big Theta). It discusses various data structures like stacks, queues, trees, graphs and sorting/searching techniques. It also lists the objectives of learning data structures as understanding linear and non-linear data structures and their applications, sorting/searching techniques, and memory management.
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
Video games are written as a main loop: process player input, update the state of the game, render a new frame to the screen, repeat. They do this 60 times a second, with millisecond timing. Most monitoring tools are also written as loops: send a probe, wait for the response, update a data store, sleep. Often this is done pretty slowly, maybe once a second! In video games if you can’t update fast enough, you skip the rendering step and the frame rate drops. With monitoring tools if your loop takes to long you also stop logging data as often, and instead of choppy gameplay you get gaps in your graphs, often when you need that data the most!
Let’s use ping as an example and see how we can rewrite its main loop to function more like a video game, keeping a high frame rate.
This document contains code for a clock project. The code takes user input for the hour and minutes and uses trigonometry to calculate the angle of the hour and minute hands based on the input time. It draws the clock face with numbers, and draws the hour and minute hands on the clock using the calculated angles to display the correct time. The code has some comments noting it is for a clock project and intended to display time properly from user input, but that the hands were not working correctly.
This document contains sample MATLAB code for designing and analyzing radar systems. It includes examples for waveform design, target detection, beamforming, and space-time adaptive processing. The code samples show how to perform tasks like plotting the array response, displaying range Doppler maps and estimated target ranges, visualizing antenna and target trajectories in both global and local coordinate systems, and streaming radar return signals.
Similar to Elastic response pseudo spectrum in c programming (20)
Pushover 2order (p delta effect) analysis force analogy method with force con...Salar Delavar Qashqai
This document describes a C program for pushover (P-Delta effect) analysis of structures using the force analogy method based on Timoshenko beam theory. The program analyzes plastic hinges using moment-rotation and shear-shear deformation relationships. It takes inputs from multiple CSV files, runs the analysis, and outputs results to CSV and HTML files including a base shear-displacement graph. The program was written by Salar Delavar Qashqai and published on March 23, 2021.
Pushover analysis of frame by force analogy method with force control based o...Salar Delavar Qashqai
This document describes a C program for performing pushover analysis of frames using the force analogy method based on Euler-Bernoulli beam theory. The program models plastic hinges using moment-rotation curves and outputs results in CSV and HTML files, including a base shear-displacement graph. It was written by Salar Delavar Qashqai and published on March 13, 2021.
Geometric nonlinearity analysis of springs with rigid element displacement co...Salar Delavar Qashqai
This document contains the code for analyzing the geometric and material nonlinearity of springs under displacement-controlled loading. The code imports input data on spring properties and stress-strain behavior, performs an incremental analysis to calculate the base shear and displacement at each step, and exports the results to Excel and MATLAB files. Negative or invalid input values trigger error messages. The analysis calculates the strain, stiffness, and force in each spring at each increment until the ultimate displacement is reached.
Nonlinear analysis of braced frame with hinge by hinge method in c programmingSalar Delavar Qashqai
This document is a C program code for nonlinear analysis of braced frames with hinge elements using the hinge method. The program imports input data, calculates the global stiffness matrix and its inverse, determines member forces and displacements through matrix operations, and outputs results to Excel files. Key steps include importing geometry, material properties, and loading, calculating element and system stiffness matrices, inverting the system matrix, determining member forces and displacements, and reporting results.
This document contains information about optimizing a Pratt truss structure using Excel Solver, including:
- The program was written by Salar Delavar Ghashghaei on February 12, 2017.
- It provides member cross-sectional areas, displacement results from the optimization, and equilibrium equations for the joints of the truss structure.
- The objective is to minimize the total weight of the truss subject to stress constraints on each member.
Pushover analysis of triangular steel membrane element subjected to lateral d...Salar Delavar Qashqai
This MATLAB program models the pushover analysis of a triangular steel membrane subjected to lateral displacements. It uses finite element analysis to calculate the stiffness matrix and account for geometric and material nonlinearity under small strains. The program defines the geometry and material properties of the membrane, applies incremental lateral displacements, calculates the element stiffness matrices, and assembles the global stiffness matrix to solve for displacements at each step. The results of the MATLAB analysis are verified against a similar ABAQUS model.
Pushover analysis of simply support steel section beam based on plastic hinge...Salar Delavar Qashqai
This document describes a MATLAB program for performing pushover analysis of a simply supported steel beam based on plastic hinge concepts. The program defines parameters for the beam geometry and material properties. It calculates the section properties and element stiffness coefficients. Plastic hinge properties are also defined. The MATLAB program then performs the pushover analysis and reports on the number of iterations required for convergence at each increment. The results of the MATLAB analysis are then verified using SAP2000 software, which also reports completing the analysis in a small number of iterations.
Pushover analysis of steel section beam subjected to incremental vertical loa...Salar Delavar Qashqai
This document describes a MATLAB program that performs pushover analysis of a steel beam subjected to incremental vertical loads. The program models the beam as a fixed support beam, defines parameters such as beam geometry and material properties, and analyzes the beam up to failure by incrementally increasing the load and checking for plastic hinge formation. The results from MATLAB are verified against a model of the same beam analyzed in SAP2000.
Moment curvature analysis of unconfined concrete section with matlab and sap2000Salar Delavar Qashqai
This document presents a moment-curvature analysis of an unconfined concrete section using MATLAB and SAP2000. It describes the section properties, material properties of the steel reinforcement and concrete, and runs a moment-curvature analysis in SAP2000. The analysis results are presented over 17 increments showing the top strain, neutral axis depth, curvature, flexural rigidity, and moment. Graphs of the analysis curve and moment-curvature relationship are also given.
Large deformation analysis of cantilever beam subjected to concentrated const...Salar Delavar Qashqai
This document describes the large deformation analysis of a cantilever beam subjected to a concentrated vertical load using ABAQUS and MATLAB. The beam's properties, including its length, flexural rigidity, and applied load, are defined. The deformation of the beam is then analyzed using pseudo-linear, linear, and ABAQUS models, with the deflection, slope, shear, and moment results reported along the beam's length.
Moment curvature analysis unconfined concrete section with different tension...Salar Delavar Qashqai
This MATLAB program analyzes the moment-curvature behavior of unconfined concrete sections with varying amounts of tension steel reinforcement. It performs an incremental analysis to determine the moment-curvature response up to the ultimate concrete strain limit of 0.004. Results are presented for sections with tension reinforcement ratios (ρ) of 0, 0.2, 0.4, etc. The analysis converges successfully for each reinforcement ratio and reports the moment and curvature at each increment.
Optimization of steel section based on moment and section ductilitySalar Delavar Qashqai
This document describes a program for optimizing steel section designs based on moment and ductility. The program allows the user to find optimal layer lengths based on these criteria. It requires initial input conditions like maximum iterations, strain-stress relationships, and minimum/maximum layer lengths to function. The output then displays the results of the optimization analyses.
Nonlinear analysis of 2 d cantilever nonprismatic beam with plastic hinge con...Salar Delavar Qashqai
This C program performs a nonlinear analysis of a 2D cantilever beam with plastic hinges using force control. The program was written by Salar Delavar Ghashghaei and verified using ABAQUS. It includes functions for importing input data, calculating element stiffness matrices, inverting matrices, performing iterations to solve for displacements, and outputting results to Excel, MATLAB, and HTML files. The input data is checked for errors before running the analysis, which is reported with incremental loads, displacements, and rotations at each step. Plastic hinge data of moment vs. rotation is also reported.
Import data from csv excel file and export to xml excel file in c programmingSalar Delavar Qashqai
This C program imports data from a CSV file, analyzes it, and exports it to an XML Excel file. It reads double data values from the CSV file into arrays, checks for any negative or invalid values, and displays the data in a formatted table. It then writes the data and additional XML tags to a new XML file to generate an Excel spreadsheet with the formatted data table. The program opens the XML file upon completion for viewing.
This document discusses verifying C programs for structural eigen value analysis using the SEISMOSTRUCT v.7.0 structural analysis program. It was written by Salar Delavar Ghashghaei on October 28, 2018 and includes plots of the C code file, analysis file, input CSV file, and input for section properties, coordinate properties, restraint properties, and output restraint properties in SEISMOSTRUCT.
Pushover analysis force analogy method with force control based on timoshenko...Salar Delavar Qashqai
This C program performs a pushover analysis using the force analogy method based on Timoshenko beam theory. It includes functions for importing input data, defining system matrices, calculating element internal forces, and outputting results to Excel and HTML files. The program checks that all input data is valid before running the analysis, which consists of incrementally applying an external force and calculating displacements and member forces over the structure.
Analysis of 1st order and 2nd order nonlinear semi rigid connection braced fr...Salar Delavar Qashqai
This document describes a MATLAB program that analyzes the first-order and second-order nonlinear behavior of a braced frame subjected to lateral pushover loading. The program models the nonlinear rotational springs of the columns and axial displacement spring of the brace. It reports the results of the first-order and second-order nonlinear analyses, including displacement and base shear values, ductility and overstrength ratios, and initial and tangent structural stiffness values.
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...Salar Delavar Qashqai
This document describes a nonlinear analysis of a semi-rigid frame subjected to lateral displacement in MATLAB. Parameters for the frame geometry, material properties, and nonlinear rotational springs are defined. The analysis is conducted using both first-order and second-order theory, tracking displacement, base shear, and internal moments over increments. Results are provided for ductility ratio, overstrength ratio, initial stiffness, and tangent stiffness.
This MATLAB program performs moment-curvature analysis on confined concrete sections. It analyzes a sample reinforced concrete section with specified material properties and reinforcement details. The program outputs 54 increments of the analysis, reporting the strain, curvature, moment, and number of iterations to converge at each increment. The goal is to verify the MATLAB program against a commercial moment-curvature analysis software called XTRACT.
Moment curvature analysis of unconfined circular concrete pipe section with m...Salar Delavar Qashqai
This document presents a moment-curvature analysis of an unconfined circular concrete pipe section using MATLAB and SAP2000. The analysis calculates the moment-curvature relationship in increments and determines key values like elastic rigidity, plastic rigidity, and ductility ratio. Graphs of results are presented comparing concrete strain, rebar stress, rigidity, neutral axis, and moment-curvature between the two programs.
A review on techniques and modelling methodologies used for checking electrom...nooriasukmaningtyas
The proper function of the integrated circuit (IC) in an inhibiting electromagnetic environment has always been a serious concern throughout the decades of revolution in the world of electronics, from disjunct devices to today’s integrated circuit technology, where billions of transistors are combined on a single chip. The automotive industry and smart vehicles in particular, are confronting design issues such as being prone to electromagnetic interference (EMI). Electronic control devices calculate incorrect outputs because of EMI and sensors give misleading values which can prove fatal in case of automotives. In this paper, the authors have non exhaustively tried to review research work concerned with the investigation of EMI in ICs and prediction of this EMI using various modelling methodologies and measurement setups.
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...University of Maribor
Slides from talk presenting:
Aleš Zamuda: Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapter and Networking.
Presentation at IcETRAN 2024 session:
"Inter-Society Networking Panel GRSS/MTT-S/CIS
Panel Session: Promoting Connection and Cooperation"
IEEE Slovenia GRSS
IEEE Serbia and Montenegro MTT-S
IEEE Slovenia CIS
11TH INTERNATIONAL CONFERENCE ON ELECTRICAL, ELECTRONIC AND COMPUTING ENGINEERING
3-6 June 2024, Niš, Serbia
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
Advanced control scheme of doubly fed induction generator for wind turbine us...
Elastic response pseudo spectrum in c programming
1. >> IN THE NAME OF GOD <<
Elastic Pseudo Response Spectrum in C programming
C program is written by Salar Delavar Ghashghaei – Publication Date: 21/March/2019
E-mail: salar.d.ghashghaei@gmail.com
2. C code :/* Elastic Response Spectra
This is a function to generate elastic response specra including Displacement
Spectrum, Pseudo Acceleration Spectrum and Pseudo Velocity Spectrum which
are needed in "Response Spectrum Analysis" of Structures. In this function
to solve "Equation of Motions" for different periods, Newmark Linear Method
has been used.
SPEC Function Help:
INPUTS:
dt: Time Interval (Sampling Time) of Record
Ag: Ground Motion Acceleration in g
zet: Damping Ratio in percent (%); e.g. 5
g: Gravitational Constant; e.g. 9.81 m/s/s
endp: End Period of Spectra; e.g. 4 sec
OUTPUTS:
T: Period of Structures (sec)
Spa: Elastic Pseudo Acceleration Spectrum
Spv: Elastic Pseudo Velocity Spectrum
Sd: Elastic Displacement Spectrum
*/
#include <graphics.h>
#include <windows.h> // text color
#define N 10000 // number of increment
#define NN 1 // number of degree of freedom
#define Ne 1 // number of element
#define PI 3.1415926535898
#define ShowText01 "ElasticResponseSpectrum-input.csv"
#define ShowText02 "ElasticResponseSpectrum-inputACCELERATION.csv"
#define ShowText03 "ElasticResponseSpectrum-outputEXCEL.csv"
#define ShowText04 "ElasticResponseSpectrum-outputHTML.html"
#define ShowText05 "Graph-outputHTML.html"
void MessageErrorReportTEXT();
void MessageAnalysisReportTEXT();
void MessageCheckInput(int M);
void MessageInitialData(double GRAVITY,double zet,double endp);
void MessageCheck_IMPORT_DATA01(double GRAVITY,double zet,double endp);
void ANALYSIS(double t[],double Ag[],double T[],double Sd[],double Spa[],double GRAVITY,double zet,double endp,int &kn,int &STEP);
void IMPORT_GRAPH(double data[8],double DATA1[],double DATA2[],double NORMAL_DATA1[],double NORMAL_DATA2[],int n);
void GRAPHICS(double data[8],double NORMAL_DATA1[],double NORMAL_DATA2[],int n,int kind);
double ABS(double);
double MAX(double A[],int n);
double MIN(double A[],int n);
double MAX_ABS(double A[],int n);
void OUTPUT_EXCEL(double time[],double Sd[],double Spa[],int n);
void OUTPUT_html(double GRAVITY,double zet,double endp,double time[],double Sd[],double Spa[],int n);
void IMPORT_DATA01(double &GRAVITY,double &zet,double &endp);
void IMPORT_DATA02(double t[],double Ag[],double GRAVITY,int &kn);
void textcolor(int ForgC);
double MAX_ABS(double A[],int n);
void OUTPUT_HTML_GRAPH(double X[],double Y[],int n,const char text1[],const char text2[],const char text3[]);
int main(){
int i,kn,STEP;
double GRAVITY,zet,endp;
double *t = new double [N];
double *Ag = new double [N];
double *time = new double [N];
double *Sd = new double [N];
double *Spa = new double [N];
double *NORMAL_DATA1 = new double [N];
double *NORMAL_DATA2 = new double [N];
double data[8];
IMPORT_DATA01(GRAVITY,zet,endp);
IMPORT_DATA02(t,Ag,GRAVITY,kn);
MessageCheck_IMPORT_DATA01(GRAVITY,zet,endp);
textcolor(11);
MessageInitialData(GRAVITY,zet,endp);
ANALYSIS(t,Ag,time,Sd,Spa,GRAVITY,zet,endp,kn,STEP);
MessageCheckInput(kn);
OUTPUT_EXCEL(time,Sd,Spa,STEP);
OUTPUT_html(GRAVITY,zet,endp,time,Sd,Spa,STEP);
IMPORT_GRAPH(data,time,Sd,NORMAL_DATA1,NORMAL_DATA2,STEP);
GRAPHICS(data,NORMAL_DATA1,NORMAL_DATA2,STEP,0);
IMPORT_GRAPH(data,time,Spa,NORMAL_DATA1,NORMAL_DATA2,STEP);
GRAPHICS(data,NORMAL_DATA1,NORMAL_DATA2,STEP,1);
char text1[40]="Elastic Pseudo Acceleration Spectrum",text2[20]="Peroid (sec)",text3[20]="Spa (g)";
OUTPUT_HTML_GRAPH(time,Spa,STEP,text1,text2,text3);
textcolor(15);
printf("na - Output data is written in Text, Excel and Html file -");
system("start /w Graph-outputHTML.html");
free(t);free(Ag);free(time);free(Sd);free(Spa);
free(NORMAL_DATA1);free(NORMAL_DATA2);
getch();
return 0;
}
void ANALYSIS(double t[],double Ag[],double T[],double Sd[],double Spa[],double GRAVITY,double zet,double endp,int &kn,int &STEP){
double dt,m,k,c,K,a,b,df,dv,du,dac;
double *u = new double [N];
double *v = new double [N];
double *ac = new double [N];
double *omega = new double [N];
double *Sv = new double [N];
double *Sa = new double [N];
double *Spv = new double [N];
int i,j;
dt = t[2] - t[1];
STEP = endp/dt;
//Ag[end+1]=0;
T[0]=0.00;
for (j=0;j<= STEP;j++){// equation of motion(Newmark linear method)
omega[j]=2*PI/T[j]; // Natural Frequency
m=1;
k=omega[j]*omega[j]*m;
c=2*m*omega[j]*zet/100;
K=k+3*c/dt+6*m/(dt*dt);
a=6*m/dt+3*c;
b=3*m+dt*c/2;
for (i=0;i<= kn-1;i++){
u[0]=0; //initial conditions
v[0]=0;
ac[0]=0;
df=-(Ag[i+1]-Ag[i])+a*v[i]+b*ac[i]; // delta Force
du=df/K;
dv=3*du/dt-3*v[i]-dt*ac[i]/2;
dac=6*(du-dt*v[i])/(dt*dt)-3*ac[i];
u[i+1]=u[i]+du;
v[i+1]=v[i]+dv;
ac[i+1]=ac[i]+dac;
}
Sd[j] = MAX_ABS(u,kn);
//Sv[j] = MAX_ABS(v,kn);
//Sa[j] = MAX_ABS(ac,kn);
Spv[j] =Sd[j]*omega[j];
Spa[j] = Sd[j]*(omega[j]*omega[j])/GRAVITY;
T[j+1]=T[j]+dt;
//cout<<T[j]<<" "<< Spa[j]<<endl;
}
Sd[1]=0; Spv[0]=0;Spv[1]=0;Spa[0]=MAX_ABS(Ag,kn)/GRAVITY;Spa[1]=MAX_ABS(Ag,kn)/GRAVITY;
free(u);free(v);free(ac);free(omega);
free(Sv);free(Sa);free(Spv);
}
void MessageInitialData(double GRAVITY,double zet,double endp){
char Qa,Qb,Qc,Qd,Qe,Qf,Qg,Qk;
int i;Qa=201;Qb=205;Qc=187;Qd=200;Qe=188,Qf=186,Qg=204,Qk=185;
printf("tttt%c",Qa);
for (i=1;i<61;i++)
printf("%c",Qb);
printf("%cn",Qc);
printf("tttt%c >> IN THE NAME OF GOD << %cn",Qf,Qf);
printf("tttt%c Elastic Response Spectrum %cn",Qf,Qf);
printf("tttt%c",Qg);
for (i=1;i<61;i++)
printf("%c",Qb);
printf("%cn",Qk);
printf("tttt%c Unit: Free unit %cn",Qf,Qf);
printf("tttt%c Notice: All input values must be positive %cn",Qf,Qf);
printf("tttt%c",Qg);
for (i=1;i<61;i++)
printf("%c",Qb);
printf("%cn",Qk);
printf("tttt%c Program is written by Salar Delavar Ghashghaei %cn",Qf,Qf);
printf("tttt%c E-mail: salar.d.ghashghaei@gmail.com %cn",Qf,Qf);
printf("tttt%c",Qd);
for (i=1;i<61;i++)
printf("%c",Qb);
printf("%cn",Qe);
MessageAnalysisReportTEXT();
printf(" Gravitational Constant: %fn",GRAVITY);
printf(" Damping Ratio in percent (%): %fn",zet);
printf(" End Period of Spectrum (sec): %fn",endp);
}
void IMPORT_GRAPH(double data[8],double DATA1[],double DATA2[],double NORMAL_DATA1[],double NORMAL_DATA2[],int n){
double DATA1NorMin,DATA1NorMax,DATA2NorMin,DATA2NorMax,DATA1_min,DATA1_max,DATA2_min,DATA2_max;
DATA1_min=MIN(DATA1,n);
DATA1_max=MAX(DATA1,n);
DATA2_min=MIN(DATA2,n);
DATA2_max=MAX(DATA2,n);
for (int i=1;i<n;i++){
NORMAL_DATA1[i]=DATA1[i]/(DATA1_max-DATA1_min); // Normalize DATA1
NORMAL_DATA2[i]=DATA2[i]/(DATA2_max-DATA2_min); // Normalize DATA2
3. }
DATA1NorMin=MIN(NORMAL_DATA1,n);//Minimum Normalize DATA1
DATA2NorMin=MIN(NORMAL_DATA2,n);//Minimum Normalize DATA2
DATA1NorMax=MAX(NORMAL_DATA1,n);//Maximum Normalize DATA1
DATA2NorMax=MAX(NORMAL_DATA2,n);//Maximum Normalize DATA2
data[0]=DATA1NorMin;
data[1]=DATA1NorMax;
data[2]=DATA2NorMin;
data[3]=DATA2NorMax;
data[4]=DATA1_min;
data[5]=DATA1_max;
data[6]=DATA2_min;
data[7]=DATA2_max;
}
void GRAPHICS(double data[8],double NORMAL_DATA1[],double NORMAL_DATA2[],int n,int kind){
double DATA1NorMin,DATA1NorMax,DATA2NorMin,DATA2NorMax,DATA1_min,DATA1_max,DATA2_min,DATA2_max;
DATA1NorMin=data[0];
DATA1NorMax=data[1];
DATA2NorMin=data[2];
DATA2NorMax=data[3];
DATA1_min=data[4];
DATA1_max=data[5];
DATA2_min=data[6];
DATA2_max=data[7];
int gd = DETECT, gm, color;
DWORD screenWidth = GetSystemMetrics(SM_CXSCREEN);
DWORD screenHeight = GetSystemMetrics(SM_CYSCREEN);
initwindow(screenWidth,screenHeight,"",-3,-3);// init window graphics
//initwindow(getmaxx( ),getmaxy( )); // initial window graphics
//initgraph(&gd, &gm, "C:TCBGI");
int i,j,a,x1,y1,x2,y2,Lx,Ly;
//initwindow(300, 300);
x1=95;
y1=85;
x2=x1+1250;
y2=y1+500;
Lx=x2-x1;
Ly=y2-y1;
setbkcolor(0);// set background
//setcolor(9); // color rectangle line
//setlinestyle(0,0,2);// (style,pattern,thickness)
//rectangle( x1, y1, x2,y2);
//setcolor(10);
//bar( x1, y1, x2, y2);
setlinestyle(0,0,1);// (style,pattern,thickness)
setcolor(9); // color dash line
if (DATA1NorMin < 0 && DATA1NorMax > 0){
a=y1*1/20;// Y - Coordinate Axis - 10 steps
for (i=1;i<=19;i++)
for (j=0;j<=124;j=j+2)
line(Lx*i/20 +x1,y1+j*a,Lx*i/20 +x1,y1+(j+1)*a);
a=x1*1/20; // X - Coordinate Axis - 10 steps
for (i=1;i<=19;i++)
for (j=0;j<=310;j=j+2)
line( x1+j*a,Ly*i/20 +y1,x1+(j+1)*a,Ly*i/20 +y1);
a=y1*1/5;// Y - Coordinate Axis - 5 steps
for (i=1;i<=10;i++)
line(Lx*i/10 +x1,y2,Lx*i/10 +x1,y2-a);
a=x1*1/5; // X - Coordinate Axis - 5 steps
for (i=1;i<=10;i++)
line( x1,y2-Ly*i/10,x1+a,y2-Ly*i/10);
}
else if (DATA2NorMin < 0 && DATA2NorMax > 0){
a=y1*1/20;// Y - Coordinate Axis - 10 steps
for (i=1;i<=19;i++)
for (j=0;j<=124;j=j+2)
line(Lx*i/20 +x1,y1+j*a,Lx*i/20 +x1,y1+(j+1)*a);
a=x1*1/20; // X - Coordinate Axis - 10 steps
for (i=1;i<=19;i++)
for (j=0;j<=310;j=j+2)
line( x1+j*a,Ly*i/20 +y1,x1+(j+1)*a,Ly*i/20 +y1);
a=y1*1/5;// Y - Coordinate Axis - 5 steps
for (i=1;i<=10;i++)
line(Lx*i/10 +x1,y2,Lx*i/10 +x1,y2-a);
a=x1*1/5; // X - Coordinate Axis - 5 steps
for (i=1;i<=10;i++)
line( x1,y2-Ly*i/10,x1+a,y2-Ly*i/10);
}
else{
a=y1*1/20;// Y - Coordinate Axis - 10 steps
for (i=1;i<=9;i++)
for (j=0;j<=120;j=j+2)
line(Lx*i/10 +x1,y1+j*a,Lx*i/10 +x1,y1+(j+1)*a);
a=x1*1/20; // X - Coordinate Axis - 10 steps
for (i=1;i<=9;i++)
for (j=0;j<=310;j=j+2)
line( x1+j*a,Ly*i/10 +y1,x1+(j+1)*a,Ly*i/10 +y1);
a=y1*1/5;// Y - Middle Coordinate Axis - 5 steps
for (i=1;i<=19;i++)
line(Lx*i/20 +x1,y2,Lx*i/20 +x1,y2-a);
a=x1*1/5; // X - Middle Coordinate Axis - 5 steps
for (i=1;i<=19;i++)
line( x1,y2-Ly*i/20,x1+a,y2-Ly*i/20);
a=y1*1/10;// Y - Middle Coordinate Axis - 100 steps
for (i=1;i<=99;i++)
line(Lx*i/100 +x1,y2,Lx*i/100 +x1,y2-a);
a=x1*1/7; // X - Middle Coordinate Axis - 100 steps
for (i=1;i<=99;i++)
line( x1,y2-Ly*i/100,x1+a,y2-Ly*i/100);
}
//cleardevice();
setcolor(WHITE);// set text color
if (kind == 0){
settextstyle(1, 0, 5);settextjustify(10, 5);
outtextxy(x2/2 -400,25,"Elastic Displacement Spectrum");// print text in window subtitle
settextstyle(1, 1, 1);settextjustify(10, 5);
outtextxy(x1/10 -10,.5*Ly+y1,"Sd");// print text in window graphics y
}
else if(kind == 1){
settextstyle(1, 0, 5);settextjustify(10, 5);
outtextxy(x2/2 -500,25,"Elastic Pseudo Acceleration Spectrum");// print text in window subtitle
settextstyle(1, 1, 1);settextjustify(10, 5);
outtextxy(x1/10 -10,.6*Ly+y1,"Spa (g)");// print text in window graphics y
}
settextjustify(50, 5);settextstyle(1, 0, 1);
outtextxy(x2/2 -10,y2 +50,"Peroid (sec)");// print text in window graphics x
char bufferX[10][100],bufferY[10][100];
double dXdata,dYdata;
settextstyle(-1, 0,-3);settextjustify(10, 5);
sprintf(bufferX[1], "%.3e" , DATA1_min);
outtextxy(x1-45,y2+10,bufferX[1]);// print text in window graphic x axis point
sprintf(bufferX[1], "%.3e" , DATA2_min);
outtextxy(x1-69,y2 -5,bufferX[1]);// print text in window graphic y axis point
for (i=1;i<=10;i++){
dXdata = DATA1_min + 0.1*i*(DATA1_max - DATA1_min);
if (ABS(dXdata) <= 1e-20) dXdata = 0.0; // if number is very low, got it zero
sprintf(bufferX[i], "%.3e" ,dXdata);
outtextxy(x1+Lx*i*.1-45,y2+10,bufferX[i]);// print text in window graphic x axis point -> max
}
for (i=1;i<=10;i++){
dYdata = DATA2_min + 0.1*i*(DATA2_max - DATA2_min);
if (ABS(dYdata) <= 1e-20) dYdata = 0.0; // if number is very low, got it zero
sprintf(bufferY[i], "%.3e" , dYdata);
outtextxy(x1-69,y2-Ly*i*.1 -5,bufferY[i]);// print text in window graphic y axis point -> max
}
double *X = new double [N];
double *Y = new double [N];
//Absolute data
double DATA1NorMin_Abs,DATA2NorMin_Abs;
DATA1NorMin_Abs=ABS(DATA1NorMin);DATA2NorMin_Abs=ABS(DATA2NorMin);
/*
setcolor(9);
setlinestyle(0,0,2);// (style,pattern,thickness)
line(Lx*(DATA1NorMin_Abs/(DATA1NorMax-DATA1NorMin)) +x1,y1,Lx*(DATA1NorMin_Abs/(DATA1NorMax-DATA1NorMin)) +x1,y2); //Middle axis -X
line(x1,y2-Ly*(DATA2NorMin_Abs/(DATA2NorMax-DATA2NorMin)),x2,y2-Ly*(DATA2NorMin_Abs/(DATA2NorMax-DATA2NorMin))); // Middle axis -Y
*/
if (DATA2NorMin < 0 && DATA2NorMax > 0 && DATA1NorMin >= 0)
X[0]=x2,Y[0]=y2;//First point
else if (DATA2NorMin <= 0 && DATA2NorMax <= 0)
X[0]=x2,Y[0]=y2;//First point
else
X[0]=x1,Y[0]= y2-Ly*(NORMAL_DATA2[1]/(DATA2NorMax-DATA2NorMin));//First point
// Draw line
setcolor(YELLOW);
setlinestyle(0,0,2);// (style,pattern,thickness)
for (i=1;i<=n-1;i++){
NORMAL_DATA1[i] = NORMAL_DATA1[i] + DATA1NorMin_Abs;//Absolute DATA1
NORMAL_DATA2[i] = NORMAL_DATA2[i] + DATA2NorMin_Abs;//Absolute DATA2
4. X[i] = x1+Lx*(NORMAL_DATA1[i]/(DATA1NorMax-DATA1NorMin));
Y[i] = y2-Ly*(NORMAL_DATA2[i]/(DATA2NorMax-DATA2NorMin));
line(X[i-1],Y[i-1],X[i],Y[i]);
}
// Covering error ;-)
setcolor(9);
settextstyle(1, 0,1);
rectangle( x1, y1, x2,y2);
/*
// Middle axis
double dXdata_abs,dYdata_abs;
int Ix,Iy;
if (DATA1NorMin < 0 && DATA1NorMax > 0)
for (i=1;i<=10;i++)
{
dXdata = DATA1_min + 0.1*i*(DATA1_max - DATA1_min);//cout<<dXdata<<endl;
if (dXdata > 0 && dXdata < .00001)
Ix=i;//cout<<"Ix: "<<Ix<<endl;
}
line(Lx*Ix/10 +x1,y1,Lx*Ix/10 +x1,y2);
if (DATA2NorMin < 0 && DATA2NorMax > 0)
for (i=1;i<=10;i++)
{
dYdata = DATA2_min + 0.1*i*(DATA2_max - DATA2_min);//cout<<dYdata<<endl;
if (dYdata > 0 && dYdata < .00001)
Iy=i;//cout<<"Iy: "<<Iy<<endl;
}
line(x1,Ly*Iy/10 +y1,x2,Ly*Iy/10 +y1);
*/
/* Box text */
/*
setcolor(9);
settextstyle(1, 0,1);
rectangle( x1+350, y2+50, x1+900,y2+80);
setlinestyle(1,0,3);settextjustify(10, 5);// (style,pattern,thickness)
outtextxy(x1+355,y2+55,"Analysis");// print text in box
setlinestyle(1,0,3);settextjustify(10, 5);// (style,pattern,thickness)
outtextxy(x1+620,y2+55,"Bilinear");// print text in box
setcolor(YELLOW);line(x1+500,y2+65,x1+600,y2+65);
setcolor(10);line(x1+765,y2+65,x1+850,y2+65);
*/
getch();
closegraph();
}
double ABS(double B){
double B_abs;
if (B < 0)
B_abs = -B;//Absolute number
else
B_abs = B;
return B_abs;
}
double MIN(double A[],int n){
int i;
double Amin;
Amin = A[0];
for (i=1;i<n;i++){
if (Amin > A[i])
Amin=A[i];
}
return Amin;//Minimum DATA
}
double MAX(double A[],int n){
int i;
double Amax;
Amax = A[0];
for (i=1;i<n;i++){
if (Amax < A[i])
Amax=A[i];
}
return Amax;//Maximum DATA
}
void MessageErrorReportTEXT(){
int i;
char Ql;
Ql=176;
textcolor(12);
printf("an ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf(" Error Report ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf("n");
}
void OUTPUT_EXCEL(double time[],double Sd[],double Spa[],int n){
// EXCEL OUTPUT
int i;
FILE *OutputFile;
OutputFile = fopen(ShowText03, "w");
fprintf(OutputFile," ### Output Elastic Response Spectrum ###n");
fprintf(OutputFile,"Step,Time,Spectral Displacement,Pseudo Acceleration Spectrumn");
for(i=0;i<n;i++)
fprintf(OutputFile,"%d,%f,%f,%fn",i+1,time[i],Sd[i],Spa[i]);
fclose(OutputFile);
}
void OUTPUT_html(double GRAVITY,double zet,double endp,double time[],double Sd[],double Spa[],int n){
// HTML OUTPUT
int i;
FILE *OutputFile;
OutputFile = fopen(ShowText04, "w");
fprintf(OutputFile,"<html> <body bgcolor="green">n");
// TOP TITLE oF HTML FILE
fprintf(OutputFile,"<table style=”width:100%” border="2px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<th bgcolor="cyan"> Elastic Response Spectrum - Output Report </th> n");
// TABLE 1
fprintf(OutputFile,"<table style=”width:100%” border="1px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<th colspan="2" bgcolor="orange"> Input Data </th> n");
fprintf(OutputFile,"<tr> <th bgcolor="orange"> Gravitational Constant: </th><th> %.3e </th></tr>n",GRAVITY);
fprintf(OutputFile,"<tr> <th bgcolor="orange"> Damping Ratio in percent (%): </th><th> %.3e </th></tr>n",zet);
fprintf(OutputFile,"<tr> <th bgcolor="orange"> End Period of Spectrum (sec): </th><th> %.3e </th></tr>n",endp);
// TABLE 2
fprintf(OutputFile,"<table style=”width:100%” border="1px" width="1000px" height="120px" bgcolor="yellow">n");
fprintf(OutputFile,"<th colspan="4" bgcolor="orange"> Displacement and Pseudo Acceleration Spectrum</th> n");
fprintf(OutputFile,"<tr> <th bgcolor="orange"> Step </th><th bgcolor="orange"> Time(Period) </th> <th bgcolor="orange"> Spectral Displacement </th> <th bgcolor="orange"> Pseudo Acceleration Spectrum </th></tr>n");
for(i=0;i<n;i++){
fprintf(OutputFile,"<tr> <td align ="center"> %d </td> <td align ="center"> %.3e </td> <td align ="center"> %.3e </td> <td align ="center"> %.3e </td></tr>n",i+1,time[i],Sd[i],Spa[i]);
}
fprintf(OutputFile,"</table></body></html>n");
fclose(OutputFile);
}
void MessageCheckInput(int M){
if (M>N || M<2){
MessageErrorReportTEXT();
printf(" Please check this file! -> [ ElasticResponseSpectrum-inputACCELERATION.csv ]n");
printf(" Number of data : %d - Minimum : 3 - Maximum : 20000",M);
Sleep(40000);
exit(1);
}
}
void MessageAnalysisReportTEXT(){
int i;
char Ql=176;
printf("n ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf(" Input Data ");
for (i=1;i<50;i++)
printf("%c",Ql);
printf("n");
}
void MessageCheck_IMPORT_DATA01(double GRAVITY,double zet,double endp){
if ( GRAVITY < 0 || zet < 0 || endp< 0 ){
MessageErrorReportTEXT();
printf(" Please check this file! -> [%s]n",ShowText01);
printf(" *** Negative data input value is not acceptable ***n");
printf(" Gravitational Constant: %f",GRAVITY);
printf(" Damping Ratio in percent (%): %f",zet);
printf(" End Period of Spectrum (sec): %f",endp);
Sleep(40000);
exit(1);
}
}
/*
void IMPORT_DATA01(double &GRAVITY,double &zet,double &endp){
ifstream IN1;IN1.open("ElasticResponseSpectrum-input.csv");
IN1>>GRAVITY>>zet>>endp;
IN1.close();
}
void IMPORT_DATA02(double t[],double Ag[],double GRAVITY,int &kn){
double Time,Acceleration,dt;char CHAR;
int i=0;
ifstream IN2;IN2.open("ElasticResponseSpectrum-inputACCELERATION.csv");//import strain-stress of elements
while(IN2 >> Time >> CHAR >> Acceleration){
t[i]=Time;Ag[i]=Acceleration*GRAVITY;
//cout<<"t["<<i<<"]:"<<t[i]<<" - Ag["<<i<<"]:"<<Ag[i]<<endl;
i++;
}
kn=i;
IN2.close();
}
*/
5. void IMPORT_DATA01(double &GRAVITY,double &zet,double &endp){
int i=0;
double AA[3];
FILE *InputFile;
InputFile = fopen(ShowText01, "r");
if (!InputFile){
MessageErrorReportTEXT();
printf(" File is not available! -> [%s] n",ShowText01);
}
char line[100],a[100];
while(i < N && fgets(line,sizeof(line),InputFile) != NULL){
sscanf(line,"%s",a);
//printf("a[%d]: %sn",i,a);
AA[i]= atof(a);
i++;
}
GRAVITY=AA[0];zet=AA[1];endp=AA[2];
}
void IMPORT_DATA02(double t[],double Ag[],double GRAVITY,int &kn){
int i = 0;
FILE *InputFile;
InputFile = fopen(ShowText02, "r");
if (!InputFile){
MessageErrorReportTEXT();
printf(" File is not available! -> [%s] n",ShowText02);
exit(1);
}
char line[1000];
double Time,Acceleration;
do{
fscanf(InputFile,"%lf,%lf",&Time,&Acceleration);
t[i]=Time;Ag[i]=Acceleration*GRAVITY;
//printf("%d - t[%d]: %lf - Ag[%d]: %lfn",i,i,t[i],i,Ag[i]);
i++;
}
while(i < N && fgets(line,sizeof(line),InputFile) != NULL);
kn = i;
}
void textcolor(int ForgC){
WORD wColor;
//This handle is needed to get the current background attribute
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
//csbi is used for wAttributes word
if(GetConsoleScreenBufferInfo(hStdOut, &csbi)){
//To mask out all but the background attribute, and to add the color
wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
SetConsoleTextAttribute(hStdOut, wColor);
}
return;
}
double MAX_ABS(double A[],int n){
int i;
double B[N];
double Amax;
// abs value
for (i=0;i<n;i++){
B[i] = A[i];
if(B[i] < 0)
B[i] = -B[i];
}
// Max of abs
Amax = B[0];
for (i=1;i<n;i++){
if(Amax < B[i])
Amax = B[i];
}
return Amax;
}
void OUTPUT_HTML_GRAPH(double X[],double Y[],int n,const char text1[],const char text2[],const char text3[]){
// HTML GRAPH OUTPUT
int i;
double x,y,NorX[N],NorY[N],Xmax,Ymax;
Xmax=MAX_ABS(X,n);
Ymax=MAX_ABS(Y,n);
for (i=0;i<n;i++){
NorX[i] = X[i]/Xmax;
NorY[i] = Y[i]/Ymax;
//printf("t %f %f n",NorX[i],NorY[i]);
}
FILE *OutputFile;
OutputFile = fopen(ShowText05, "w");
fprintf(OutputFile,"<!DOCTYPE HTML><html><body style="background-color:black;"><font color="white"><head><script> n");
fprintf(OutputFile,"window.onload = function(){ n");
fprintf(OutputFile,"var canvas = document.getElementById("myCanvas");var s1 = canvas.getContext("2d");var s2 = canvas.getContext('2d'); n");
fprintf(OutputFile,"var s3 = canvas.getContext("2d");var s4 = canvas.getContext("2d");var s5 = canvas.getContext("2d"); n");
fprintf(OutputFile,"var x=120,y=80,X,Y,Lx=1100,Ly=500,i; n");
fprintf(OutputFile,"s3.beginPath();s3.lineWidth = 3;s3.strokeStyle = "cyan";s3.rect(x,y,Lx,Ly); n");
fprintf(OutputFile,"for(i=0;i<9;i++){s3.moveTo(x+Lx*(i+1)*.1,y+Ly);s3.lineTo(x+Lx*(i+1)*.1,y+Ly-10);}; n");
fprintf(OutputFile,"for(i=0;i<9;i++){s3.moveTo(x,y+Ly*(i+1)*.1);s3.lineTo(x+10,y+Ly*(i+1)*.1);};s3.stroke();n");
fprintf(OutputFile,"s1.beginPath();s1.lineWidth = 3;s1.strokeStyle = "yellow"; n");
for (i=0;i<n-1;i++){
fprintf(OutputFile,"s1.moveTo(%f,%f);",120+NorX[i]*1100,80+500-NorY[i]*500);
fprintf(OutputFile,"s1.lineTo(%f,%f); n",120+NorX[i+1]*1100,80+500-NorY[i+1]*500);
}
fprintf(OutputFile,"s1.stroke(); n");
fprintf(OutputFile,"s2.beginPath();s2.lineWidth = 1;s2.strokeStyle = "cyan";s2.setLineDash([5, 5]); n");
fprintf(OutputFile,"for(i=0;i<19;i++){s2.moveTo(x+Lx*(i+1)*.05,y);s2.lineTo(x+Lx*(i+1)*.05,y+Ly);} n");
fprintf(OutputFile,"s2.lineWidth = 1;s2.strokeStyle = "cyan";for(i=0;i<19;i++){s2.moveTo(x,y+Ly*(i+1)*.05);s2.lineTo(x+Lx,y+Ly*(i+1)*.05);} s2.stroke();n");
fprintf(OutputFile,"X=x+.25*Lx;Y=.7*y;s4.translate(X,Y);s4.font="50px serif";s4.fillStyle = "#7fff00";s4.fillText("%s",0,0); n",text1);
fprintf(OutputFile,"s4.save();X=-X+.2*x;Y=-Y+y+.6*Ly;s4.translate(X,Y);s4.rotate(3*Math.PI/2);s4.font="15px serif"; n");
fprintf(OutputFile,"s4.fillStyle = "#7fff00";s4.textAlign = "left";s4.fillText("%s",0,0);s4.restore(); n",text3);
fprintf(OutputFile,"s4.save();X=.2*Lx;Y=y+Ly-20;s4.translate(X,Y);s4.rotate(2*Math.PI);s4.font="15px serif";s4.fillStyle = "#7fff00"; n");
fprintf(OutputFile,"s4.textAlign = "left";s4.fillText("%s",0,0);s4.restore(); n",text2);
for(i=0;i<10;i++){
x=.1*(i+1)*Xmax;
fprintf(OutputFile,"s5.save();X=-.29*Lx+Lx*(%d+1)*.1;Y=.3*y+Ly+20;s5.rotate(2*Math.PI);s5.font="16px serif"; n",i);
fprintf(OutputFile,"s5.fillStyle = "#7fff00";s5.textAlign = "left";s5.fillText("%.3e",X,Y);s5.restore(); n",x);
}
for(i=0;i<10;i++){
y=.1*(i+1)*Ymax;
fprintf(OutputFile,"s5.save();X=-.28*Lx-50;Y=Ly+.3*y-Ly*(%d+1)*.1;s5.rotate(2*Math.PI);s5.font="16px serif"; n",i);
fprintf(OutputFile,"s5.fillStyle = "#7fff00";s5.textAlign = "left";s5.fillText("%.3e",X,Y);s5.restore(); n",y);
}
fprintf(OutputFile,"s5.save();X=-.25*Lx;Y=.3*y+Ly+20;s5.rotate(2*Math.PI);s5.font="16px serif";s5.fillStyle = "#7fff00";s5.fillText(0,X,Y);s5.restore(); n");
fprintf(OutputFile,"s5.save();X=-.25*Lx-50;Y=Ly+.3*y;s5.rotate(2*Math.PI);s5.font="16px serif";s5.fillStyle = "#7fff00";s5.textAlign = "left";s5.fillText(0,X,Y);s5.restore();}; n");
fprintf(OutputFile,"</script></head><body><canvas id="myCanvas" width="1300" height="1300" style="border:1px solid black;"></canvas></body></html> n");
fclose(OutputFile);
}