コード例 #1
0
ファイル: Model.cpp プロジェクト: Tigrouzen/UnrealEngine-4
void UModel::CalculateUniqueVertCount()
{
	NumUniqueVertices = Points.Num();

	if(NumUniqueVertices == 0 && Polys != NULL)
	{
		TArray<FVector> UniquePoints;

		for(int32 PolyIndex(0); PolyIndex < Polys->Element.Num(); ++PolyIndex)
		{
			for(int32 VertIndex(0); VertIndex < Polys->Element[PolyIndex].Vertices.Num(); ++VertIndex)
			{
				bool bAlreadyAdded(false);
				for(int32 UniqueIndex(0); UniqueIndex < UniquePoints.Num(); ++UniqueIndex)
				{
					if(Polys->Element[PolyIndex].Vertices[VertIndex] == UniquePoints[UniqueIndex])
					{
						bAlreadyAdded = true;
						break;
					}
				}

				if(!bAlreadyAdded)
				{
					UniquePoints.Push(Polys->Element[PolyIndex].Vertices[VertIndex]);
				}
			}
		}

		NumUniqueVertices = UniquePoints.Num();
	}
}
コード例 #2
0
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* No representations about the suitability of this software for
* any purpose is made. It is provided "as is" without express
* or implied warranty.
*/

#include "AcceleratorModel/StdComponent/Collimator.h"
#include "AcceleratorModel/TrackingInterface/ComponentTracker.h"

// Class Collimator
const int Collimator::ID = UniqueIndex();

Collimator::Collimator (const string& id, double len)
	: Drift(id,len),Xr(0)
{
	scatter_at_this_collimator = true;
}

Collimator::Collimator (const string& id, double len, double radLength)
	: Drift(id,len),Xr(radLength)
{
	scatter_at_this_collimator = true;
}

Collimator::Collimator (const string& id, double len, Material* pp, double P0)
	: Drift(id, len), p(pp)
コード例 #3
0
 * this permission notice appear in supporting documentation.
 * No representations about the suitability of this software for
 * any purpose is made. It is provided "as is" without express
 * or implied warranty.
 */


#include "AcceleratorModel/TrackingInterface/ComponentTracker.h"

// Solenoid
#include "AcceleratorModel/StdComponent/Solenoid.h"


// Class Solenoid

const int Solenoid::ID = UniqueIndex();

Solenoid::Solenoid (const std::string& id, double len, double Bz)
	: SimpleSolenoid(id,new RectangularGeometry(len),new BzField(Bz))
{
}



void Solenoid::RotateY180 ()
{
	BzField& field = GetField();
	field.SetStrength(-field.GetStrength());
}

const string& Solenoid::GetType () const
コード例 #4
0
// Merlin C++ Class Library for Charged Particle Accelerator Simulations
//
// Class library version 5.01 (2015)
//
// Copyright: see Merlin/copyright.txt
//
// Created:		06.10.14 Haroon Rafique
// Modified:
// Last Edited: 05.01.15 HR
//
/////////////////////////////////////////////////////////////////////////

#include "AcceleratorModel/StdComponent/HollowElectronLens.h"
#include "AcceleratorModel/TrackingInterface/ComponentTracker.h"

const int HollowElectronLens::ID = UniqueIndex();

HollowElectronLens::HollowElectronLens (const string& id, double len)
	: Drift(id,len)
{}

const string& HollowElectronLens::GetType () const
{
	_TYPESTR(HollowElectronLens);
}

int HollowElectronLens::GetIndex () const
{
	return  ID;
}
コード例 #5
0
// StandardMultipoles
#include "AcceleratorModel/StdComponent/StandardMultipoles.h"


#define _RMC1(n)  RectMultipole(id,len,n,dnB)
#define _RMC2(n)  RectMultipole(id,len,n,B,r0)
#define _RMSC1(n)  RectMultipole(id,len,n,dnB,true)
#define _RMSC2(n)  RectMultipole(id,len,n,B,r0,true)
#define _MPT _PREPTRACK(aTracker,RectMultipole);
#define _RID return ID;
#define _CP(type) return new type (*this);


// Class Quadrupole

const int Quadrupole::ID = UniqueIndex();

Quadrupole::Quadrupole (const string& id, double len, double dnB)
	: _RMC1(1)
{
}

Quadrupole::Quadrupole (const string& id, double len, double B, double r0)
	: _RMC2(1)
{
}



void Quadrupole::PrepareTracker (ComponentTracker& aTracker)
{