Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F83698155
geometry.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Sep 18, 13:38
Size
3 KB
Mime Type
text/x-c
Expires
Fri, Sep 20, 13:38 (2 d)
Engine
blob
Format
Raw Data
Handle
20879813
Attached To
rLIBMULTISCALE LibMultiScale
geometry.cc
View Options
/**
* @file geometry.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Fri Jan 10 20:47:45 2014
*
* @brief Common mother of all geometries
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "lm_common.hh"
#include "geometry.hh"
__BEGIN_LIBMULTISCALE__
Geometry::Geometry(UInt Dim,GeomType type, GeomID id)
:type(type),id(id),dim(Dim){
DUMP("creation of a geometric object with dimension " << Dim,DBG_DETAIL);
center[0]= 0.0;
center[1]= 0.0;
center[2]= 0.0;
rotCenter[0] = 0;
rotCenter[1] = 0;
rotCenter[2] = 0;
rotMatrix[0] = 1;
rotMatrix[4] = 1;
rotMatrix[8] = 1;
rotMatrix[1] = 0;
rotMatrix[2] = 0;
rotMatrix[3] = 0;
rotMatrix[5] = 0;
rotMatrix[6] = 0;
rotMatrix[7] = 0;
}
/* -------------------------------------------------------------------------- */
Geometry::~Geometry(){
}
/* -------------------------------------------------------------------------- */
Geometry::GeomType Geometry::getType() const {
return type;
}
/* -------------------------------------------------------------------------- */
UInt Geometry::getDim() const{
return dim;
}
/* -------------------------------------------------------------------------- */
void Geometry::setDim(UInt d){
dim = d;
}
/* -------------------------------------------------------------------------- */
void Geometry::setCenter(Real X,Real Y,Real Z){
center[0]=X;center[1]=Y;center[2]=Z;
}
/* -------------------------------------------------------------------------- */
void Geometry::setRotation(Real phi,Real theta,Real psi){
rotMatrix[0] = cos(psi)*cos(phi)-cos(theta)*sin(phi)*sin(psi);
rotMatrix[3] = cos(psi)*sin(phi)+cos(theta)*cos(phi)*sin(psi);
rotMatrix[6] = sin(psi)*sin(theta);
rotMatrix[1] = -sin(psi)*cos(phi)-cos(theta)*sin(phi)*cos(psi);
rotMatrix[4] = -sin(psi)*sin(phi)+cos(theta)*cos(phi)*cos(psi);
rotMatrix[7] = cos(psi)*sin(theta);
rotMatrix[2] = sin(theta)*sin(phi);
rotMatrix[5] =-sin(theta)*cos(phi);
rotMatrix[8] = cos(theta);
}
/* -------------------------------------------------------------------------- */
Real Geometry::getCenter(UInt i) const {
return center[i];
}
/* -------------------------------------------------------------------------- */
/// function to print the contain of the class
void Geometry::printself(std::ostream & stream, UInt indent) const {
std::string tabu;
for (UInt i = 0 ; i < indent ; ++i) tabu += "\t";
stream << tabu << "Dimension " << dim << std::endl;
stream << tabu << "type " << type << std::endl;
stream << tabu << "center : ";
for (UInt i = 0; i < dim; ++i) stream << center[i] << " ";
stream << std::endl;
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
Event Timeline
Log In to Comment