コード例 #1
0
ファイル: BCInterfaceData.cpp プロジェクト: nuraiman/lifev
// ===================================================
// Methods
// ===================================================
void
BCInterfaceData::readBC( const std::string& fileName, const std::string& dataSection, const std::string& name )
{
    GetPot dataFile( fileName );

    // Read base
    readBase( dataFile, dataSection + name + "/", M_base, M_baseString );

    // Read parameters
    readParameters( dataFile, ( dataSection + name + "/parameters" ).c_str() );
}
コード例 #2
0
ファイル: main.c プロジェクト: 8l/insieme
size_t setAll(const char* filePath, const char* filenameAdditon, double** VecSig, double** VecStr, double** VecDsig,
		double** VecDstr, double** InvF,double** InvFT, double** G, double** P11q, double** P22, double** P21, double** T3, double** Fe1q,
		double** Fe2, double** Fs, double** ppu, double** lBase, double** XG, size_t** nrOfOrder, ght_hash_table_t** icoShellSections,
		ght_hash_table_t** elsets, ght_hash_table_t** issSizes, ght_hash_table_t** elsetSizes, ght_hash_table_t** matMap,
		struct CLElemQMHS4* cLElemQMHS4) {
	char path[512];
	size_t initialsize = 64;
	size_t height = 1, width = 1, num = 1, offset = 0;
	size_t elements = 0;
	size_t elemsInObject = 0;
	double* data = NULL;
	sprintf(path, "%s%s", filePath, filenameAdditon);

	elemsInObject = setChangingFiles(path, VecSig, VecStr, VecDsig, VecDstr, InvF, InvFT, G, P11q, P22, P21, Fe1q, Fe2, Fs, &data);

	// speacial handling for G. It is not read and size is not consitent with the size in the input file
	*G = (double*)calloc(elemsInObject * 24 * 14, sizeof(double));


	// load
	elements = readMatrix1D(&data, &height, &width, &initialsize, &offset, path, "T3.sav");
	// copy data
	alocNcpy(T3, data, elements, height * width);
	// TODO fix handling of T3
	cLElemQMHS4->T3Ptr = *T3;

	// load u
	// TODO works only if Manfred gives you the data for this iteration
	elemsInObject = readScalar(&data, &initialsize, path, "ppu.sav");
	// copy data
	alocNcpy(ppu, data, elemsInObject, 1);
	cLElemQMHS4->u = *ppu;

	// iteration independent stuff

	initialsize = elements;
	// load nrOfOrder
	elements = readScalarUint(nrOfOrder, &initialsize, filePath, "nrOfOrder.sav");
	cLElemQMHS4->nrOfOrder = *nrOfOrder;

	// load LBase
	elements = readBase(&data, &num, &height, &width, &initialsize, filePath, "lBase.out");
	// copy data
	alocNcpy(lBase, data, elements, num*height*width);
	cLElemQMHS4->LBase = *lBase;


	// load XG
	elemsInObject = readMatrix1D(&data, &width, &height, &initialsize, &offset, filePath, "XG.sav"); // height and width interchanged!
	// copy data
	alocNcpy(XG, data, elemsInObject, height*width);
	cLElemQMHS4->XG = *XG;


	// set fields
	cLElemQMHS4->sigPtr = *VecSig;
	cLElemQMHS4->strPtr = *VecStr;
	cLElemQMHS4->Dsig = *VecDsig;
	cLElemQMHS4->Dstr = *VecDstr;
	cLElemQMHS4->invF = *InvF;
	cLElemQMHS4->invFT = *InvFT;
	cLElemQMHS4->G = *G;
	cLElemQMHS4->P11q = *P11q;
	cLElemQMHS4->P22 = *P22;
	cLElemQMHS4->P21 = *P21;
	cLElemQMHS4->fe1q = *Fe1q;
	cLElemQMHS4->fe2 = *Fe2;
	cLElemQMHS4->fs = *Fs;


	// TODO put one element in an IcoShellSection
	struct Material* mat = (struct Material*)malloc(sizeof(struct Material));
	mat->materialName = "MAT";
	setMaterialElastic(mat, 6.825e7, 0.30);
	*matMap = ght_create(1);

	ght_insert((void*)*matMap, mat, sizeof(char*), mat->materialName);
	cLElemQMHS4->mat = *matMap;

	const char* elemName = "fake";
	struct icoSSData* isd = (struct icoSSData*)malloc(sizeof(struct icoSSData));
	isd->ug = -0.02;
	isd->og = 0.02;
	isd->intPoints = 5;
	isd->matName = mat->materialName;

	(*icoShellSections) = ght_create(1);
	ght_insert((void*)*icoShellSections, isd, sizeof(char*), elemName); //(*icoShellSections)[elemName] = new icoSSData[1];
	//(*icoShellSections)[elemName][0] = isd;
// 	std::map<const char*, size_t> issSizes;
	*issSizes = ght_create(1);
	size_t* iss = (size_t*)malloc(sizeof(size_t));
	*iss = 1u;
	ght_insert((void*)*issSizes, iss, sizeof(char*), elemName);
//	issSizes[elemName] = 1u;
	cLElemQMHS4->icoShellSections = *icoShellSections;
	cLElemQMHS4->issSize = *issSizes;

	// putting elemsInObject elements in elsets
	int** idxs = (int**)malloc(sizeof(int*));
	*idxs = (int*)malloc(elemsInObject * sizeof(int));
//	(*elsets)[elemName] = (int*)malloc(elemsInObject * sizeof(int));
	for(size_t i = 0; i < elemsInObject; ++i)
		(*idxs)[i] = (i+1);
	(*elsets) = ght_create(1);
	ght_insert((void*)*elsets, idxs, sizeof(char*), elemName);

	size_t* n = (size_t*)malloc(sizeof(size_t));
	*n = elemsInObject;

	*elsetSizes = ght_create(1);
	ght_insert((void*)*elsetSizes, n, sizeof(char*), elemName);

	cLElemQMHS4->elsets = *elsets;
	cLElemQMHS4->elsetSize = *elsetSizes;





	//set intersect to 0
	cLElemQMHS4->interSec = (int*)calloc(elements*4, sizeof(int));
	// set elements to 0
	cLElemQMHS4->elements = setElementsZero(elements);

	//set elast to 1
	cLElemQMHS4->elast = 1;

	free(data);

	return elements;
}