This repository serve as a backup for my Maxwell-TD code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

125 lines
2.2 KiB

#include <cstdio>
#include <cstring>
#include "bc.h"
bc::bc(int b_type){
bType = b_type;
rval = 0.0;
cval = 0.0;
field.reset();
//********* // change April 4 2011
magE = 0.0;
field.setvtr(0.0, 0.0, 0.0);
// Port variables
LocRo.setvtr(0.0, 0.0, 0.0);
LocR1.setvtr(0.0, 0.0, 0.0);
PortFlag = 1;
PortDirection.setvtr(0.0, 0.0, 0.0);
theta = 0.0;
phi = 0.0; // used for plane wave excitations
PW_ro.setvtr(0.0, 0.0, 0.0);
}
void bc::set_name(char *buffer){
sprintf(name, "%s", buffer);
}
void bc::set_bType(int b_type){
bType = b_type;
}
void bc::set_cval(fp_t r, fp_t i){
cval = r;
}
void bc::set_pNum(int pn) {
pNum = pn;
}
// magE is used to indicate the magnitude of the input of the electric field
// for port_type boundary condition.
void bc::set_magE(fp_t mag){
magE = mag;
}
void bc::set_bNum(int bn){
bNum = bn;
}
void bc::set_rval(fp_t rr) {
rval = rr;
}
int bcTypeConvert(char *buffer){
if(strcmp(buffer, "none") == 0)
return 0;
if(strcmp(buffer, "pmc") == 0)
return pmcType;
if(strcmp(buffer, "abc") == 0)
return abcType;
if(strcmp(buffer, "pec") == 0)
return pecType;
if(strcmp(buffer, "constE") == 0)
return constE;
if(strcmp(buffer, "imp") == 0)
return impType;
if(strcmp(buffer, "planeWave") == 0)
return planeWaveType;
if(strcmp(buffer, "port") == 0)
return portType;
if(strcmp(buffer, "DomainInterface") == 0)
return DomainInterFaceType;
if(strcmp(buffer, "fieldPlane") == 0)
return fieldPlaneType;
if(strcmp(buffer, "outputSurf") == 0)
return outputSurfType;
if(strcmp(buffer, "nonConformal") == 0)
return nonConformal;
if(strcmp(buffer, "pml") == 0)
return pmlType;
return 0;
}
bool isPort(const int bType){
return ((bType >= portType) && (bType < pecType));
}
int bc::getbNum(){
return bNum;
}
int bc::getbType(){
return bType;
}
void bc::SETFIELD(fp_t x, fp_t y, fp_t z){
field.setvtr(x, y, z);
}
char *bc::getName(){
return name;
}
void bc::setTheta(fp_t dval){
theta = dval;
}
void bc::setPhi(fp_t dval){
phi = dval;
}
fp_t bc::getTheta(){
return theta;
}
fp_t bc::getPhi(){
return phi;
}
vtr bc::getField(){
return field;
}